comahe-de / i18n4k

Internationalization for Kotlin
Apache License 2.0
78 stars 9 forks source link

explicit or implicit dependency between androidReleaseSourcesJar and generateI18n4kFiles #57

Closed nuke-dash closed 8 months ago

nuke-dash commented 9 months ago

I run into following issue when trying to publish to a maven repo. So far I fail to find a solution to fix this. Does this mean anything? Any idea where to look into fixing this?

Task :shared:generateI18n4kFiles FAILED

FAILURE: Build failed with an exception.

  • What went wrong: A problem was found with the configuration of task ':shared:generateI18n4kFiles' (type 'GenerateI18n4kFilesTask').

    • Gradle detected a problem with the following location: '/Users/whoami/Documents/workspace/repo/shared/build/generated/sources/i18n4k'.

    Reason: Task ':shared:androidReleaseSourcesJar' uses this output of task ':shared:generateI18n4kFiles' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

Full Output  ./gradlew publishAndroidReleasePublicationToLocalTestRepoRepository --info Initialized native services in: /Users/whoami/.gradle/native Initialized jansi services in: /Users/whoami/.gradle/native Received JVM installation metadata from '/Users/whoami/.sdkman/candidates/java/17.0.9-zulu/zulu-17.jdk/Contents/Home': {JAVA_HOME=/Users/whoami/.sdkman/candidates/java/17.0.9-zulu/zulu-17.jdk/Contents/Home, JAVA_VERSION=17.0.9, JAVA_VENDOR=Azul Systems, Inc., RUNTIME_NAME=OpenJDK Runtime Environment, RUNTIME_VERSION=17.0.9+8-LTS, VM_NAME=OpenJDK 64-Bit Server VM, VM_VERSION=17.0.9+8-LTS, VM_VENDOR=Azul Systems, Inc., OS_ARCH=aarch64} Found daemon DaemonInfo{pid=1525, address=[4aeca985-6245-489b-82e9-4fb677a0a0a3 port:49966, addresses:[/127.0.0.1]], state=Idle, lastBusy=1705329971163, context=DefaultDaemonContext[uid=7c5fdfa0-6587-4659-ab2f-360825a9f285,javaHome=/Applications/Android Studio.app/Contents/jbr/Contents/Home,daemonRegistryDir=/Users/whoami/.gradle/daemon,pid=1525,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx2048M,-Dfile.encoding=UTF-8,-Duser.country=BE,-Duser.language=en,-Duser.variant]} however its context does not match the desired criteria. Java home is different. Wanted: DefaultDaemonContext[uid=null,javaHome=/Users/whoami/.sdkman/candidates/java/17.0.9-zulu/zulu-17.jdk/Contents/Home,daemonRegistryDir=/Users/whoami/.gradle/daemon,pid=23544,idleTimeout=null,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx2048M,-Dfile.encoding=UTF-8,-Duser.country=BE,-Duser.language=en,-Duser.variant] Actual: DefaultDaemonContext[uid=7c5fdfa0-6587-4659-ab2f-360825a9f285,javaHome=/Applications/Android Studio.app/Contents/jbr/Contents/Home,daemonRegistryDir=/Users/whoami/.gradle/daemon,pid=1525,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx2048M,-Dfile.encoding=UTF-8,-Duser.country=BE,-Duser.language=en,-Duser.variant] Looking for a different daemon... The client will now receive all logging from the daemon (pid: 18687). The daemon log file: /Users/whoami/.gradle/daemon/8.2.1/daemon-18687.out.log Starting 18th build in daemon [uptime: 1 hrs 39 mins 42.411 secs, performance: 100%, GC rate: 0.00/s, heap usage: 0% of 2 GiB] Using 24 worker leases. Now considering [/Users/whoami/Documents/workspace/repo] as hierarchies to watch Watching the file system is configured to be enabled if available File system watching is active Invalidating in-memory cache of /Users/whoami/Documents/workspace/repo/.gradle/8.2.1/fileHashes/fileHashes.bin Invalidating in-memory cache of /Users/whoami/Documents/workspace/repo/.gradle/8.2.1/fileHashes/resourceHashesCache.bin Starting Build The configuration classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. Invalidating in-memory cache of /Users/whoami/.gradle/caches/8.2.1/fileHashes/fileHashes.bin Invalidating in-memory cache of /Users/whoami/.gradle/caches/8.2.1/fileHashes/resourceHashesCache.bin Settings evaluated using settings file '/Users/whoami/Documents/workspace/repo/settings.gradle.kts'. Projects loaded. Root project using build file '/Users/whoami/Documents/workspace/repo/build.gradle.kts'. Included projects: [root project 'repo', project ':shared'] > Configure project : Evaluating root project 'repo' using build file '/Users/whoami/Documents/workspace/repo/build.gradle.kts'. The configuration detachedConfiguration1 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration1 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration1 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration1 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration2 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration2 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration2 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration2 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration3 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration3 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration3 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration3 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration4 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration4 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration4 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration4 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration5 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration5 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration5 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration5 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration6 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration6 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration6 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration6 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration7 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration7 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration7 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration7 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration8 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration8 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration detachedConfiguration8 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration detachedConfiguration8 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. Invalidating in-memory cache of /Users/whoami/Documents/workspace/repo/.gradle/buildOutputCleanup/outputFiles.bin The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. Invalidating in-memory cache of /Users/whoami/.gradle/caches/journal-1/file-access.bin Invalidating in-memory cache of /Users/whoami/.gradle/caches/8.2.1/kotlin-dsl/executionHistory.bin Caching disabled for Kotlin DSL accessors for root project 'repo' because: Build cache is disabled Skipping Kotlin DSL accessors for root project 'repo' as it is up-to-date. > Configure project :shared Evaluating project ':shared' using build file '/Users/whoami/Documents/workspace/repo/shared/build.gradle.kts'. Caching disabled for Kotlin DSL plugin specs accessors for classpath '83af3f3f4792830493c0e9ef36c6f86b' because: Build cache is disabled Skipping Kotlin DSL plugin specs accessors for classpath '83af3f3f4792830493c0e9ef36c6f86b' as it is up-to-date. Caching disabled for Kotlin DSL script compilation (Project/TopLevel/stage1) because: Build cache is disabled Skipping Kotlin DSL script compilation (Project/TopLevel/stage1) as it is up-to-date. The configuration :shared:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :shared:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :shared:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :shared:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. Using Kotlin Gradle Plugin gradle82 variant Using default execution profile Applying i18n4k plugin... Adding i18n4k generated sources directory to source set 'commonMain Kotlin source' Adding i18n4k generated resources directory to source set 'commonMain resources' Mark i18n4k generated sources directory as 'generated' in IDEA Mark i18n4k generated sources directory as 'generated' in IDEA Caching disabled for Kotlin DSL accessors for project ':shared' because: Build cache is disabled Skipping Kotlin DSL accessors for project ':shared' as it is up-to-date. Caching disabled for Kotlin DSL script compilation (Project/TopLevel/stage2) because: Build cache is disabled Skipping Kotlin DSL script compilation (Project/TopLevel/stage2) as it is up-to-date. Kotlin/Native distribution: /Users/whoami/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.22 Kotlin/Native distribution: /Users/whoami/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.22 Kotlin/Native distribution: /Users/whoami/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.22 All projects evaluated. The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :shared:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :shared:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :shared:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :shared:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :shared:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :shared:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :shared:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :shared:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :shared:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :shared:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. Task name matched 'publishAndroidReleasePublicationToLocalTestRepoRepository' Selected primary task 'publishAndroidReleasePublicationToLocalTestRepoRepository' from project : The configuration :shared:detachedConfiguration1 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :shared:detachedConfiguration1 is both consumable and declarable. This combination is incorrect, only one of these flags should be set. Tasks to be executed: [task ':shared:androidReleaseSourcesJar', task ':shared:preBuild', task ':shared:preReleaseBuild', task ':shared:mergeReleaseJniLibFolders', task ':shared:mergeReleaseNativeLibs', task ':shared:stripReleaseDebugSymbols', task ':shared:copyReleaseJniLibsProjectAndLocalJars', task ':shared:generateReleaseResValues', task ':shared:extractDeepLinksForAarRelease', task ':shared:checkKotlinGradlePluginConfigurationErrors', task ':shared:generateI18n4kFiles', task ':shared:generateReleaseResources', task ':shared:packageReleaseResources', task ':shared:parseReleaseLocalResources', task ':shared:processReleaseManifest', task ':shared:generateReleaseRFile', task ':shared:compileReleaseKotlinAndroid', task ':shared:extractReleaseAnnotations', task ':shared:javaPreCompileRelease', task ':shared:compileReleaseJavaWithJavac', task ':shared:mergeReleaseGeneratedProguardFiles', task ':shared:mergeReleaseConsumerProguardFiles', task ':shared:mergeReleaseShaders', task ':shared:compileReleaseShaders', task ':shared:generateReleaseAssets', task ':shared:packageReleaseAssets', task ':shared:prepareLintJarForPublish', task ':shared:prepareReleaseArtProfile', task ':shared:processReleaseJavaRes', task ':shared:mergeReleaseJavaResource', task ':shared:syncReleaseLibJars', task ':shared:writeReleaseAarMetadata', task ':shared:bundleReleaseAar', task ':shared:generateMetadataFileForAndroidReleasePublication', task ':shared:generatePomFileForAndroidReleasePublication', task ':shared:publishAndroidReleasePublicationToLocalTestRepoRepository'] Tasks that were excluded: [] Resolve mutations for :shared:androidReleaseSourcesJar (Thread[Execution worker,5,main]) started. :shared:androidReleaseSourcesJar (Thread[Execution worker,5,main]) started. Invalidating in-memory cache of /Users/whoami/Documents/workspace/repo/.gradle/8.2.1/executionHistory/executionHistory.bin > Task :shared:androidReleaseSourcesJar UP-TO-DATE Caching disabled for task ':shared:androidReleaseSourcesJar' because: Build cache is disabled Skipping task ':shared:androidReleaseSourcesJar' as it is up-to-date. Resolve mutations for :shared:preBuild (Thread[Execution worker,5,main]) started. :shared:preBuild (Thread[Execution worker,5,main]) started. > Task :shared:preBuild UP-TO-DATE Skipping task ':shared:preBuild' as it has no actions. Resolve mutations for :shared:preReleaseBuild (Thread[Execution worker,5,main]) started. :shared:preReleaseBuild (Thread[Execution worker,5,main]) started. > Task :shared:preReleaseBuild UP-TO-DATE Skipping task ':shared:preReleaseBuild' as it has no actions. Resolve mutations for :shared:mergeReleaseJniLibFolders (Thread[Execution worker,5,main]) started. :shared:mergeReleaseJniLibFolders (Thread[Execution worker,5,main]) started. > Task :shared:mergeReleaseJniLibFolders UP-TO-DATE Caching disabled for task ':shared:mergeReleaseJniLibFolders' because: Build cache is disabled Skipping task ':shared:mergeReleaseJniLibFolders' as it is up-to-date. Resolve mutations for :shared:mergeReleaseNativeLibs (Thread[Execution worker,5,main]) started. :shared:mergeReleaseNativeLibs (Thread[Execution worker,5,main]) started. > Task :shared:mergeReleaseNativeLibs NO-SOURCE Skipping task ':shared:mergeReleaseNativeLibs' as it has no source files and no previous output files. Resolve mutations for :shared:stripReleaseDebugSymbols (Thread[Execution worker,5,main]) started. :shared:stripReleaseDebugSymbols (Thread[Execution worker,5,main]) started. > Task :shared:stripReleaseDebugSymbols NO-SOURCE Skipping task ':shared:stripReleaseDebugSymbols' as it has no source files and no previous output files. Resolve mutations for :shared:copyReleaseJniLibsProjectAndLocalJars (Thread[Execution worker,5,main]) started. :shared:copyReleaseJniLibsProjectAndLocalJars (Thread[Execution worker,5,main]) started. > Task :shared:copyReleaseJniLibsProjectAndLocalJars UP-TO-DATE Caching disabled for task ':shared:copyReleaseJniLibsProjectAndLocalJars' because: Build cache is disabled Skipping task ':shared:copyReleaseJniLibsProjectAndLocalJars' as it is up-to-date. Resolve mutations for :shared:generateReleaseResValues (Thread[Execution worker,5,main]) started. :shared:generateReleaseResValues (Thread[Execution worker,5,main]) started. > Task :shared:generateReleaseResValues UP-TO-DATE Caching disabled for task ':shared:generateReleaseResValues' because: Build cache is disabled Skipping task ':shared:generateReleaseResValues' as it is up-to-date. Resolve mutations for :shared:extractDeepLinksForAarRelease (Thread[Execution worker,5,main]) started. :shared:extractDeepLinksForAarRelease (Thread[Execution worker,5,main]) started. > Task :shared:extractDeepLinksForAarRelease UP-TO-DATE Caching disabled for task ':shared:extractDeepLinksForAarRelease' because: Build cache is disabled Skipping task ':shared:extractDeepLinksForAarRelease' as it is up-to-date. Resolve mutations for :shared:checkKotlinGradlePluginConfigurationErrors (Thread[Execution worker,5,main]) started. :shared:checkKotlinGradlePluginConfigurationErrors (Thread[included builds,5,main]) started. > Task :shared:checkKotlinGradlePluginConfigurationErrors Caching disabled for task ':shared:checkKotlinGradlePluginConfigurationErrors' because: Build cache is disabled Task ':shared:checkKotlinGradlePluginConfigurationErrors' is not up-to-date because: Task has not declared any outputs despite executing actions. Resolve mutations for :shared:generateI18n4kFiles (Thread[included builds,5,main]) started. :shared:generateI18n4kFiles (Thread[included builds,5,main]) started. > Task :shared:generateI18n4kFiles FAILED FAILURE: Build failed with an exception. * What went wrong: A problem was found with the configuration of task ':shared:generateI18n4kFiles' (type 'GenerateI18n4kFilesTask'). - Gradle detected a problem with the following location: '/Users/whoami/Documents/workspace/repo/shared/build/generated/sources/i18n4k'. Reason: Task ':shared:androidReleaseSourcesJar' uses this output of task ':shared:generateI18n4kFiles' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Possible solutions: 1. Declare task ':shared:generateI18n4kFiles' as an input of ':shared:androidReleaseSourcesJar'. 2. Declare an explicit dependency on ':shared:generateI18n4kFiles' from ':shared:androidReleaseSourcesJar' using Task#dependsOn. 3. Declare an explicit dependency on ':shared:generateI18n4kFiles' from ':shared:androidReleaseSourcesJar' using Task#mustRunAfter. For more information, please refer to https://docs.gradle.org/8.2.1/userguide/validation_problems.html#implicit_dependency in the Gradle documentation. * Try: > Run with --stacktrace option to get the stack trace. > Run with --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.2.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD FAILED in 544ms 7 actionable tasks: 2 executed, 5 up-to-date
comahe-de commented 9 months ago

Which version do you use?

nuke-dash commented 9 months ago

0.7.0 I should have included that.🤦

nuke-dash commented 9 months ago

I coulnd't figure out how to do option two, dependsOn. And my google-fu was also failing me.

But Github CoPilot provided me the fix.

tasks {
    val generateI18n4kFiles by getting
    val androidReleaseSourcesJar by creating(Jar::class) {
        dependsOn(generateI18n4kFiles)
        // rest of your task configuration
    }
}

With this the error message is gone.

comahe-de commented 9 months ago

OK, I will integrate this into the next release.

comahe-de commented 8 months ago

Fixed in release 0.7.1. Should be available in some hours.

Could you check if it is now working without the workaround?