forked from spinnaker/deck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
86 lines (72 loc) · 1.98 KB
/
build.gradle
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
74
75
76
77
78
79
80
81
82
83
84
85
import java.nio.file.Paths
import groovy.json.JsonOutput
buildscript {
repositories {
jcenter()
maven { url "http://dl.bintray.com/spinnaker/gradle" }
}
dependencies {
classpath 'com.netflix.spinnaker.gradle:spinnaker-gradle-project:3.1.0'
classpath 'com.moowork.gradle:gradle-node-plugin:0.11'
}
}
group = "com.netflix.spinnaker.deck"
apply plugin: 'spinnaker.project'
apply plugin: 'nebula.ospackage'
apply plugin: 'com.moowork.node'
apply plugin: 'java'
jar {
dependsOn('webpack')
from(fileTree("build/webpack")) {
into "META-INF/resources"
}
}
node {
// Version of node to use.
version = '4.4.1'
npmVersion = '2.14.20'
// Enabled the automatic download. False is the default (for now).
download = true
}
task webpack(type: NodeTask) {
workingDir '.'
script = file('node_modules/webpack/bin/webpack.js')
environment = [
"GATE_HOST": "spinnaker-api-prestaging.prod.netflix.net",
]
}
task karma(type: NodeTask) {
script = file('node_modules/karma/bin/karma')
args = ["start", "--single-run", "--reporters", "progress,jenkins"]
}
task generateVersionFile << {
def buildInfo = [
version: project.hasProperty('deckVersion') ? "${deckVersion}" : "n/a",
created: new Date().getTime()
]
def buildJson = JsonOutput.prettyPrint(JsonOutput.toJson(buildInfo))
new File(Paths.get("build", "webpack").toString()).mkdirs()
new File(Paths.get("build", "webpack", "version.json").toString()).write(buildJson)
new File("version.json").write(buildJson)
}
webpack.outputs.dir file('build/webpack')
npmInstall.dependsOn 'generateVersionFile'
webpack.dependsOn 'npmInstall'
karma.dependsOn 'webpack'
test.dependsOn 'karma'
buildDeb.dependsOn 'test'
String toVers(String v) {
int idx = v.indexOf('-')
if (idx != -1) {
return v.substring(0, idx)
}
return v
}
ospackage {
packageName = "spinnaker-deck"
version = toVers(project.version.toString())
release '3'
into "/opt/deck/html"
requires "apache2"
from "build/webpack"
}