Skip to content

Commit

Permalink
Don't create testmod tasks for projects without tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed Feb 8, 2024
1 parent 3156b37 commit b4823ac
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ allprojects {

def mcVersion = getMCVersion(it)
String projectName = getProjectSimpleName(it)
def hasTest = it.file("src/testmod").exists()

loom {
runs {
Expand Down Expand Up @@ -341,10 +342,12 @@ allprojects {
reproducibleFileOrder = true
}

task testmodJar(type: Jar) {
from sourceSets.testmod.output
destinationDirectory = new File(project.buildDir, "devlibs")
archiveClassifier.set("testmod")
if (hasTest) {
task testmodJar(type: Jar) {
from sourceSets.testmod.output
destinationDirectory = new File(project.buildDir, "devlibs")
archiveClassifier.set("testmod")
}
}

[jar, sourcesJar].each {
Expand All @@ -353,12 +356,14 @@ allprojects {
}
}

task remapTestmodJar(type: RemapJarTask, dependsOn: testmodJar) {
input = testmodJar.archiveFile
archiveClassifier.set("testmod")
addNestedDependencies = false
if (hasTest) {
task remapTestmodJar(type: RemapJarTask, dependsOn: testmodJar) {
input = testmodJar.archiveFile
archiveClassifier.set("testmod")
addNestedDependencies = false
}
build.dependsOn remapTestmodJar
}
build.dependsOn remapTestmodJar
}

remapTestmodJar {
Expand Down

0 comments on commit b4823ac

Please sign in to comment.