diff --git a/.cirrus.yml b/.cirrus.yml index 114dab757..993a61d22 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -103,6 +103,9 @@ cleanup_gradle_cache_script_template: &CLEANUP_GRADLE_CACHE_SCRIPT gradle_its_template: &GRADLE_ITS_TEMPLATE <<: *SETUP_GRADLE_CACHE <<: *ORCHESTRATOR_CACHE_DEFINITION + download_build_artifact_script: + - mkdir -p sonar-kotlin-plugin/build/libs + - curl --fail -X GET -o sonar-kotlin-plugin/build/libs/sonar-kotlin-plugin.jar http://${CIRRUS_HTTP_CACHE_HOST}/build/${CIRRUS_BUILD_ID}/sonar-kotlin-plugin.jar run_its_script: - | if [ -n "${GIT_SUB_MODULE}" ]; then @@ -136,6 +139,8 @@ build_task: build_script: - source cirrus-env BUILD-PRIVATE - regular_gradle_build_deploy_analyze -x test -x sonar + upload_build_artifact_script: + - curl -X POST --data-binary @sonar-kotlin-plugin/build/libs/sonar-kotlin-plugin.jar http://${CIRRUS_HTTP_CACHE_HOST}/build/${CIRRUS_BUILD_ID}/sonar-kotlin-plugin.jar on_failure: error_log_artifacts: path: "hs_err_pid*.log" @@ -225,6 +230,9 @@ qa_ruling_kotlin_compiler_task: <<: *LINUX_6_CPU_12G_JAVA_17 <<: *SETUP_GRADLE_CACHE <<: *ORCHESTRATOR_CACHE_DEFINITION + download_build_artifact_script: + - mkdir -p sonar-kotlin-plugin/build/libs + - curl --fail -X GET -o sonar-kotlin-plugin/build/libs/sonar-kotlin-plugin.jar http://${CIRRUS_HTTP_CACHE_HOST}/build/${CIRRUS_BUILD_ID}/sonar-kotlin-plugin.jar run_its_script: - | if [ -n "${GIT_SUB_MODULE}" ]; then diff --git a/build.gradle.kts b/build.gradle.kts index 657f114bb..993d92380 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -152,12 +152,8 @@ subprojects { systemProperties = System.getProperties().filterKeys { it is String && - (it.startsWith("orchestrator") || it.startsWith("sonar") || it == "buildNumber" || it == "slangVersion") + (it.startsWith("orchestrator") || it.startsWith("sonar") || it == "buildNumber") }.mapKeys { it.key as String } - - if (systemProperties.containsKey("buildNumber") && !systemProperties.containsKey("slangVersion")) { - systemProperties["slangVersion"] = version - } } val sourcesJar by tasks.creating(Jar::class) { diff --git a/its/plugin/src/test/java/org/sonarsource/slang/TestsHelper.java b/its/plugin/src/test/java/org/sonarsource/slang/TestsHelper.java index cadf57907..74633c676 100644 --- a/its/plugin/src/test/java/org/sonarsource/slang/TestsHelper.java +++ b/its/plugin/src/test/java/org/sonarsource/slang/TestsHelper.java @@ -21,22 +21,12 @@ import com.sonar.orchestrator.junit5.OrchestratorExtension; import com.sonar.orchestrator.junit5.OrchestratorExtensionBuilder; import com.sonar.orchestrator.locator.FileLocation; -import com.sonar.orchestrator.locator.Location; -import com.sonar.orchestrator.locator.MavenLocation; - -import java.io.File; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - public class TestsHelper { static final String SQ_VERSION_PROPERTY = "sonar.runtimeVersion"; static final String DEFAULT_SQ_VERSION = "LATEST_RELEASE"; - private static final Set LANGUAGES = new HashSet<>(Collections.singletonList("kotlin")); - public static final OrchestratorExtension ORCHESTRATOR; static { @@ -52,21 +42,7 @@ public class TestsHelper { } static void addLanguagePlugins(OrchestratorBuilder builder) { - String slangVersion = System.getProperty("slangVersion"); - - LANGUAGES.forEach(language -> { - Location pluginLocation; - String plugin = "sonar-" + language +"-plugin"; - if (slangVersion == null || slangVersion.isEmpty()) { - // use the plugin that was built on local machine - pluginLocation = FileLocation.byWildcardMavenFilename(new File("../../" + plugin + "/build/libs"), plugin + ".jar"); - } else { - // QA environment downloads the plugin built by the CI job - pluginLocation = MavenLocation.of("org.sonarsource.kotlin", plugin, slangVersion); - } - - builder.addPlugin(pluginLocation); - }); + builder.addPlugin(FileLocation.of("../../sonar-kotlin-plugin/build/libs/sonar-kotlin-plugin.jar")); } } diff --git a/its/ruling/src/test/java/org/sonarsource/slang/SlangRulingTest.java b/its/ruling/src/test/java/org/sonarsource/slang/SlangRulingTest.java index 1d825b286..7d6ef9cac 100644 --- a/its/ruling/src/test/java/org/sonarsource/slang/SlangRulingTest.java +++ b/its/ruling/src/test/java/org/sonarsource/slang/SlangRulingTest.java @@ -16,7 +16,6 @@ */ package org.sonarsource.slang; -import com.sonar.orchestrator.OrchestratorBuilder; import com.sonar.orchestrator.build.Build; import com.sonar.orchestrator.build.GradleBuild; import com.sonar.orchestrator.build.SonarScanner; @@ -24,7 +23,6 @@ import com.sonar.orchestrator.junit5.OrchestratorExtension; import com.sonar.orchestrator.junit5.OrchestratorExtensionBuilder; import com.sonar.orchestrator.locator.FileLocation; -import com.sonar.orchestrator.locator.Location; import com.sonar.orchestrator.locator.MavenLocation; import java.io.File; import java.io.IOException; @@ -66,10 +64,9 @@ public static void setUp() { .useDefaultAdminCredentialsForBuilds(true) .setSonarVersion(System.getProperty(SQ_VERSION_PROPERTY, DEFAULT_SQ_VERSION)) .addPlugin(MavenLocation.of("org.sonarsource.sonar-lits-plugin", "sonar-lits-plugin", "0.11.0.2659")) + .addPlugin(FileLocation.of("../../sonar-kotlin-plugin/build/libs/sonar-kotlin-plugin.jar")) .setServerProperty("sonar.telemetry.enable", "false"); - addLanguagePlugins(builder); - orchestrator = builder.build(); orchestrator.start(); @@ -82,24 +79,6 @@ public static void setUp() { orchestrator.getServer().restoreProfile(FileLocation.of(kotlinProfile)); } - private static void addLanguagePlugins(OrchestratorBuilder builder) { - String slangVersion = System.getProperty("slangVersion"); - - LANGUAGES.forEach(language -> { - Location pluginLocation; - String plugin = "sonar-" + language +"-plugin"; - if (slangVersion == null || slangVersion.isEmpty()) { - // use the plugin that was built on local machine - pluginLocation = FileLocation.byWildcardMavenFilename(new File("../../" + plugin + "/build/libs"), plugin + ".jar"); - } else { - // QA environment downloads the plugin built by the CI job - pluginLocation = MavenLocation.of("org.sonarsource.kotlin", plugin, slangVersion); - } - - builder.addPlugin(pluginLocation); - }); - } - @Test @EnabledIfEnvironmentVariable(named = "KOTLIN_COMPILER_IT_ENABLED", matches = "true") void test_kotlin_compiler() throws IOException {