aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-vsts/build.gradle
blob: 62cd909ea531a7ab92600bca104d3078bdac3b83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
sonarqube {
  properties {
    property "sonar.projectName", "${projectTitle} :: VSTS"
    property "sonar.sources", "src/main/js"
    property "sonar.tests", "src/main/js"
    property "sonar.test.inclusions", "src/main/js/**/__tests__/**"
    property "sonar.exclusions", "src/main/js/libs/third-party/**/*,src/main/js/**/__tests__/**"
    property "sonar.eslint.reportPaths", "eslint-report.json"
    property "sonar.typescript.lcov.reportPaths", "coverage/lcov.info"
  }
}

yarn_run {
  ['config', 'public', 'scripts', 'src',
    '../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).withPathSensitivity(PathSensitivity.RELATIVE)
  }
  ['babel.config.js', 'package.json', 'tsconfig.json', 'yarn.lock',
    '../sonar-web/package.json',
    '../sonar-web/yarn.lock'
  ].each {
    inputs.file(it).withPathSensitivity(PathSensitivity.RELATIVE)
  }
  outputs.dir('build/webapp')
  outputs.cacheIf { true }

  // sonar-web dependencies needs to be installed before we build sonar-vsts otherwise the sonar-web components
  // that sonar-vsts depends uppon won't find their node_modules
  dependsOn(':server:sonar-web:yarn')
  args = ['build']
}
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',
    '../sonar-web/package.json',
    '../sonar-web/yarn.lock'
  ].each {
    inputs.file(it)
  }
  outputs.file('eslint-report.json')
  outputs.dir('coverage')
  outputs.cacheIf { true }

  // sonar-web dependencies needs to be installed before we build sonar-vsts otherwise the sonar-web components
  // that sonar-vsts depends uppon won't find their node_modules
  dependsOn(yarn, ':server:sonar-web:yarn')
}

def sources = fileTree(dir: "src") + fileTree(dir: "scripts") + fileTree(dir: "config")

task licenseCheckWeb(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
  source = sources
}
licenseMain.dependsOn licenseCheckWeb

task licenseFormatWeb(type: com.hierynomus.gradle.license.tasks.LicenseFormat) {
  source = sources
}
licenseFormat.dependsOn licenseFormatWeb