aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/build.gradle
blob: 00edc7fd234f29b61a4c2876f30497d897fcd53f (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
sonarqube {
  properties {
    property "sonar.projectName", "${projectTitle} :: Web"
    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/**/__tests__/**"
    property "sonar.eslint.reportPaths", "eslint-report.json"
  }
}

apply plugin: 'com.moowork.node'

def webappDir = "${buildDir}/webapp"

task copyBranding(type: Copy) {
  into projectDir
  if (findProject(':private:branding')) {
    from project(':private:branding').file('.')
    includeEmptyDirs = false
  }
}

yarn_run {
  if (official) { dependsOn copyBranding }
  
  inputs.property('official', official)
  ['config', 'public', 'scripts', 'src', '../sonar-docs/src'].each {
    inputs.dir(it).withPathSensitivity(PathSensitivity.RELATIVE)
  }
  ['.babelrc', 'package.json', 'tsconfig.json', 'yarn.lock'].each {
    inputs.file(it).withPathSensitivity(PathSensitivity.RELATIVE)
  }
  outputs.dir(webappDir)
  outputs.cacheIf { true }
  args = ['build']
}
build.dependsOn(yarn_run)

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

task licenseCheckWeb(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
  source = sources
  exclude 'main/js/helpers/standards.json'
  if (official) exclude 'main/js/app/components/GlobalFooterBranding.js'
}
licenseMain.dependsOn licenseCheckWeb

task licenseFormatWeb(type: com.hierynomus.gradle.license.tasks.LicenseFormat) {
  source = sources
  if (official) exclude 'main/js/app/components/GlobalFooterBranding.js'
}
licenseFormat.dependsOn licenseFormatWeb