Hi - I just upgraded from gradle 8.10.2 to 8.11 an...
# gradle
r
Hi - I just upgraded from gradle 8.10.2 to 8.11 and this command is now failing with a compilation error:
./gradlew -Pkotlin.compiler.execution.strategy=in-process -Pkotlin.compiler.runViaBuildToolsApi=true  build --dry-run
This passes:
./gradlew build --dry-run
Anyone know what has changed? Error in thread.
Copy code
> Task :build-logic:compileKotlin FAILED
[KOTLIN] e: file:///Users/robert/dev/slack-github/build-logic/src/main/kotlin/buildlogic.kotlin-common-conventions.gradle.kts:11:1 Unresolved reference: repositories
[KOTLIN] e: file:///Users/robert/dev/slack-github/build-logic/src/main/kotlin/buildlogic.kotlin-common-conventions.gradle.kts:12:3 Unresolved reference: mavenCentral
[KOTLIN] e: file:///Users/robert/dev/slack-github/build-logic/src/main/kotlin/buildlogic.kotlin-common-conventions.gradle.kts:15:1 Expression 'java' cannot be invoked as a function. The function 'invoke()' is not found
[KOTLIN] e: file:///Users/robert/dev/slack-github/build-logic/src/main/kotlin/buildlogic.kotlin-common-conventions.gradle.kts:15:1 Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public val <T> KClass<TypeVariable(T)>.java: Class<TypeVariable(T)> defined in kotlin.jvm
[KOTLIN] e: file:///Users/robert/dev/slack-github/build-logic/src/main/kotlin/buildlogic.kotlin-common-conventions.gradle.kts:16:3 Unresolved reference: sourceCompatibility
[KOTLIN] e: file:///Users/robert/dev/slack-github/build-logic/src/main/kotlin/buildlogic.kotlin-common-conventions.gradle.kts:17:3 Unresolved reference: targetCompatibility
[KOTLIN] e: file:///Users/robert/dev/slack-github/build-logic/src/main/kotlin/buildlogic.kotlin-common-conventions.gradle.kts:20:1 Unresolved reference: tasks
[KOTLIN] e: file:///Users/robert/dev/slack-github/build-logic/src/main/kotlin/buildlogic.kotlin-common-conventions.gradle.kts:21:3 Unresolved reference: compilerOptions
[KOTLIN] e: file:///Users/robert/dev/slack-github/build-logic/src/main/kotlin/buildlogic.kotlin-common-conventions.gradle.kts:21:19 Variable expected
[KOTLIN] e: file:///Users/robert/dev/slack-github/build-logic/src/main/kotlin/buildlogic.kotlin-library-conventions.gradle.kts:3:3 Unresolved reference: `java-library`

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':build-logic:compileKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.btapi.BuildToolsApiCompilationWork
   > Compilation error. See log for more details

* Try:
> Run with --info or --debug option to get more log output.
> Get more help at <https://help.gradle.org>.
It seems that those properties break the compilation of my included build (
build-logic
)
Looks like it's specifically
-Pkotlin.compiler.runViaBuildToolsApi=true
that's the issue. Not sure exactly what that flag does, think I copied it from a recommendation on here...
As this is a failure to compile a kotlin DSL file perhaps this should be on the gradle slack rather than here.
t
сс @Alexander.Likhachev
a
Thanks, I’ve reproduced the issue. Will take a look a bit later and explain it. Anyway, please take into account
kotlin.compiler.runViaBuildToolsApi=true
is an experimental thing and may work incorrectly in some cases
In the meantime, could you also file an issue please? It seems to be issue of KGP (Kotlin Gradle plugin) rather than Gradle