-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
118 lines (97 loc) · 4.09 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
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
115
116
117
118
apply plugin: 'groovy'
apply from: 'http://www.tellurianring.com/projects/gradle-plugins/gradle-templates/apply.groovy'
/**
*
* BPIPE CONFIG BUILD SCRIPT
*
* use groovy templates: https://github.com/townsfolk/gradle-templates
* based on: http://www.gradle.org/docs/current/userguide/tutorial_groovy_projects.html
* Use STAGE to make a libexec like dir.
* No memory? run with
* GRADLE_OPTS="-Xmx1024m" gradle stage
*/
version = "1.0"
project.ext {
STAGE="build/stage/bpipeconfig"
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.codehaus.groovy', name: 'groovy', version: '2.1.7'
compile files(fileTree(dir:'local-lib', includes:['*.jar']))
testCompile group: 'junit', name: 'junit', version: '4.11'
}
test {
// LOGGER SETUP
testLogging.exceptionFormat = 'full'
}
// STAGE TASK
task stage(dependsOn: jar,
group: 'Build', description:"Stage project in ${project.STAGE} directory") << {
ant.mkdir(dir: project.STAGE)
ant.mkdir(dir: "$project.STAGE/bin")
ant.copy(todir: "$project.STAGE/bin") {
ant.fileset(dir: 'bin', includes: "**")
}
ant.mkdir(dir: "$project.STAGE/lib")
ant.copy(todir: "$project.STAGE/lib") {
ant.fileset(dir: 'local-lib', includes: "*.jar")
ant.fileset(dir: 'build/libs', includes: "bpipe_config-${version}.jar")
}
ant.mkdir(dir: "$project.STAGE/templates")
ant.copy(todir: "$project.STAGE/templates") {
ant.fileset(dir: 'templates', includes: "**")
}
ant.mkdir(dir: "$project.STAGE/config")
ant.copy(todir: "$project.STAGE/config") {
ant.fileset(dir: 'config', includes: "**")
}
ant.mkdir(dir: "$project.STAGE/pipelines")
ant.copy(todir: "$project.STAGE/pipelines") {
ant.fileset(dir: 'pipelines', includes: "**")
}
ant.mkdir(dir: "$project.STAGE/modules")
ant.copy(todir: "$project.STAGE/modules") {
ant.fileset(dir: 'modules', includes: "**")
}
ant.mkdir(dir: "$project.STAGE/misc")
ant.copy(todir: "$project.STAGE/misc") {
ant.fileset(dir: 'misc', includes: "**")
}
// CREATE A DOC DIR AND FILL: TODO
ant.mkdir(dir:"$project.STAGE/doc")
// ADD VERSION AND BUILDDATE TO SH SCRIPT
new File(STAGE+'/bin/bpipe-config').text = new File(
"bin/bpipe-config").text.replaceAll(
"VERSION=0.0.0","VERSION=$version").replaceAll(
"BUILDDATE=0","BUILDDATE="+String.valueOf(System.currentTimeMillis()))
// CHANGE PERMISSIONS IN BIN AND MISC
ant.chmod( dir: "$project.STAGE/bin", perm: "755", includes: "*")
ant.chmod( dir: "$project.STAGE/misc", perm: "755", includes: "*")
}
// DIST TASK: create a tar.gz in build dir
task dist(dependsOn: stage,
group: 'Build', description: "Create tar.gz file in build dir") << {
ant.tar(destfile: "build/bpipeconfig-${version}.tar") {
ant.tarfileset(dir: "build/stage", filemode:"755", includes: "bpipeconfig/bin/**", excludes:"**/*.swp")
ant.fileset(dir: "build/stage", includes: "bpipeconfig/lib/**", excludes:"**/*.swp")
ant.fileset(dir: "build/stage", includes: "bpipeconfig/templates/**", excludes:"**/*.swp")
ant.fileset(dir: "build/stage", includes: "bpipeconfig/config/**", excludes:"**/*.swp")
ant.fileset(dir: "build/stage", includes: "bpipeconfig/pipelines/**", excludes:"**/*.swp")
ant.fileset(dir: "build/stage", includes: "bpipeconfig/modules/**", excludes:"**/*.swp")
ant.tarfileset(dir: "build/stage", filemode:"755", includes: "bpipeconfig/misc/**", excludes:"**/*.swp")
ant.fileset(dir: "build/stage", includes: "bpipeconfig/doc/**", excludes:"**/*.swp")
}
ant.gzip(destfile:"build/bpipeconfig-${version}.tar.gz", src: "build/bpipeconfig-${version}.tar")
}
task testDebug(type: Test, dependsOn: testClasses,
group: 'Verification', description: "Run the unit test with custom output") {
// LOGGER SETUP
testLogging {
// show standard out and standard error of the test JVM(s) on the console
showStandardStreams = true
// Show that tests are run in the command-line output
events 'started', 'passed'
}
}