From 0bb51309ea49a21cba9e68b5d1f6607c00bb501a Mon Sep 17 00:00:00 2001 From: Nikita Klimenko Date: Wed, 9 Oct 2024 21:39:58 +0300 Subject: [PATCH] Downgrade Gradle to avoid using API incompatible with older versions --- core/build.gradle.kts | 6 ++++-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt | 2 +- .../org/jetbrains/dataframe/gradle/GradleRunnerDsl.kt | 3 +++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 02d9eb863..9f01d07bf 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -266,8 +266,10 @@ tasks.withType { } // modify all publishing tasks to depend on `changeJarTask` so the sources are swapped out with generated sources -tasks.named { it.startsWith("publish") }.configureEach { - dependsOn(processKDocsMain, changeJarTask) +tasks.configureEach { + if (name.startsWith("publish")) { + dependsOn(processKDocsMain, changeJarTask) + } } // Exclude the generated/processed sources from the IDE diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e1adfb493..e411586a5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt b/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt index b05d5c2a1..2ce111d2a 100644 --- a/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt +++ b/plugins/dataframe-gradle-plugin/src/main/kotlin/org/jetbrains/dataframe/gradle/ConvenienceSchemaGeneratorPlugin.kt @@ -70,7 +70,7 @@ class ConvenienceSchemaGeneratorPlugin : Plugin { val cfgsToAdd = configs.toMutableSet() configs.forEach { cfg -> - target.configurations.named { it == cfg }.configureEach { + target.configurations.findByName(cfg)?.apply { cfgsToAdd.remove(cfg) dependencies.add( target.dependencies.create( diff --git a/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/GradleRunnerDsl.kt b/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/GradleRunnerDsl.kt index a2eaf9a7c..a11ab964f 100644 --- a/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/GradleRunnerDsl.kt +++ b/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/GradleRunnerDsl.kt @@ -22,6 +22,9 @@ fun runGradleBuild( fun gradleRunner(buildDir: File, task: String): GradleRunner = GradleRunner.create() .withProjectDir(buildDir) + // if we use api from the newest Gradle release, a user project will fail with NoSuchMethod + // testing compatibility with an older Gradle version ensures our plugin can run on as many versions as possible + .withGradleVersion("8.5") .withPluginClasspath() .withArguments(task, "--stacktrace", "--info") .withDebug(true)