From b2993a02613bdafa4589dd7951d384dc722f6117 Mon Sep 17 00:00:00 2001 From: Yongshun Shreck Ye Date: Tue, 26 Nov 2024 12:38:33 +0800 Subject: [PATCH] Try resolving an error that occurs when syncing the project in IntelliJ IDEA without success, by removing the module-wide opt-in and bumping the Gradle wrapper The Gradle error message when syncing in IntelliJ IDEA: ```text Execution failed for task ':kotlin-common-gradle-plugins:configurePrecompiledScriptDependenciesResolver'. > The value for property 'freeCompilerArgs' is final and cannot be changed any further. ``` This error doesn't occur when I run `publishToMavenLocal` or `check` from the command line. The commands work in the command line. See https://github.com/gradle/gradle/issues/22091 which could be related. --- buildSrc/build.gradle.kts | 4 ++-- .../main/kotlin/aligned-version-plugin-conventions.gradle.kts | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../src/main/kotlin/com/huanshankeji/Internal.kt | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index db36dd1..fa7fdc3 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -26,8 +26,8 @@ dependencies { */ // for `KotlinCompilationTask` and the version is compatible with Compose 1.6.11 // With Kotlin 2.0.20, a "Could not parse POM" build error occurs in the JVM projects of some dependent projects. - implementation(kotlin("gradle-plugin", "2.0.10")) - implementation("org.gradle.kotlin:gradle-kotlin-dsl-plugins:4.5.0") // This version has to be used for Gradle 8.10. + implementation(kotlin("gradle-plugin", "2.0.20")) + implementation("org.gradle.kotlin:gradle-kotlin-dsl-plugins:5.1.1") // This version has to be used for Gradle 8.11.2. implementation("com.gradle.publish:plugin-publish-plugin:1.3.0") diff --git a/buildSrc/src/main/kotlin/aligned-version-plugin-conventions.gradle.kts b/buildSrc/src/main/kotlin/aligned-version-plugin-conventions.gradle.kts index 174453d..b595e10 100644 --- a/buildSrc/src/main/kotlin/aligned-version-plugin-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/aligned-version-plugin-conventions.gradle.kts @@ -1,5 +1,3 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - plugins { id("conventions") id("aligned-version-plugin-version") @@ -10,6 +8,8 @@ dependencies { implementation("com.huanshankeji:common-gradle-dependencies:$pluginProjectSourceDependentStableCommonGradleDependenciesVersion") } +/* tasks.named>("compileKotlin").configure { compilerOptions.freeCompilerArgs.add("-opt-in=com.huanshankeji.InternalApi") } +*/ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 79eb9d0..c1d5e01 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/kotlin-common-gradle-plugins/src/main/kotlin/com/huanshankeji/Internal.kt b/kotlin-common-gradle-plugins/src/main/kotlin/com/huanshankeji/Internal.kt index cd5f39e..3bdc043 100644 --- a/kotlin-common-gradle-plugins/src/main/kotlin/com/huanshankeji/Internal.kt +++ b/kotlin-common-gradle-plugins/src/main/kotlin/com/huanshankeji/Internal.kt @@ -1,6 +1,5 @@ package com.huanshankeji -@RequiresOptIn +@RequiresOptIn("This API is internal in this project.", RequiresOptIn.Level.WARNING) // TODO consider removing `WARNING` @Retention(AnnotationRetention.BINARY) -@Target(AnnotationTarget.PROPERTY) annotation class InternalApi \ No newline at end of file