mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-25 20:22:23 +00:00
63 lines
2.5 KiB
Groovy
63 lines
2.5 KiB
Groovy
|
|
import org.gradle.api.tasks.GradleBuild
|
|
|
|
SourceSet functionalTestSet = null
|
|
|
|
sourceSets {
|
|
functionalTestSet = create("functionalTest") {
|
|
java {
|
|
srcDir("src/functionalTest/java")
|
|
compileClasspath += sourceSets.patchedMc.output + sourceSets.main.output
|
|
}
|
|
}
|
|
}
|
|
|
|
configurations { configs ->
|
|
// Keep all dependencies from the main mod in the functional test mod
|
|
named(functionalTestSet.compileClasspathConfigurationName).configure {it.extendsFrom(named("compileClasspath").get())}
|
|
named(functionalTestSet.runtimeClasspathConfigurationName).configure {it.extendsFrom(named("runtimeClasspath").get())}
|
|
named(functionalTestSet.annotationProcessorConfigurationName).configure {it.extendsFrom(named("annotationProcessor").get())}
|
|
}
|
|
|
|
tasks.register(functionalTestSet.jarTaskName, Jar) {
|
|
from(functionalTestSet.output)
|
|
archiveClassifier.set("functionalTests")
|
|
// we don't care about the version number here, keep it stable to avoid polluting the tmp directory
|
|
archiveVersion.set("1.0")
|
|
destinationDirectory.set(layout.buildDirectory.dir("tmp"))
|
|
}
|
|
tasks.named("assemble").configure {
|
|
dependsOn(functionalTestSet.jarTaskName)
|
|
}
|
|
|
|
def functionalTestRunProperty = "ae2.withFunctionalTests"
|
|
def withFunctionalTests = providers.gradleProperty(functionalTestRunProperty).map { it.toBoolean() }.orElse(false).get()
|
|
def isCi = providers.environmentVariable("CI").map { it.toBoolean() }.orElse(false).get()
|
|
|
|
def addFunctionalTestsToRun = { JavaExec task ->
|
|
task.dependsOn(functionalTestSet.jarTaskName)
|
|
task.classpath(configurations.named(functionalTestSet.runtimeClasspathConfigurationName), tasks.named(functionalTestSet.jarTaskName))
|
|
}
|
|
|
|
tasks.register("runFunctionalTestServer", GradleBuild) {
|
|
group = project.tasks.named("runServer").get().group
|
|
description = "Runs the deobfuscated server with the AE2 functional test mod"
|
|
setTasks(["runServer"])
|
|
startParameter.projectProperties.put(functionalTestRunProperty, "true")
|
|
}
|
|
|
|
tasks.register("runFunctionalTestClient", GradleBuild) {
|
|
group = project.tasks.named("runClient").get().group
|
|
description = "Runs the deobfuscated client with the AE2 functional test mod"
|
|
setTasks(["runClient"])
|
|
startParameter.projectProperties.put(functionalTestRunProperty, "true")
|
|
}
|
|
|
|
if (withFunctionalTests || isCi) {
|
|
tasks.named("runServer", JavaExec).configure(addFunctionalTestsToRun)
|
|
}
|
|
|
|
if (withFunctionalTests) {
|
|
tasks.named("runClient", JavaExec).configure(addFunctionalTestsToRun)
|
|
}
|