Start sonarqube integration

This commit is contained in:
Sebastian Sdorra
2021-01-13 18:44:07 +01:00
committed by René Pfeuffer
parent 76ea458981
commit 18e841b0e8
5 changed files with 46 additions and 2 deletions

3
Jenkinsfile vendored
View File

@@ -78,8 +78,7 @@ pipeline {
if (env.BRANCH_NAME != "master") { if (env.BRANCH_NAME != "master") {
sonar += " -Dsonar.branch.target=master" sonar += " -Dsonar.branch.target=master"
} }
// disable until we know how todo sonar analysis with subprojects sh "./gradlew sonarqube"
// sh "./gradlew sonarqube"
} }
} }
} }

View File

@@ -25,6 +25,7 @@
plugins { plugins {
id 'java-platform' id 'java-platform'
id 'maven-publish' id 'maven-publish'
id "org.sonarqube" version "3.0"
} }
subprojects { s -> subprojects { s ->
@@ -146,6 +147,8 @@ project.ext {
nextSnapshotVersion = "${v.major}.${v.minor}.${v.micro + 1}-SNAPSHOT" nextSnapshotVersion = "${v.major}.${v.minor}.${v.micro + 1}-SNAPSHOT"
isCI = isRunningOnCiServer() isCI = isRunningOnCiServer()
os = os()
arch = arch()
} }
publishing { publishing {
@@ -171,6 +174,7 @@ publishing {
} }
// determine if we run on ci // determine if we run on ci
def isRunningOnCiServer() { def isRunningOnCiServer() {
return isEnvAvailable("JENKINS_URL") && isEnvAvailable("BUILD_ID") return isEnvAvailable("JENKINS_URL") && isEnvAvailable("BUILD_ID")
} }
@@ -180,6 +184,17 @@ def isEnvAvailable(String key) {
return value != null && !value.trim().isEmpty() return value != null && !value.trim().isEmpty()
} }
def os() {
return System.getProperty("os.name").toLowerCase(Locale.ENGLISH)
}
def arch() {
def arch = System.getProperty("os.arch")
if ("amd64".equals(arch)) {
return "x64"
}
return arch
}
// release related tasks // release related tasks

View File

@@ -113,3 +113,7 @@ task integrationTest {
description = "Runs all integration tests." description = "Runs all integration tests."
group = "verification" group = "verification"
} }
sonarqube {
skipProject = true
}

View File

@@ -46,3 +46,11 @@ scmPlugin {
} }
} }
sonarqube {
// TODO
skipProject = true
properties {
property 'sonar.tests', ''
}
}

View File

@@ -228,3 +228,21 @@ license {
task license(type: com.hierynomus.gradle.license.tasks.LicenseCheck) { task license(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
source = fileTree('.') source = fileTree('.')
} }
sonarqube {
properties {
property 'sonar.language', 'typescript'
property 'sonar.sources', project.fileTree('.').include('ui-*/src/**')
property 'sonar.tests', project.fileTree('.').include('ui-*/src/**')
property 'sonar.test.inclusions', '**/*.test.ts,**/*.test.js,**/*.test.tsx'
property 'sonar.junit.reportPaths', 'build/jest-reports/'
// no wildcard support
// https://github.com/SonarSource/SonarJS/issues/578
property 'sonar.javascript.lcov.reportPaths', 'build/jest-reports/coverage-ui-components/lcov.info,build/jest-reports/coverage-ui-extensions/lcov.info,build/jest-reports/coverage-ui-webapp/lcov.info'
property 'sonar.nodejs.executable', project.file(".gradle/nodejs/node-v${nodeVersion}-${os}-${arch}/bin/node")
}
}
task sonarqube(type: org.sonarqube.gradle.SonarQubeTask) {
dependsOn 'yarn_install', 'test'
}