mirror of
https://github.com/SonarSource/sonarqube.git
synced 2024-08-07 15:05:55 +02:00
![Evgeny Mandrikov](/assets/img/avatar_default.png)
The latter one is actively maintained fork of the not anymore maintained former. In particular the former does not support Gradle 6.x.
68 lines
2.0 KiB
Groovy
68 lines
2.0 KiB
Groovy
sonarqube {
|
|
properties {
|
|
property "sonar.projectName", "${projectTitle} :: Web"
|
|
property "sonar.sources", "src/main/js"
|
|
property "sonar.tests", "src/main/js"
|
|
property "sonar.test.inclusions", "src/main/js/**/__tests__/**"
|
|
property "sonar.exclusions", "src/main/js/**/__tests__/**"
|
|
property "sonar.eslint.reportPaths", "eslint-report.json"
|
|
property "sonar.javascript.lcov.reportPaths", "coverage/lcov.info"
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.github.node-gradle.node'
|
|
|
|
def webappDir = "${buildDir}/webapp"
|
|
|
|
yarn_run {
|
|
['config', 'public', 'scripts', 'src', '../sonar-docs/src'].each {
|
|
inputs.dir(it).withPathSensitivity(PathSensitivity.RELATIVE)
|
|
}
|
|
['babel.config.js', 'package.json', 'tsconfig.json', 'yarn.lock'].each {
|
|
inputs.file(it).withPathSensitivity(PathSensitivity.RELATIVE)
|
|
}
|
|
outputs.dir(webappDir)
|
|
outputs.cacheIf { true }
|
|
args = ['build-release']
|
|
}
|
|
build.dependsOn(yarn_run)
|
|
|
|
"yarn_validate-ci" {
|
|
// Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
|
|
['config', 'src/main/js'].each {
|
|
inputs.dir(it)
|
|
}
|
|
['package.json', 'yarn.lock', 'tsconfig.json', '.eslintrc'].each {
|
|
inputs.file(it)
|
|
}
|
|
outputs.file('eslint-report.json')
|
|
outputs.dir('coverage')
|
|
outputs.cacheIf { true }
|
|
|
|
dependsOn(yarn)
|
|
}
|
|
|
|
// Check for known vulnerabilities
|
|
yarn_audit {
|
|
inputs.file('package.json')
|
|
outputs.cacheIf { false }
|
|
args = ['--groups', 'dependencies', '--level', 'high']
|
|
ignoreExitValue = true
|
|
dependsOn(yarn)
|
|
}
|
|
|
|
def sources = fileTree(dir: "src") + fileTree(dir: "scripts") + fileTree(dir: "config")
|
|
|
|
task licenseCheckWeb(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
|
|
source = sources
|
|
exclude 'main/js/helpers/standards.json'
|
|
if (official) exclude 'main/js/app/components/GlobalFooterBranding.js'
|
|
}
|
|
licenseMain.dependsOn licenseCheckWeb
|
|
|
|
task licenseFormatWeb(type: com.hierynomus.gradle.license.tasks.LicenseFormat) {
|
|
source = sources
|
|
if (official) exclude 'main/js/app/components/GlobalFooterBranding.js'
|
|
}
|
|
licenseFormat.dependsOn licenseFormatWeb
|