Failure on releasing jni projects
We have a build consisting of cpp projects and some of those are jni shared libraries with the following build configuration:
release {
with(git) {
requireBranch.set("master")
failOnCommitNeeded.set(false)
commitVersionFileOnly.set(true)
tagTemplate.set(project.ext["release.tagTemplate"].toString())
preTagCommitMessage.set(project.ext["release.preTagCommitMessage"].toString())
newVersionCommitMessage.set(project.ext["release.newVersionCommitMessage"].toString())
}
}
val beforeReleaseBuild by tasks.getting
val afterReleaseBuild by tasks.getting
if (tasks.withType(Test::class).isNotEmpty()) {
beforeReleaseBuild.dependsOn(tasks.test)
}
afterReleaseBuild.dependsOn(tasks.publish)
library {
source.from("src/main/c++")
publicHeaders.from("src/main/include")
binaries.configureEach {
compileTask.get().compilerArgs.addAll(
listOf(
"-I", "${org.gradle.internal.jvm.Jvm.current().javaHome}/include",
"-I", "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/linux"
)
)
}
}
Running gradle release on the jni project i got:
Failed to notify project evaluation listener.
> Failed to query the value of property 'compileTask'.
> Could not create task ':commons-io-jni-release:commons-io-jni:compileTestCpp'.
> Could not create task of type 'CppCompile'.
> Could not create service of type DefaultCompilationStateCacheFactory.
> Cache 'nativeCompile' couldn't be reused because of the following mismatch:
* Requested value serializer type (org.gradle.language.nativeplatform.internal.incremental.CompilationStateSerializer) doesn't match current cache type (org.gradle.language.nativeplatform.internal.incremental.CompilationStateSerializer)
> Failed to query the value of property 'compileTask'.
> Could not create task ':commons-io-jni-release:commons-io-jni:compileDebugCpp'.
> Could not create task of type 'CppCompile'.
> Could not create service of type DefaultCompilationStateCacheFactory.
> Cache 'nativeCompile' couldn't be reused because of the following mismatch:
* Requested value serializer type (org.gradle.language.nativeplatform.internal.incremental.CompilationStateSerializer) doesn't match current cache type (org.gradle.language.nativeplatform.internal.incremental.CompilationStateSerializer)
After this all projects in the build are affected by this issue unless native-build/.gradle cache is deleted and the build is reconfigured again.
To get an idea what the issue could be here I would need some example project. And some information like gradle & java version that are used here. What might be an issue that I see is that you use org.gradle.internal.jvm.Jvm.current().javaHome but there is the java toolchain that should be used instead. See https://docs.gradle.org/current/userguide/toolchains.html It might be that you already use the java toolchain for the java projects which might be a different JDK than what you get by the internal gradle JVM.