Skip to content

Failure on releasing jni projects #385

@abelavusau

Description

@abelavusau

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions