From 806c3346afd61ace76ef501e2aa6a7526b0a7bd8 Mon Sep 17 00:00:00 2001 From: Maciej Kwidzinski Date: Wed, 12 Jun 2024 18:10:13 +0200 Subject: [PATCH] Repro the problem found in `docker-infrastructure` After bumping to gradle-release:0.8.0, docker-infrastructure [fails publishing]. The `PublishTest` cannot reproduce it with `withPluginClasspath`, it hides the problem. But then, the test project has to specify `gradle-release` version (0.9.0 here), or otherwise it cannot resolve the unnamed version we're currently testing/building. So this test can repro, but cannot be used to confirm fixes. The failure in CI and in `PublishTest` looks like this: ``` * What went wrong: org/jetbrains/kotlin/gradle/dsl/KotlinSingleTargetExtension > org.jetbrains.kotlin.gradle.dsl.KotlinSingleTargetExtension ``` PS. When minimizing the repro in `Fixtures`, I accidentally discovered that the order of Gradle plugins matters. The problem goes away when `gradle-release` goes first. The buildscript/plugin classpath is a fascinating mess. [fails publishing]: https://github.com/atlassian/docker-infrastructure/actions/runs/9481104563/job/26126902514 --- build.gradle.kts | 2 -- .../com/atlassian/performance/tools/license/Fixtures.kt | 5 +---- .../com/atlassian/performance/tools/license/PublishTest.kt | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index a7664fe..25324c8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,3 @@ -import org.gradle.api.tasks.testing.logging.TestExceptionFormat - plugins { `java-gradle-plugin` `kotlin-dsl` diff --git a/src/test/kotlin/com/atlassian/performance/tools/license/Fixtures.kt b/src/test/kotlin/com/atlassian/performance/tools/license/Fixtures.kt index aa79a32..dc9145d 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/license/Fixtures.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/license/Fixtures.kt @@ -1,9 +1,6 @@ package com.atlassian.performance.tools.license -import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM -import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode.TRACK import org.eclipse.jgit.api.Git -import org.eclipse.jgit.lib.ConfigConstants import org.eclipse.jgit.lib.ConfigConstants.CONFIG_BRANCH_SECTION import org.eclipse.jgit.transport.URIish import org.junit.rules.TemporaryFolder @@ -37,8 +34,8 @@ class Fixtures { buildFolder.newFile("build.gradle").writeText( """ plugins { - id 'com.atlassian.performance.tools.gradle-release' id "org.jetbrains.kotlin.jvm" version "1.3.20" + id 'com.atlassian.performance.tools.gradle-release' version "0.9.0" } dependencies { compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: '1.3.20' diff --git a/src/test/kotlin/com/atlassian/performance/tools/license/PublishTest.kt b/src/test/kotlin/com/atlassian/performance/tools/license/PublishTest.kt index c6cbbef..5d58cc0 100644 --- a/src/test/kotlin/com/atlassian/performance/tools/license/PublishTest.kt +++ b/src/test/kotlin/com/atlassian/performance/tools/license/PublishTest.kt @@ -28,7 +28,6 @@ class PublishTest { val publishResult = GradleRunner.create() .withProjectDir(project.root) .withArguments("publishToMavenLocal", "--stacktrace") - .withPluginClasspath() .forwardOutput() .withDebug(true) .build()