aboutsummaryrefslogtreecommitdiff
path: root/addon.gradle
blob: a774badd6a6509bcc8a4bd99ae5a472f4d48ca12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
tasks.named("jar", Jar).configure {
    manifest {
        attributes("Main-class": "kubatech.standalone")
    }
}


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(new File(buildDir, "tmp"))
}
tasks.named("assemble").configure {
    dependsOn(functionalTestSet.jarTaskName)
}

// Run tests in the default runServer/runClient configurations
tasks.named("runServer", JavaExec).configure {
    dependsOn(functionalTestSet.jarTaskName)
    classpath(configurations.named(functionalTestSet.runtimeClasspathConfigurationName), tasks.named(functionalTestSet.jarTaskName))
}

tasks.named("runClient", JavaExec).configure {
    dependsOn(functionalTestSet.jarTaskName)
    classpath(configurations.named(functionalTestSet.runtimeClasspathConfigurationName), tasks.named(functionalTestSet.jarTaskName))
}