You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.gradle 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. sonar {
  2. properties {
  3. property "sonar.projectName", "${projectTitle} :: Web"
  4. property "sonar.sources", "src/main/js"
  5. property "sonar.exclusions", "src/main/js/**/__tests__/**,src/main/js/**/__mocks__/**,src/main/js/@types/**,src/main/js/helpers/mocks/**,src/main/js/api/mocks/**,src/main/js/helpers/testUtils.ts,src/main/js/helpers/testMocks.ts,src/main/js/helpers/testReactTestingUtils.tsx"
  6. property "sonar.tests", "src/main/js"
  7. property "sonar.test.inclusions", "src/main/js/**/__tests__/**"
  8. property "sonar.coverage.exclusions", "src/main/js/api/**,src/main/js/**/routes.ts,src/main/js/app/index.ts,src/main/js/app/utils/startReactApp.tsx,src/main/js/components/icons/**"
  9. property "sonar.eslint.reportPaths", "eslint-report/eslint-report.json"
  10. property "sonar.javascript.lcov.reportPaths", "coverage/lcov.info"
  11. }
  12. }
  13. def webappDir = "${buildDir}/webapp"
  14. task yarn_run(type: Exec) {
  15. ['config', 'public', 'scripts', 'src'].each {
  16. inputs.dir(it).withPathSensitivity(PathSensitivity.RELATIVE)
  17. }
  18. ['package.json', 'tsconfig.json', 'yarn.lock'].each {
  19. inputs.file(it).withPathSensitivity(PathSensitivity.RELATIVE)
  20. }
  21. outputs.dir(webappDir)
  22. outputs.cacheIf { true }
  23. commandLine osAdaptiveCommand(['npm', 'run', 'build-release'])
  24. }
  25. build.dependsOn(yarn_run)
  26. task "yarn_lint-report-ci"(type: Exec) {
  27. // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
  28. ['config', 'src/main/js'].each {
  29. inputs.dir(it)
  30. }
  31. ['package.json', 'yarn.lock', 'tsconfig.json', '.eslintrc'].each {
  32. inputs.file(it)
  33. }
  34. outputs.dir('eslint-report')
  35. outputs.cacheIf { true }
  36. commandLine osAdaptiveCommand(['npm', 'run', 'lint-report-ci'])
  37. }
  38. task "yarn_validate-ci"(type: Exec) {
  39. // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
  40. ['config', 'src/main/js'].each {
  41. inputs.dir(it)
  42. }
  43. ['package.json', 'yarn.lock', 'tsconfig.json', '.eslintrc', 'jest.config.js'].each {
  44. inputs.file(it)
  45. }
  46. outputs.dir('coverage')
  47. outputs.cacheIf { true }
  48. commandLine osAdaptiveCommand(['npm', 'run', 'validate-ci'])
  49. }
  50. task "yarn_check-ci"(type: Exec) {
  51. // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
  52. ['config', 'src'].each {
  53. inputs.dir(it)
  54. }
  55. ['package.json', 'yarn.lock', 'tsconfig.json'].each {
  56. inputs.file(it)
  57. }
  58. commandLine osAdaptiveCommand(['npm', 'run', 'check-ci'])
  59. }
  60. def sources = fileTree(dir: "src") + fileTree(dir: "scripts") + fileTree(dir: "config") + fileTree(dir: "__mocks__")
  61. task licenseCheckWeb(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
  62. source = sources
  63. exclude 'main/js/helpers/standards.json'
  64. if (official) exclude 'main/js/app/components/GlobalFooterBranding.js'
  65. }
  66. licenseMain.dependsOn licenseCheckWeb
  67. task licenseFormatWeb(type: com.hierynomus.gradle.license.tasks.LicenseFormat) {
  68. source = sources
  69. if (official) exclude 'main/js/app/components/GlobalFooterBranding.js'
  70. }
  71. licenseFormat.dependsOn licenseFormatWeb