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.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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,src/main/js/helpers/testSelector.ts"
  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_design-system"(type: Exec) {
  15. inputs.dir('design-system/src')
  16. workingDir "design-system"
  17. commandLine osAdaptiveCommand(['npm', 'run', 'build-release'])
  18. outputs.dir("design-system/lib")
  19. outputs.cacheIf { true }
  20. }
  21. task yarn_run(type: Exec) {
  22. dependsOn "yarn_design-system"
  23. tasks."yarn_design-system".getOutputs().getFiles().each {
  24. inputs.dir(it).withPathSensitivity(PathSensitivity.RELATIVE)
  25. }
  26. ['config', 'public', 'scripts', 'src'].each {
  27. inputs.dir(it).withPathSensitivity(PathSensitivity.RELATIVE)
  28. }
  29. ['package.json', 'tsconfig.json', 'yarn.lock', 'tailwind.config.js', 'tailwind.base.config.js'].each {
  30. inputs.file(it).withPathSensitivity(PathSensitivity.RELATIVE)
  31. }
  32. outputs.dir(webappDir)
  33. outputs.cacheIf { true }
  34. commandLine osAdaptiveCommand(['npm', 'run', 'build-release'])
  35. }
  36. build.dependsOn(yarn_run)
  37. task "yarn_lint-report-ci"(type: Exec) {
  38. dependsOn "yarn_design-system"
  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'].each {
  44. inputs.file(it)
  45. }
  46. outputs.dir('eslint-report')
  47. outputs.cacheIf { true }
  48. commandLine osAdaptiveCommand(['npm', 'run', 'lint-report-ci'])
  49. }
  50. task "yarn_validate-ci"(type: Exec) {
  51. dependsOn "yarn_design-system"
  52. // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
  53. ['config', 'src/main/js', 'design-system'].each {
  54. inputs.dir(it)
  55. }
  56. ['package.json', 'yarn.lock', 'tsconfig.json', '.eslintrc', 'jest.config.js'].each {
  57. inputs.file(it)
  58. }
  59. outputs.dir('coverage')
  60. outputs.cacheIf { true }
  61. commandLine osAdaptiveCommand(['npm', 'run', 'validate-ci'])
  62. }
  63. task "yarn_check-ci"(type: Exec) {
  64. dependsOn "yarn_design-system"
  65. // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
  66. ['config', 'src'].each {
  67. inputs.dir(it)
  68. }
  69. ['package.json', 'yarn.lock', 'tsconfig.json'].each {
  70. inputs.file(it)
  71. }
  72. commandLine osAdaptiveCommand(['npm', 'run', 'check-ci'])
  73. }
  74. def sources = fileTree(dir: "src/main/js") + fileTree(dir: "scripts") + fileTree(dir: "config") + fileTree(dir: "eslint-local-rules") + fileTree(dir: "__mocks__") + fileTree(dir: "design-system/config") + fileTree(dir: "design-system/src") + files("file:tailwind.config.js") + files("file:jest.config.js") + files("file:tailwind.base.config.js") + files("file:tailwind.config.js") + files("file:tailwind.utilities.js")
  75. task licenseCheckWeb(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
  76. source = sources
  77. exclude 'main/js/helpers/standards.json'
  78. if (official) exclude 'main/js/app/components/GlobalFooterBranding.js'
  79. }
  80. licenseMain.dependsOn licenseCheckWeb
  81. task licenseFormatWeb(type: com.hierynomus.gradle.license.tasks.LicenseFormat) {
  82. source = sources
  83. if (official) exclude 'main/js/app/components/GlobalFooterBranding.js'
  84. }
  85. licenseFormat.dependsOn licenseFormatWeb