Skip to content

Commit

Permalink
SONARKT-375 - Prepare for release (#389)
Browse files Browse the repository at this point in the history
* SONARKT-375 - Update dependencies, rules metadata, Detekt, AndroidLint and KtLint.

* Raise available memory for build to 12G

This should be a temporary measure, it seems that the updated Gradle
scanner has issues with memory usage/management.

---------

Co-authored-by: Johann Beleites <sdefend_9jftz8pq@esnail.de>
  • Loading branch information
ADarko22 and johann-beleites-sonarsource committed Nov 29, 2023
1 parent 95556b3 commit 4c9a17c
Show file tree
Hide file tree
Showing 54 changed files with 1,588 additions and 410 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ linux_3_5_cpu_7G_template: &LINUX_3_5_CPU_7G
eks_container:
<<: *LINUX_IMAGE
cpu: 3.5
memory: 7G
memory: 12G # TODO: decrease back to 7G when we fix the memory issues with the Gradle scanner

linux_6_cpu_12G_java_17_template: &LINUX_6_CPU_12G_JAVA_17
eks_container:
Expand Down
13 changes: 6 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.sonarsource.kotlin.buildsrc.tasks.CreateKotlinRuleStubsTask
import org.sonarsource.kotlin.buildsrc.tasks.CreateKotlinGradleRuleStubsTask
import org.sonarsource.kotlin.buildsrc.tasks.CreateKotlinRuleStubsTask
import org.sonarsource.kotlin.buildsrc.tasks.FetchRuleMetadata

plugins {
java
id("jacoco")
id("com.jfrog.artifactory") version "4.25.1"
id("io.spring.dependency-management") version "1.0.11.RELEASE" apply false
id("org.sonarqube") version "3.3"
id("io.spring.dependency-management") version "1.1.4" apply false
id("org.sonarqube") version "4.4.1.3373"
id("org.jetbrains.kotlin.jvm") apply false
id("com.diffplug.spotless") version "6.11.0"
`maven-publish`
Expand All @@ -18,7 +17,7 @@ plugins {

val projectTitle: String by project

configure(subprojects.filter { it.name != "kotlin-checks-test-sources"}) {
configure(subprojects.filter { it.name != "kotlin-checks-test-sources" }) {
apply(plugin = "com.diffplug.spotless")

configure<com.diffplug.gradle.spotless.SpotlessExtension> {
Expand Down Expand Up @@ -168,13 +167,13 @@ subprojects {

val sourcesJar by tasks.creating(Jar::class) {
dependsOn(JavaPlugin.CLASSES_TASK_NAME)
classifier = "sources"
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}

val javadocJar by tasks.creating(Jar::class) {
dependsOn(javadoc)
classifier = "javadoc"
archiveClassifier.set("javadoc")
from(tasks["javadoc"])
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ group=org.sonarsource.kotlin
version=2.19-SNAPSHOT
description=Code Analyzer for Kotlin
projectTitle=Kotlin
kotlinVersion=1.9.0
kotlinVersion=1.9.21
org.gradle.jvmargs=-Xmx4096M
2 changes: 1 addition & 1 deletion its/plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies {
testImplementation(testLibs.sonarlint.core)
testImplementation(testLibs.sonar.orchestrator)
testImplementation(testLibs.sonar.orchestrator.junit4)
testImplementation(testLibs.assertj.core)
testImplementation(testLibs.sonar.ws)
testImplementation(libs.sonar.analyzer.commons)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
package org.sonarsource.slang;

import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.OrchestratorBuilder;
import com.sonar.orchestrator.junit4.OrchestratorRule;
import com.sonar.orchestrator.junit4.OrchestratorRuleBuilder;
import com.sonar.orchestrator.locator.Locators;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -61,9 +61,9 @@ public class SonarLintTest {
@BeforeClass
public static void prepare() throws Exception {
// Orchestrator is used only to retrieve plugin artifacts from filesystem or maven
OrchestratorBuilder orchestratorBuilder = Orchestrator.builderEnv();
OrchestratorRuleBuilder orchestratorBuilder = OrchestratorRule.builderEnv();
Tests.addLanguagePlugins(orchestratorBuilder);
Orchestrator orchestrator = orchestratorBuilder
OrchestratorRule orchestrator = orchestratorBuilder
.useDefaultAdminCredentialsForBuilds(true)
.setSonarVersion(System.getProperty(Tests.SQ_VERSION_PROPERTY, Tests.DEFAULT_SQ_VERSION))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
package org.sonarsource.slang;

import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.MavenBuild;
import com.sonar.orchestrator.junit4.OrchestratorRule;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand All @@ -36,7 +36,7 @@
public class SurefireTest extends TestBase {

@ClassRule
public static final Orchestrator ORCHESTRATOR = Tests.ORCHESTRATOR;
public static final OrchestratorRule ORCHESTRATOR = Tests.ORCHESTRATOR;
private static final Path BASE_DIRECTORY = Paths.get("projects");


Expand Down
4 changes: 2 additions & 2 deletions its/plugin/src/test/java/org/sonarsource/slang/TestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
package org.sonarsource.slang;

import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.SonarScanner;
import com.sonar.orchestrator.junit4.OrchestratorRule;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -44,7 +44,7 @@
public abstract class TestBase {

@ClassRule
public static final Orchestrator ORCHESTRATOR = Tests.ORCHESTRATOR;
public static final OrchestratorRule ORCHESTRATOR = Tests.ORCHESTRATOR;

protected SonarScanner getSonarScanner(String projectKey, String directoryToScan, String languageKey) {
return getSonarScanner(projectKey, directoryToScan, languageKey, null);
Expand Down
7 changes: 4 additions & 3 deletions its/plugin/src/test/java/org/sonarsource/slang/Tests.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
*/
package org.sonarsource.slang;

import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.OrchestratorBuilder;
import com.sonar.orchestrator.junit4.OrchestratorRule;
import com.sonar.orchestrator.junit4.OrchestratorRuleBuilder;
import com.sonar.orchestrator.locator.FileLocation;
import com.sonar.orchestrator.locator.Location;
import com.sonar.orchestrator.locator.MavenLocation;
Expand Down Expand Up @@ -48,10 +49,10 @@ public class Tests {
private static final Set<String> LANGUAGES = new HashSet<>(Collections.singletonList("kotlin"));

@ClassRule
public static final Orchestrator ORCHESTRATOR;
public static final OrchestratorRule ORCHESTRATOR;

static {
OrchestratorBuilder orchestratorBuilder = Orchestrator.builderEnv();
OrchestratorRuleBuilder orchestratorBuilder = OrchestratorRule.builderEnv();
addLanguagePlugins(orchestratorBuilder);
ORCHESTRATOR = orchestratorBuilder
.useDefaultAdminCredentialsForBuilds(true)
Expand Down
2 changes: 1 addition & 1 deletion its/ruling/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

dependencies {
testImplementation(testLibs.sonar.orchestrator)
testImplementation(testLibs.sonar.orchestrator.junit4)
testImplementation(testLibs.assertj.core)
testImplementation(libs.sonar.analyzer.commons)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
*/
package org.sonarsource.slang;

import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.OrchestratorBuilder;
import com.sonar.orchestrator.build.Build;
import com.sonar.orchestrator.build.GradleBuild;
import com.sonar.orchestrator.build.SonarScanner;
import com.sonar.orchestrator.junit4.OrchestratorRule;
import com.sonar.orchestrator.junit4.OrchestratorRuleBuilder;
import com.sonar.orchestrator.locator.FileLocation;
import com.sonar.orchestrator.locator.Location;
import com.sonar.orchestrator.locator.MavenLocation;
Expand Down Expand Up @@ -56,15 +57,15 @@ public class SlangRulingTest {
private static final String SQ_VERSION_PROPERTY = "sonar.runtimeVersion";
private static final String DEFAULT_SQ_VERSION = "LATEST_RELEASE";

private static Orchestrator orchestrator;
private static OrchestratorRule orchestrator;
private static boolean keepSonarqubeRunning = "true".equals(System.getProperty("keepSonarqubeRunning"));
private static final boolean IGNORE_EXPECTED_ISSUES_AND_REPORT_ALL = "true".equals(System.getProperty("reportAll"));
private static final boolean CLEAN_PROJECT_BINARIES = "true".equals(System.getProperty("cleanProjects"));
private static final Set<String> LANGUAGES = new HashSet<>(Collections.singletonList("kotlin"));

@BeforeClass
public static void setUp() {
OrchestratorBuilder builder = Orchestrator.builderEnv()
OrchestratorRuleBuilder builder = OrchestratorRule.builderEnv()
.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"));
Expand Down
49 changes: 26 additions & 23 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,55 +36,56 @@ dependencyResolutionManagement {
versionCatalogs {

val kotlinVersion: String by extra
val analyzerCommonsVersionStr = "2.7.0.1482"
val sonarPluginApi = "10.1.0.809"
val analyzerCommonsVersionStr = "2.8.0.2593"
val sonarPluginApi = "10.4.0.1999"
val slf4jApi = "1.7.30"

create("libs") {
val analyzerCommons = version("analyzerCommons", analyzerCommonsVersionStr)
val gson = version("gson", "2.9.0")
val staxmate = version("staxmate", "2.4.0")
val gson = version("gson", "2.10.1")
val staxmate = version("staxmate", "2.4.1")
val gradleToolingApi = version("gradle-tooling-api", "7.5.1")

library("gson", "com.google.code.gson", "gson").versionRef(gson)
library("kotlin-compiler-embeddable", "org.jetbrains.kotlin", "kotlin-compiler-embeddable").version(kotlinVersion)
library("sonar-analyzer-commons", "org.sonarsource.analyzer-commons", "sonar-analyzer-commons").versionRef(analyzerCommons)
library("sonar-analyzer-commons-recognizers", "org.sonarsource.analyzer-commons", "sonar-analyzer-recognizers").versionRef(analyzerCommons)
library("sonar-performance-measure", "org.sonarsource.analyzer-commons", "sonar-performance-measure").versionRef(analyzerCommons)
library("sonar-analyzer-commons-recognizers", "org.sonarsource.analyzer-commons", "sonar-analyzer-recognizers")
.versionRef(analyzerCommons)
library("sonar-performance-measure", "org.sonarsource.analyzer-commons", "sonar-performance-measure")
.versionRef(analyzerCommons)
library("sonar-plugin-api", "org.sonarsource.api.plugin", "sonar-plugin-api").version(sonarPluginApi)
library("slf4j-api", "org.slf4j", "slf4j-api").version(slf4jApi)
library("sonar-regex-parsing", "org.sonarsource.analyzer-commons", "sonar-regex-parsing").versionRef(analyzerCommons)
library("sonar-xml-parsing", "org.sonarsource.analyzer-commons", "sonar-xml-parsing").versionRef(analyzerCommons)
library("staxmate", "com.fasterxml.staxmate", "staxmate").versionRef(staxmate)
library("gradle-tooling-api","org.gradle", "gradle-tooling-api").versionRef(gradleToolingApi)
library("gradle-tooling-api", "org.gradle", "gradle-tooling-api").versionRef(gradleToolingApi)
}

create("utilLibs") {
val detekt = version("detekt", "1.23.0")
val jcommander = version("jcommander", "1.81")
val ktlint = version("ktlint", "0.49.1")
val detekt = version("detekt", "1.23.3")
val jcommander = version("jcommander", "1.82")
val ktlint = version("ktlint", "1.0.1")

library("detekt-api", "io.gitlab.arturbosch.detekt", "detekt-api").versionRef(detekt)
library("detekt-cli", "io.gitlab.arturbosch.detekt", "detekt-cli").versionRef(detekt)
library("detekt-core", "io.gitlab.arturbosch.detekt", "detekt-core").versionRef(detekt)
library("jcommander", "com.beust", "jcommander").versionRef(jcommander)
library("ktlint", "com.pinterest", "ktlint").versionRef(ktlint)
library("ktlint-core", "com.pinterest.ktlint", "ktlint-core").versionRef(ktlint)
library("ktlint-core", "com.pinterest.ktlint", "ktlint-rule-engine-core").versionRef(ktlint)
library("ktlint-ruleset-standard", "com.pinterest.ktlint", "ktlint-ruleset-standard").versionRef(ktlint)

bundle("detekt", listOf("detekt-cli", "detekt-core", "detekt-api"))
bundle("ktlint", listOf("ktlint", "ktlint-core", "ktlint-ruleset-standard"))
bundle("ktlint", listOf("ktlint-core", "ktlint-ruleset-standard"))
}

create("testLibs") {
val analyzerCommons = version("analyzerCommons", analyzerCommonsVersionStr)
val assertj = version("assertj", "3.23.1")
val classgraph = version("classgraph", "4.8.149")
val junit = version("junit", "5.8.2")
val mockito = version("mockito", "4.6.1")
val mockk = version("mockk", "1.12.4")
val orchestrator = version("orchestrator", "3.40.0.183")
val sonarlint = version("sonarlint", "8.16.0.67686")
val assertj = version("assertj", "3.24.2")
val classgraph = version("classgraph", "4.8.165")
val junit = version("junit", "5.10.1")
val mockito = version("mockito", "5.7.0")
val mockk = version("mockk", "1.13.3")
val orchestrator = version("orchestrator", "4.5.0.1682")
val sonarlint = version("sonarlint", "9.5.0.76302")
val sonarqube = version("sonarqube", "10.0.0.68432")

library("assertj-core", "org.assertj", "assertj-core").versionRef(assertj)
Expand All @@ -94,10 +95,12 @@ dependencyResolutionManagement {
library("junit-params", "org.junit.jupiter", "junit-jupiter-params").versionRef(junit)
library("mockito-core", "org.mockito", "mockito-core").versionRef(mockito)
library("mockk", "io.mockk", "mockk").versionRef(mockk)
library("sonar-analyzer-test-commons", "org.sonarsource.analyzer-commons", "sonar-analyzer-test-commons").versionRef(analyzerCommons)
library("sonar-orchestrator", "org.sonarsource.orchestrator", "sonar-orchestrator").versionRef(orchestrator)
library("sonar-analyzer-test-commons", "org.sonarsource.analyzer-commons", "sonar-analyzer-test-commons")
.versionRef(analyzerCommons)
library("sonar-orchestrator-junit4", "org.sonarsource.orchestrator", "sonar-orchestrator-junit4").versionRef(orchestrator)
library("sonar-plugin-api-impl", "org.sonarsource.sonarqube", "sonar-plugin-api-impl").versionRef(sonarqube)
library("sonar-plugin-api-test-fixtures", "org.sonarsource.api.plugin", "sonar-plugin-api-test-fixtures").version(sonarPluginApi)
library("sonar-plugin-api-test-fixtures", "org.sonarsource.api.plugin", "sonar-plugin-api-test-fixtures")
.version(sonarPluginApi)
library("sonar-ws", "org.sonarsource.sonarqube", "sonar-ws").versionRef(sonarqube)
library("sonarlint-core", "org.sonarsource.sonarlint.core", "sonarlint-core").versionRef(sonarlint)
}
Expand Down

0 comments on commit 4c9a17c

Please sign in to comment.