This is an automated email from the ASF dual-hosted git repository. kwin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git
The following commit(s) were added to refs/heads/master by this push: new d29aedf SLING-11400 enable jacoco with the main Maven build (#9) d29aedf is described below commit d29aedf5232123a16d9a9e399a6f24f80761b665 Author: Konrad Windszus <k...@apache.org> AuthorDate: Tue Jun 21 08:30:03 2022 +0200 SLING-11400 enable jacoco with the main Maven build (#9) --- vars/slingOsgiBundleBuild.groovy | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy index 1b97856..c7b4488 100644 --- a/vars/slingOsgiBundleBuild.groovy +++ b/vars/slingOsgiBundleBuild.groovy @@ -142,14 +142,18 @@ def defineStage(def globalConfig, def jobConfig, def jdkVersion, boolean isRefer } def invocation = { - if ( isReferenceStage && goal == "deploy" && shouldDeploy ) { - String localRepoPath = "${env.WORKSPACE}/local-snapshots-dir" - // Make sure the directory is wiped. - dir(localRepoPath) { - deleteDir() + if ( isReferenceStage ) { + if ( goal == "deploy" && shouldDeploy ) { + String localRepoPath = "${env.WORKSPACE}/local-snapshots-dir" + // Make sure the directory is wiped. + dir(localRepoPath) { + deleteDir() + } + // deploy to local directory (all artifacts from a reactor) + additionalMavenParams = "${additionalMavenParams} -DaltDeploymentRepository=snapshot-repo::default::file:${localRepoPath}" } - // deploy to local directory (all artifacts from a reactor) - additionalMavenParams = "${additionalMavenParams} -DaltDeploymentRepository=snapshot-repo::default::file:${localRepoPath}" + // calculate coverage with jacoco (for subsequent evaluation by SonarQube) + additionalMavenParams = "${additionalMavenParams} -Pjacoco-report" } checkout scm withMaven(maven: globalConfig.mvnVersion, jdk: jenkinsJdkLabel, @@ -204,7 +208,7 @@ def analyseWithSonarCloud(def globalConfig, def jobConfig) { def isPrBuild = env.BRANCH_NAME.startsWith("PR-") // As we don't have the global SonarCloud conf for now, we can't use #withSonarQubeEnv so we need to set the following props manually - def sonarcloudParams="-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_${jobConfig.repoName} -Pjacoco-report -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco-merged/jacoco.xml ${jobConfig.sonarQubeAdditionalParams}" + def sonarcloudParams="-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_${jobConfig.repoName} -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco-merged/jacoco.xml ${jobConfig.sonarQubeAdditionalParams}" if ( jobConfig.sonarQubeUseAdditionalMavenParams ) { sonarcloudParams="${sonarcloudParams} ${additionalMavenParams}" }