From c24973e34ca984aeb43409a12a064b026abf5740 Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov <138671+Godin@users.noreply.github.com> Date: Wed, 15 May 2019 17:21:37 +0200 Subject: [PATCH] Enable Gradle cache for "yarn_validate-ci" tasks (#1616) --- server/sonar-docs/.gitignore | 3 +++ server/sonar-docs/build.gradle | 13 +++++++++++-- server/sonar-docs/package.json | 3 ++- server/sonar-vsts/build.gradle | 18 ++++++++++++++++++ server/sonar-web/build.gradle | 13 +++++++++++++ 5 files changed, 47 insertions(+), 3 deletions(-) diff --git a/server/sonar-docs/.gitignore b/server/sonar-docs/.gitignore index b93c463eaba..37a17026f19 100644 --- a/server/sonar-docs/.gitignore +++ b/server/sonar-docs/.gitignore @@ -15,3 +15,6 @@ public # tests lcov.info coverage/ + +# eslint +eslint-report.json diff --git a/server/sonar-docs/build.gradle b/server/sonar-docs/build.gradle index f5ad4f00e91..868a0e61348 100644 --- a/server/sonar-docs/build.gradle +++ b/server/sonar-docs/build.gradle @@ -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) { diff --git a/server/sonar-docs/package.json b/server/sonar-docs/package.json index ad2b1e4e63d..fefe53c9881 100644 --- a/server/sonar-docs/package.json +++ b/server/sonar-docs/package.json @@ -63,9 +63,10 @@ "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, diff --git a/server/sonar-vsts/build.gradle b/server/sonar-vsts/build.gradle index e76f8102b25..d6ecf126fc1 100644 --- a/server/sonar-vsts/build.gradle +++ b/server/sonar-vsts/build.gradle @@ -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) { diff --git a/server/sonar-web/build.gradle b/server/sonar-web/build.gradle index 391f49ef4dd..44405d227d8 100644 --- a/server/sonar-web/build.gradle +++ b/server/sonar-web/build.gradle @@ -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) { -- 2.39.5