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-82 Add "artifactory-configuration" to common Gradle modules #44

Merged
merged 5 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 5 additions & 10 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,13 @@
setup_gradle_cache_template: &SETUP_GRADLE_CACHE
gradle_cache:
folder: .gradle/caches
create_gradle_directory_script:
- mkdir -p "${CIRRUS_WORKING_DIR}/.gradle"
reupload_on_changes: "true"
populate_script: mkdir -p "${GRADLE_USER_HOME}"

cleanup_gradle_cache_script_template: &CLEANUP_GRADLE_CACHE_SCRIPT
cleanup_gradle_script:
- /usr/bin/find "${CIRRUS_WORKING_DIR}/.gradle/caches/" -name "*.lock" -type f -delete
- rm -rf "${CIRRUS_WORKING_DIR}/.gradle/caches/4.10.2/"
- rm -rf "${CIRRUS_WORKING_DIR}/.gradle/caches/journal-1/"
- rm -rf "${CIRRUS_WORKING_DIR}/.gradle/caches/build-cache-1/"
- rm -rf "${GRADLE_USER_HOME}/caches/journal-1/"
- find ${GRADLE_USER_HOME}/caches/ -name "*.lock" -type f -delete || true

build_task:
<<: *LINUX_4_CPU_6G
Expand All @@ -90,9 +88,7 @@
build_script:
- git submodule update --init --depth 1 -- build-logic
- source cirrus-env BUILD
- function gradle(){ ./gradlew "$@"; }; export -f gradle
- gradle --version
- source set_gradle_build_version
- source .cirrus/use-gradle-wrapper.sh
- regular_gradle_build_deploy_analyze
<<: *ON_FAILURE
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
Expand All @@ -116,11 +112,10 @@
"-Dsonar.runtimeVersion=${SQ_VERSION}"
"-Dorchestrator.artifactory.accessToken=${ARTIFACTORY_ACCESS_TOKEN}"
"-DbuildNumber=$BUILD_NUMBER"
-I "${GRADLE_HOME}/init.d/repoxAuth.init.gradle.kts"
--info --stacktrace --console plain --no-daemon --build-cache
<<: *CLEANUP_GRADLE_CACHE_SCRIPT

qa_plugin_task:

Check warning on line 118 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L118

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

Check warning on line 118 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L118

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

Check warning on line 118 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L118

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

Check warning on line 118 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L118

task "qa_plugin" depends on task "build", but their only_if conditions are different
<<: *QA_TASK_FILTER
env:
ITS_PROJECT: "plugin"
Expand All @@ -134,7 +129,7 @@
<<: *ON_FAILURE


qa_ruling_task:

Check warning on line 132 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L132

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

Check warning on line 132 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L132

task "qa_ruling" depends on task "build", but their only_if conditions are different
<<: *QA_TASK_FILTER
env:
SQ_VERSION: "LATEST_RELEASE"
Expand Down Expand Up @@ -175,7 +170,7 @@

### Promote tasks

promote_task:

Check warning on line 173 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L173

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

Check warning on line 173 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L173

task "promote" depends on task "build", but their only_if conditions are different
depends_on:
- build
- qa_plugin
Expand Down
177 changes: 0 additions & 177 deletions build.gradle

This file was deleted.

50 changes: 50 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* SonarSource Go
* Copyright (C) 2018-2024 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Sonar Source-Available License for more details.
*
* You should have received a copy of the Sonar Source-Available License
* along with this program; if not, see https://sonarsource.com/license/ssal/
*/
plugins {
id("org.sonarsource.cloud-native.code-style-conventions")
id("org.sonarsource.cloud-native.artifactory-configuration")
id("org.sonarqube") version "6.0.1.5171"
}

artifactoryConfiguration {
petertrr marked this conversation as resolved.
Show resolved Hide resolved
buildName = "sonar-go"
artifactsToPublish = "org.sonarsource.slang:sonar-go-plugin:jar"
artifactsToDownload = ""
repoKeyEnv = "ARTIFACTORY_DEPLOY_REPO"
usernameEnv = "ARTIFACTORY_DEPLOY_USERNAME"
passwordEnv = "ARTIFACTORY_DEPLOY_PASSWORD"
}

spotless {
java {
// no Java sources in the root project
target("")
}
}

val projectTitle = properties["projectTitle"] as String
sonar {
properties {
property("sonar.organization", "sonarsource")
property("sonar.projectKey", "SonarSource_sonar-go")
property("sonar.projectName", projectTitle)
property("sonar.links.ci", "https://cirrus-ci.com/github/SonarSource/sonar-go")
property("sonar.links.scm", "https://github.com/SonarSource/sonar-go")
property("sonar.links.issue", "https://jira.sonarsource.com/browse/SONARGO")
property("sonar.exclusions", "**/build/**/*")
}
}
12 changes: 10 additions & 2 deletions sonar-go-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import java.util.jar.JarInputStream
plugins {
id("org.sonarsource.cloud-native.java-conventions")
id("org.sonarsource.cloud-native.code-style-conventions")
id("org.sonarsource.cloud-native.publishing-configuration")
id("com.github.johnrengelman.shadow") version "7.1.0"
}

Expand Down Expand Up @@ -117,8 +118,15 @@ artifacts {
archives(tasks.shadowJar)
}

tasks.artifactoryPublish {
skip = false
publishingConfiguration {
pomName = properties["projectTitle"] as String
scmUrl = "https://github.com/SonarSource/sonar-go"

license {
name = "SSALv1"
url = "https://sonarsource.com/license/ssal/"
distribution = "repo"
}
}

publishing {
Expand Down
7 changes: 7 additions & 0 deletions sonar-go-to-slang/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ tasks.build {
dependsOn(generateTestReport)
}

spotless {
java {
// No Java sources in this project
target("")
}
}

if (System.getenv("CI") == "true") {
// spotless is enabled only for CI, because spotless relies on Go installation being available on the machine
spotless {
Expand Down
Loading