-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.savant
114 lines (98 loc) · 4.21 KB
/
build.savant
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* Copyright (c) 2014-2023, Inversoft Inc., All Rights Reserved
*/
savantVersion = "2.0.0-RC.6"
savantIdeaVersion = "2.0.0-RC.7"
project(group: "org.inversoft.prime", name: "prime.js", version: "1.7.0", licenses: ["ApacheV2_0"]) {
workflow {
fetch {
cache()
url(url: "https://repository.savantbuild.org")
}
publish {
cache()
}
}
publishWorkflow {
subversion(repository: "https://svn.savantbuild.org")
}
publications {
main {
publication(name: "prime", type: "js", file: "build/prime-${project.version}.js", source: "build/prime-${project.version}.js")
publication(name: "prime", type: "css", file: "build/prime-${project.version}.css", source: "build/prime-${project.version}.css")
publication(name: "prime-min", type: "js", file: "build/prime-min-${project.version}.js", source: "build/prime-min-${project.version}.js")
publication(name: "prime-min", type: "js.map", file: "build/prime-min-${project.version}.js.map", source: "build/prime-min-${project.version}.js.map")
publication(name: "prime-min", type: "css", file: "build/prime-min-${project.version}.css", source: "build/prime-min-${project.version}.css")
publication(name: "prime-min", type: "css.map", file: "build/prime-min-${project.version}.css.map", source: "build/prime-min-${project.version}.css.map")
publication(name: "prime-es6", type: "js", file: "build/prime-es6-${project.version}.js", source: "build/prime-es6-${project.version}.js")
publication(name: "prime-es6-min", type: "js", file: "build/prime-es6-min-${project.version}.js", source: "build/prime-es6-min-${project.version}.js")
publication(name: "prime-es6-min", type: "js.map", file: "build/prime-es6-min-${project.version}.js.map", source: "build/prime-es6-min-${project.version}.js.map")
publication(name: "prime-all", type: "zip", file: "build/prime-all.zip", source: "build/prime-all.zip")
}
}
}
// Plugins
dependency = loadPlugin(id: "org.savantbuild.plugin:dependency:${savantVersion}")
file = loadPlugin(id: "org.savantbuild.plugin:file:${savantVersion}")
idea = loadPlugin(id: "org.savantbuild.plugin:idea:${savantIdeaVersion}")
release = loadPlugin(id: "org.savantbuild.plugin:release-git:${savantVersion}")
target(name: "clean", description: "Does nothing. Exists for scripting") {
file.prune(dir: "build")
}
target(name: "setup", description: "installs gulp") {
def proc = "npm install -g gulp".execute()
proc.consumeProcessOutput(System.out, System.err)
proc.waitFor()
proc = "npm install".execute()
proc.consumeProcessOutput(System.out, System.err)
proc.waitFor()
proc = "npm i -D karma-chrome-launcher puppeteer".execute()
proc.consumeProcessOutput(System.out, System.err)
proc.waitFor()
}
target(name: "int", description: "Releases a local integration build of the project", dependsOn: ["test"]) {
def which = "which gulp".execute()
which.waitFor()
if (which.exitValue() != 0) {
fail ("Error. Can't build without setup. Run > sb setup")
}
// Add the project version to the gulp env
def envList = []
System.getenv().each() {k, v -> envList.push ("$k=$v")}
envList.push( "project.version=${project.version}")
def gulp = "gulp".execute(envList, null)
gulp.consumeProcessOutput(System.out, System.err)
gulp.waitFor()
file.zip(file: "build/prime-all.zip") {
fileSet(dir: "build", excludePatterns: [~/.+\.zip/])
}
dependency.integrate()
}
target(name: "test", description: "Runs tests for the project") {
if (switches.has("skipTests")) {
return
}
def success = "which gulp".execute().exitValue()
if (success == 1) {
println "Error. Can't test without setup. Run > sb setup"
exit
}
def karma
if (switches.has("debug")) {
println " > gulp test"
karma = "gulp test".execute()
karma.consumeProcessOutput(System.out, System.err)
} else {
println " > gulp fastTest"
karma = "gulp fastTest".execute()
}
karma.consumeProcessOutput(System.out, System.err)
karma.waitFor()
assert karma.exitValue() != 1
}
target(name: "idea", description: "Updates the IntelliJ IDEA module file") {
idea.iml()
}
target(name: "release", description: "Releases a full version of the project", dependsOn: ["clean", "int"]) {
release.release()
}