]> source.dussan.org Git - sonarqube.git/commitdiff
Enable Gradle cache for "yarn_validate-ci" tasks (#1616)
authorEvgeny Mandrikov <138671+Godin@users.noreply.github.com>
Wed, 15 May 2019 15:21:37 +0000 (17:21 +0200)
committerSonarTech <sonartech@sonarsource.com>
Wed, 15 May 2019 18:21:12 +0000 (20:21 +0200)
server/sonar-docs/.gitignore
server/sonar-docs/build.gradle
server/sonar-docs/package.json
server/sonar-vsts/build.gradle
server/sonar-web/build.gradle

index b93c463eabaa630f23a9bccbe358ae622957e846..37a17026f191aaa3af11929bf08b18446c5229d7 100644 (file)
@@ -15,3 +15,6 @@ public
 # tests
 lcov.info
 coverage/
+
+# eslint
+eslint-report.json
index f5ad4f00e9102afb3bb29d8fbabb5e871982183a..868a0e613487fe62a1683eb01076dfafc7204464 100644 (file)
@@ -24,8 +24,17 @@ yarn_run {
   args = ['build']
 }
 
-task "yarn_lint-report"() {
-
+"yarn_validate-ci" {
+  // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
+  ['config', 'src'].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 }
 }
 
 task zip(type: Zip) {
index ad2b1e4e63df94b4d6ab0e8f606c4ea82b833600..fefe53c9881d1dc08ab70e99f58e5163a2f99815 100644 (file)
     "format": "prettier --write --list-different 'src/**/*.{js,ts,tsx,css}'",
     "format-check": "prettier --list-different 'src/**/*.{js,ts,tsx,css}'",
     "lint": "eslint --ext js,ts,tsx --quiet src",
+    "lint-report": "eslint --ext js,ts,tsx -f json -o eslint-report.json src",
     "ts-check": "tsc --noEmit",
     "validate": "yarn lint && yarn ts-check && yarn format-check && yarn test",
-    "validate-ci": "yarn lint && yarn ts-check && yarn format-check && yarn test"
+    "validate-ci": "yarn lint-report && yarn ts-check && yarn format-check && yarn test --coverage"
   },
   "prettier": {
     "jsxBracketSameLine": true,
index e76f8102b25bfb254ce061a41fa7ed9f8608bd47..d6ecf126fc1f21d87310cd58631555f9d2ae6e1e 100644 (file)
@@ -28,6 +28,24 @@ yarn_run {
 }
 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',
+    '../sonar-web/src/main/js/api',
+    '../sonar-web/src/main/js/app',
+    '../sonar-web/src/main/js/components',
+    '../sonar-web/src/main/js/helpers'
+  ].each {
+    inputs.dir(it)
+  }
+  ['package.json', 'yarn.lock', 'tsconfig.json', '.eslintrc', '.eslintignore'].each {
+    inputs.file(it)
+  }
+  outputs.file('eslint-report.json')
+  outputs.dir('coverage')
+  outputs.cacheIf { true }
+}
+
 def sources = fileTree(dir: "src") + fileTree(dir: "scripts") + fileTree(dir: "config")
 
 task licenseCheckWeb(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
index 391f49ef4dd97b1949c74e3c21cce65de2224e7f..44405d227d863fc08a90aa6341eb248ee35a9d75 100644 (file)
@@ -40,6 +40,19 @@ yarn_run {
 }
 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 }
+}
+
 def sources = fileTree(dir: "src") + fileTree(dir: "scripts") + fileTree(dir: "config")
 
 task licenseCheckWeb(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {