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 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. sonarqube {
  2. properties {
  3. property "sonar.projectName", "${projectTitle} :: Web"
  4. property "sonar.sources", "src/main/js"
  5. property "sonar.tests", "src/main/js"
  6. property "sonar.test.inclusions", "src/main/js/**/__tests__/**"
  7. property "sonar.exclusions", "src/main/js/**/__tests__/**"
  8. property "sonar.eslint.reportPaths", "eslint-report.json"
  9. property "sonar.javascript.lcov.reportPaths", "coverage/lcov.info"
  10. }
  11. }
  12. apply plugin: 'com.github.node-gradle.node'
  13. def webappDir = "${buildDir}/webapp"
  14. yarn_run {
  15. ['config', 'public', 'scripts', 'src', '../sonar-docs/src'].each {
  16. inputs.dir(it).withPathSensitivity(PathSensitivity.RELATIVE)
  17. }
  18. ['babel.config.js', 'package.json', 'tsconfig.json', 'yarn.lock'].each {
  19. inputs.file(it).withPathSensitivity(PathSensitivity.RELATIVE)
  20. }
  21. outputs.dir(webappDir)
  22. outputs.cacheIf { true }
  23. args = ['build-release']
  24. }
  25. build.dependsOn(yarn_run)
  26. "yarn_check-ci" {
  27. // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
  28. ['config', 'src'].each {
  29. inputs.dir(it)
  30. }
  31. ['package.json', 'yarn.lock', 'tsconfig.json'].each {
  32. inputs.file(it)
  33. }
  34. dependsOn(yarn)
  35. }
  36. "yarn_validate-ci" {
  37. // Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
  38. ['config', 'src/main/js'].each {
  39. inputs.dir(it)
  40. }
  41. ['package.json', 'yarn.lock', 'tsconfig.json', '.eslintrc'].each {
  42. inputs.file(it)
  43. }
  44. outputs.file('eslint-report.json')
  45. outputs.dir('coverage')
  46. outputs.cacheIf { true }
  47. dependsOn(yarn)
  48. }
  49. // Check for known vulnerabilities
  50. yarn_audit {
  51. inputs.file('package.json')
  52. outputs.cacheIf { false }
  53. args = ['--groups', 'dependencies', '--level', 'high']
  54. ignoreExitValue = true
  55. dependsOn(yarn)
  56. }
  57. def sources = fileTree(dir: "src") + fileTree(dir: "scripts") + fileTree(dir: "config") + fileTree(dir: "__mocks__")
  58. task licenseCheckWeb(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
  59. source = sources
  60. exclude 'main/js/helpers/standards.json'
  61. if (official) exclude 'main/js/app/components/GlobalFooterBranding.js'
  62. }
  63. licenseMain.dependsOn licenseCheckWeb
  64. task licenseFormatWeb(type: com.hierynomus.gradle.license.tasks.LicenseFormat) {
  65. source = sources
  66. if (official) exclude 'main/js/app/components/GlobalFooterBranding.js'
  67. }
  68. licenseFormat.dependsOn licenseFormatWeb