https://kotlinlang.org logo
Title
p

Piotr Krzemiński

04/13/2023, 8:09 AM
I’m struggling to understand what’s wrong when I bump Gradle in my project to 8.1. See the build log:
* What went wrong:
Could not determine the dependencies of null.
> Could not resolve all dependencies for configuration ':buildSrc:buildScriptClasspath'.
   > Could not create task ':buildSrc:compileKotlin'.
      > Failed to query the value of property 'freeCompilerArgs'.
         > Querying the mapped value of map(flatmap(provider(task 'generatePrecompiledScriptPluginAccessors', class org.gradle.kotlin.dsl.provider.plugins.precompiled.tasks.GeneratePrecompiledScriptPluginAccessors))) before task ':buildSrc:generatePrecompiledScriptPluginAccessors' has completed is not supported
I presume it’s regarding one of these usages of
freeCompilerArgs
, but I don’t understand the error message. Anyone has a clue why it becomes a problem starting from 8.1?
a

Adam S

04/13/2023, 8:28 AM
try this instead
tasks.withType<KotlinCompile>().configureEach {
    compilerOptions {
        freeCompilerArgs.addAll(
            "-opt-in=kotlin.time.ExperimentalTime",
        )
    }
}
https://kotlinlang.org/docs/whatsnew18.html#exposing-kotlin-compiler-options-as-gradle-lazy-properties
Compile tasks have the new
compilerOptions
input, which is similar to the existing
kotlinOptions
but uses
Property
from the Gradle Properties API as the return type
ah, I think this might be a consequence of Gradle changing the `kotlin-dsl` plugin options in 8.1. Which I guess now means
freeCompilerArgs
is empty, so
freeCompilerArgs += ...
will fail.
p

Piotr Krzemiński

04/13/2023, 8:47 AM
thanks 🙇 works! In my case I needed to make such adjustments