forked from agilee/Lipstick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·216 lines (190 loc) · 6.55 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
import nl.javadude.gradle.plugins.license.License
import java.text.SimpleDateFormat
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath('nl.javadude.gradle.plugins:license-gradle-plugin:0.6.0') {
exclude module: 'guava'
}
classpath 'com.google.guava:guava:12.0'
}
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
}
version = '0.3'
group = 'com.netflix.lipstick'
}
task('show-version') {
doLast {
println version
}
}
apply plugin: 'license'
task(licensesAll, type: License) {
check = false
skipExistingHeaders = true
source '.'
include 'lipstick-console/src/**/*.java'
include 'lipstick-server/grails-app/**'
include 'lipstick-server/src/groovy/**/*.groovy'
include 'lipstick-server/web-app/js/tossboss*.js'
include 'lipstick-server/web-app/tossboss*/js/*.js'
include 'lipstick-server/web-app/*.html'
include 'lipstick-server/web-app/tossboss*/*.html'
include 'lipstick-server/web-app/tossboss*/css/*.css'
include 'scripts/**'
include 'test/integration/**'
include 'test/unit/**'
include 'lipstick-app/css/**'
include 'lipstick-app/js/**'
exclude '**/*.json'
}
license {
header rootProject.file('codequality/HEADER')
ext.year = Calendar.getInstance().get(Calendar.YEAR)
mapping {
groovy='SLASHSTAR_STYLE'
gsp='DYNASCRIPT_STYLE'
}
}
defaultTasks 'buildRelease'
task('buildRelease', type:Copy, dependsOn: ['clean-expanded', ':lipstick-server:war']) {
group = "Lipstick"
description = 'Build lipstick-server and lipstick-console and copy the artifacts to the build dir.'
from ('./lipstick-server/target') {
include '*.war'
}
from ('./lipstick-console/build/libs') {
include '*.jar'
}
into ('build')
}
task('clean-expanded', type:Delete) {
delete 'build'
}
project(':lipstick-server') {
task('clean', type:Exec) {
commandLine './grailsw', 'clean'
}
task('clean-lib', type:Delete) {
ant.delete (includeEmptyDirs: 'true', quiet: 'true') {
fileset(dir: file('lipstick-server/lib'), includes: /*'lipstick-console*.jar'*/'*.jar')
}
}
task('import-jar', type:Copy, dependsOn: [':lipstick-console:jar','clean-lib']) {
from ('../lipstick-console/build/libs') {
include '*.jar'
}
into ('lib')
}
task('debug', type:Exec, dependsOn: 'import-jar') {
group = "Lipstick"
description = 'Run lipstick-server in debug mode. Runs on port 8080. Set -Pport=[port] to change.'
commandLine './grailsw', '-Dserver.port=' + (project.hasProperty('port') ? port : 8080), 'run-app'
}
task('debug-war', type:Exec, dependsOn: ':lipstick-server:import-jar') {
commandLine './grailsw', 'debug', 'war'
}
task('war', type:Exec, dependsOn: ':lipstick-server:import-jar') {
group = "Lipstick"
description = 'Build a war for release.'
commandLine './grailsw', 'set-version', version
commandLine './grailsw', 'prod', 'war'
}
task('build', dependsOn: 'war')
}
project(':lipstick-console') {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
configurations {
includeInJar
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
dependencies {
includeInJar 'dk.brics.automaton:automaton:1.11-8'
includeInJar 'org.codehaus.jackson:jackson-mapper-asl:1.9.10'
includeInJar 'com.google.guava:guava:12.0'
includeInJar 'org.kohsuke:graphviz-api:1.1'
includeInJar 'org.apache.commons:commons-io:1.3.2'
includeInJar 'log4j:log4j:1.2.16'
includeInJar 'joda-time:joda-time:1.6'
includeInJar 'com.googlecode.jatl:jatl:0.2.2'
includeInJar 'com.sun.jersey:jersey-client:1.8'
includeInJar 'com.sun.jersey:jersey-core:1.8'
includeInJar 'jline:jline:0.9.94'
includeInJar 'org.antlr:antlr:3.4'
includeInJar 'org.antlr:antlr-runtime:3.4'
if(project.hasProperty('withoutPig')) {
println "building jar without Pig"
compile('org.apache.pig:pig:0.11.1') {
exclude module: 'hsqld'
exclude module: 'jetty'
exclude module: 'jsp-api-2.1'
exclude module: 'servlet-api-2.5'
}
} else {
includeInJar('org.apache.pig:pig:0.11.1') {
exclude module: 'hsqld'
exclude module: 'jetty'
exclude module: 'jsp-api-2.1'
exclude module: 'servlet-api-2.5'
}
}
if(project.hasProperty('withHadoop')) {
println "building jar with Hadoop"
includeInJar 'org.apache.hadoop:hadoop-core:' + (project.hasProperty('hadoopVersion') ? hadoopVersion : '1.1.0')
} else {
compile 'org.apache.hadoop:hadoop-core:' + (project.hasProperty('hadoopVersion') ? hadoopVersion : '1.1.0')
}
compile 'org.hibernate:hibernate-entitymanager:3.6.0.Final'
testCompile 'org.hsqldb:hsqldb:2.2.8'
testCompile 'org.testng:testng:6.7'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'org.powermock:powermock-api-mockito:1.5'
configurations.compile.extendsFrom(configurations.includeInJar)
}
test {
useTestNG()
}
jar {
it.dependsOn ':clean-expanded', 'buildinfo'
from { configurations.includeInJar.collect { it.isDirectory() ? it : zipTree(it) } }
manifest { attributes 'Main-Class': 'com.netflix.lipstick.Main' }
}
task('buildinfo', type:Copy) {
group = "Lipstick"
description = 'put the build information into lipstick-build.txt'
from ('./buildinfo') {
include 'lipstick_build.txt'
}
def df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
def ts = df.format(new Date())
def commitid = ''
new ByteArrayOutputStream().withStream { os ->
def res = exec() {
executable = 'git'
args = ['rev-parse','HEAD']
ignoreExitValue = true
standardOutput = os
}
commitid = os.toString()
}
expand(version: version, ts: ts, commitid: commitid)
into ('./src/main/resources')
outputs.upToDateWhen { false }
}
task('install', dependsOn: 'publishToMavenLocal')
}