how one would create a jar with it so the jmh classes are NOT in the resulting engine.jar like before?
here the diff of the pull request:
before:
// Instructions for packaging a jar file for the engine
jar {
// Unlike the content modules Gradle grabs the assets as they're in a resources directory. Need to avoid dupes tho
duplicatesStrategy = "EXCLUDE"
doFirst {
manifest {
def manifestClasspath = "$subDirLibs/" + configurations."${sourceSets.main.runtimeClasspathConfigurationName}".collect {
it.getName()
}.join(" $subDirLibs/")
attributes("Class-Path": manifestClasspath, "Implementation-Title": "Terasology", "Implementation-Version": displayVersion + ", engine v" + project.version + " , build number " + env.BUILD_NUMBER)
}
}
}
// JMH related tasks
sourceSets {
jmh {
java.srcDirs = ["src/jmh/java"]
resources.srcDirs = ["src/jmh/resources"]
compileClasspath += sourceSets.main.runtimeClasspath
java.destinationDirectory = new File("$buildDir/jmhClasses")
}
}
tasks.register("jmh", JavaExec) {
dependsOn jmhClasses
mainClass = "org.openjdk.jmh.Main"
classpath = sourceSets.jmh.compileClasspath + sourceSets.jmh.runtimeClasspath
}
after and broken:
// Instructions for packaging a jar file for the engine
jar {
// Unlike the content modules Gradle grabs the assets as they're in a resources directory. Need to avoid dupes tho
duplicatesStrategy = "EXCLUDE"
doFirst {
manifest {
def manifestClasspath = "$subDirLibs/" + configurations."${sourceSets.main.runtimeClasspathConfigurationName}".collect {
it.getName()
}.join(" $subDirLibs/")
attributes("Class-Path": manifestClasspath, "Implementation-Title": "Terasology", "Implementation-Version": displayVersion + ", engine v" + project.version + " , build number " + env.BUILD_NUMBER)
}
}
}
// JMH related tasks
sourceSets {
jmh {
java.srcDirs = ["src/jmh/java"]
resources.srcDirs = ["src/jmh/resources"]
compileClasspath += sourceSets.main.runtimeClasspath
java.destinationDirectory = new File("$buildDir/jmhClasses")
}
}
tasks.register("jmh", JavaExec) {
dependsOn jmhClasses
mainClass = "org.openjdk.jmh.Main"
classpath = sourceSets.jmh.compileClasspath + sourceSets.jmh.runtimeClasspath
}
dependencies {
jmhAnnotationProcessor("org.openjdk.jmh:jmh-generator-annprocess:1.27")
jmhImplementation("org.openjdk.jmh:jmh-core:1.27")
jmhImplementation("org.openjdk.jmh:jmh-generator-annprocess:1.27")
}
the error is
> Configure project :engine
w: file:///srv/http/repos/terasology/engine/build.gradle.kts:164:79: Unchecked cast: Any! to Map<String, String>
e: file:///srv/http/repos/terasology/engine/build.gradle.kts:240:25: Unresolved reference: jmh
e: file:///srv/http/repos/terasology/engine/build.gradle.kts:241:28: Unresolved reference: jmh
e: file:///srv/http/repos/terasology/engine/build.gradle.kts:242:41: Unresolved reference: jmh
e: file:///srv/http/repos/terasology/engine/build.gradle.kts:248:28: Unresolved reference: jmh
e: file:///srv/http/repos/terasology/engine/build.gradle.kts:248:68: Unresolved reference: jmh
e: file:///srv/http/repos/terasology/engine/build.gradle.kts:252:5: Unresolved reference: jmhAnnotationProcessor
e: file:///srv/http/repos/terasology/engine/build.gradle.kts:253:5: Unresolved reference: jmhImplementation
e: file:///srv/http/repos/terasology/engine/build.gradle.kts:254:5: Unresolved reference: jmhImplementation
FAILURE: Build failed with an exception.
* Where:
Build file '/srv/http/repos/terasology/engine/build.gradle.kts' line: 240
* What went wrong:
Script compilation errors:
Line 240: source = sourceSets.jmh.get().java
^ Unresolved reference: jmh
Line 241: classpath = sourceSets.jmh.get().compileClasspath
^ Unresolved reference: jmh
Line 242: destinationDirectory.set(sourceSets.jmh.get().java.destinationDirectory)
^ Unresolved reference: jmh
Line 248: classpath = sourceSets.jmh.get().compileClasspath + sourceSets.jmh.get().runtimeClasspath
^ Unresolved reference: jmh
Line 248: classpath = sourceSets.jmh.get().compileClasspath + sourceSets.jmh.get().runtimeClasspath
^ Unresolved reference: jmh
Line 252: jmhAnnotationProcessor("org.openjdk.jmh:jmh-generator-annprocess:1.27")
^ Unresolved reference: jmhAnnotationProcessor
Line 253: jmhImplementation("org.openjdk.jmh:jmh-core:1.27")
^ Unresolved reference: jmhImplementation
Line 254: jmhImplementation("org.openjdk.jmh:jmh-generator-annprocess:1.27")
^ Unresolved reference: jmhImplementation
8 errors
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 1m 8s
10 actionable tasks: 6 executed, 4 up-to-date