Skip to content

Commit

Permalink
SONARGO-82 Add "artifactory-configuration" to common Gradle modules (#44
Browse files Browse the repository at this point in the history
)
  • Loading branch information
petertrr authored Dec 17, 2024
1 parent 2ab0138 commit 6394f5b
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 190 deletions.
15 changes: 5 additions & 10 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,13 @@ on_failure_template: &ON_FAILURE
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_task:
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,7 +112,6 @@ gradle_its_template: &GRADLE_ITS_TEMPLATE
"-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

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 {
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

0 comments on commit 6394f5b

Please sign in to comment.