aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-docs/build.gradle
diff options
context:
space:
mode:
authorPhilippe Perrin <philippe.perrin@sonarsource.com>2021-09-29 09:47:37 +0200
committersonartech <sonartech@sonarsource.com>2021-09-29 20:03:10 +0000
commit62b21006de51a5b15819e70f4a0943ab983d2b68 (patch)
tree109bef1b790ca5175715574f717ee334543a5503 /server/sonar-docs/build.gradle
parentc3a2bcb82166864cb0c68a290b4168f7c4ce4904 (diff)
downloadsonarqube-62b21006de51a5b15819e70f4a0943ab983d2b68.tar.gz
sonarqube-62b21006de51a5b15819e70f4a0943ab983d2b68.zip
Avoid unnecessary yarn install
Diffstat (limited to 'server/sonar-docs/build.gradle')
-rw-r--r--server/sonar-docs/build.gradle21
1 files changed, 12 insertions, 9 deletions
diff --git a/server/sonar-docs/build.gradle b/server/sonar-docs/build.gradle
index 0a60cb45dd5..d2c7f745ec8 100644
--- a/server/sonar-docs/build.gradle
+++ b/server/sonar-docs/build.gradle
@@ -55,9 +55,8 @@ task extractAnalyzerDocFiles {
}
}
-yarn_run {
+task yarn_run(type: Exec) {
def docsVersion = version.split("[.-]").take(2).join('.')
- environment = [ GATSBY_DOCS_VERSION: docsVersion ]
inputs.property('version', docsVersion)
inputs.dir('src').withPathSensitivity(PathSensitivity.RELATIVE)
['gatsby-config.js', 'gatsby-node.js', 'package.json', 'yarn.lock', 'tsconfig.json'].each {
@@ -65,12 +64,16 @@ yarn_run {
}
outputs.dir('public')
outputs.cacheIf { true }
- args = ['build']
+
+ environment += [ GATSBY_DOCS_VERSION: docsVersion ]
+ commandLine 'npm', 'run', 'build'
}
+build.dependsOn(yarn_run)
+
// To clean outputs outside of "build" directory:
clean.dependsOn(cleanYarn_run)
-"yarn_check-ci" {
+tasks.register("yarn_check-ci", Exec) {
// Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
['config', 'src'].each {
inputs.dir(it)
@@ -79,10 +82,10 @@ clean.dependsOn(cleanYarn_run)
inputs.file(it)
}
- dependsOn(yarn)
+ commandLine 'npm', 'run', 'check-ci'
}
-"yarn_validate-ci" {
+tasks.register("yarn_validate-ci", Exec) {
// Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
['config', 'src'].each {
inputs.dir(it)
@@ -94,16 +97,16 @@ clean.dependsOn(cleanYarn_run)
outputs.dir('coverage')
outputs.cacheIf { true }
- dependsOn(yarn)
+ commandLine 'npm', 'run', 'validate-ci'
}
// Check for known vulnerabilities
task dependency_audit(type: Exec) {
inputs.file('package.json')
outputs.cacheIf { false }
- commandLine 'yarn', 'npm', 'audit', '--environment', 'production', '--severity', 'high'
ignoreExitValue = true
- dependsOn(yarn)
+
+ commandLine 'npm', 'run', 'audit-ci'
}
task zip(type: Zip) {