Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SONARGO-52 Create a new repository for common Gradle scripts #38

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
SONAR_HOST_URL: VAULT[development/kv/data/next data.url]
DEPLOY_PULL_REQUEST: "true"
build_script:
- git submodule update --init --depth 1 -- build-logic
- source cirrus-env BUILD
- function gradle(){ ./gradlew "$@"; }; export -f gradle
- gradle --version
Expand Down Expand Up @@ -101,7 +102,7 @@
-Pqa --info --stacktrace --console plain --no-daemon --build-cache
<<: *CLEANUP_GRADLE_CACHE_SCRIPT

qa_plugin_task:

Check warning on line 105 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L105

task "qa_plugin" depends on task "build", but their only_if conditions are different

Check warning on line 105 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L105

task "qa_plugin" depends on task "build", but their only_if conditions are different
<<: *QA_TASK_FILTER
env:
ITS_PROJECT: "plugin"
Expand All @@ -112,7 +113,7 @@
<<: *LINUX_4_CPU_6G_JAVA_17
<<: *GRADLE_ITS_TEMPLATE

qa_ruling_task:

Check warning on line 116 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L116

task "qa_ruling" depends on task "build", but their only_if conditions are different
<<: *QA_TASK_FILTER
env:
SQ_VERSION: "LATEST_RELEASE"
Expand All @@ -138,6 +139,7 @@
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
whitesource_script:
- git submodule update --init --depth 1 -- build-logic
- source cirrus-env QA
- ./gradlew --no-daemon --console plain clean
- ./gradlew --no-daemon --info --stacktrace --console plain --no-daemon build -x test
Expand All @@ -150,7 +152,7 @@

### Promote tasks

promote_task:

Check warning on line 155 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L155

task "promote" depends on task "build", but their only_if conditions are different
depends_on:
- build
- qa_plugin
Expand All @@ -158,11 +160,12 @@
<<: *ONLY_IF_SONARSOURCE_QA
eks_container:
<<: *CONTAINER_DEFINITION
cpu: 1
memory: 1G
cpu: 2
memory: 2G
env:
ARTIFACTORY_PROMOTE_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token]
GITHUB_TOKEN: VAULT[development/github/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promotion token]
promote_script:
- git submodule update --init --depth 1 -- build-logic
- function gradle(){ ./gradlew "$@"; }; export -f gradle
- cirrus_promote_gradle multi
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "its/sources/kubernetes-client-go"]
path = its/sources/kubernetes-client-go
url = https://github.com/kubernetes/client-go
[submodule "build-logic"]
path = build-logic
url = https://github.com/SonarSource/cloud-native-gradle-modules
1 change: 1 addition & 0 deletions build-logic
Submodule build-logic added at 14a35c
40 changes: 0 additions & 40 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import java.util.jar.JarInputStream

plugins {
id 'java'
id 'jacoco'
id 'com.jfrog.artifactory' version '4.28.2'
id 'org.sonarqube' version '3.5.0.2730'
id 'de.thetaphi.forbiddenapis' version '3.0' apply false
Expand All @@ -11,7 +10,6 @@ plugins {

allprojects {
apply plugin: 'java'
petertrr marked this conversation as resolved.
Show resolved Hide resolved
apply plugin: 'jacoco'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: 'signing'
petertrr marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -66,29 +64,6 @@ subprojects {

apply plugin: 'com.diffplug.spotless'

java.sourceCompatibility = JavaVersion.VERSION_17
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = java.sourceCompatibility.majorVersion as int
}

jacoco {
toolVersion = "0.8.7"
}

jacocoTestReport {
reports {
xml.required = true
csv.required = false
html.required = false
}
}

// when subproject has Jacoco pLugin applied we want to generate XML report for coverage
plugins.withType(JacocoPlugin) {
tasks["test"].finalizedBy 'jacocoTestReport'
}

configurations {
// include compileOnly dependencies during test
testCompile.extendsFrom compileOnly
Expand All @@ -101,11 +76,6 @@ subprojects {
}

test {
testLogging {
exceptionFormat 'full' // log the full stack trace (default is the 1st line of the stack trace)
events "skipped", "failed"
// verbose log for failed and skipped tests (by default the name of the tests are not logged)
}
def propKeys = System.properties.findAll {
it.key.startsWith("orchestrator") || it.key.startsWith("sonar") || it.key == "buildNumber" || it.key == "slangVersion"
}.collect { it.key }
Expand All @@ -115,16 +85,6 @@ subprojects {
}
}

task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}

// license updater
spotless {
java {
Expand Down
5 changes: 5 additions & 0 deletions its/plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
plugins {
id("org.sonarsource.cloud-native.java-conventions")
}

dependencies {
testImplementation libs.sonar.analyzer.commons
testImplementation testLibs.sonar.ws
testImplementation testLibs.assertj.core
testImplementation testLibs.sonarlint.core
testImplementation testLibs.sonar.orchestrator
testRuntimeOnly testLibs.junit.vintage.engine
}

sonarqube.skipProject = true
Expand Down
5 changes: 5 additions & 0 deletions its/ruling/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
plugins {
id("org.sonarsource.cloud-native.java-conventions")
}

dependencies {
testImplementation libs.sonar.analyzer.commons
testImplementation testLibs.assertj.core
testImplementation testLibs.sonar.orchestrator
testRuntimeOnly testLibs.junit.vintage.engine
}

sonarqube.skipProject = true
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pluginManagement {
includeBuild("build-logic")
repositories {
mavenCentral()
gradlePluginPortal()
Expand Down Expand Up @@ -40,6 +41,7 @@ dependencyResolutionManagement {
library("assertj-core", "org.assertj", "assertj-core").version("3.26.3")
library("junit-jupiter-api", "org.junit.jupiter", "junit-jupiter-api").version("5.11.0")
library("junit-jupiter-engine", "org.junit.jupiter", "junit-jupiter-engine").version("5.11.0")
library("junit-vintage-engine", "org.junit.vintage", "junit-vintage-engine").version("5.11.0")
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions sonar-go-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
id("org.sonarsource.cloud-native.java-conventions")
id 'com.github.johnrengelman.shadow' version '7.1.0'
}

Expand Down Expand Up @@ -30,11 +31,6 @@ dependencies {
testRuntimeOnly testLibs.junit.jupiter.engine
}

tasks.withType(JavaCompile) {
// Prevent warning: Gradle 5.0 will ignore annotation processors
options.compilerArgs += [ "-proc:none" ]
}

test {
testLogging {
exceptionFormat 'full' // log the full stack trace (default is the 1st line of the stack trace)
Expand Down
Loading