forked from mbteswedenab/groovypp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
277 lines (220 loc) · 10.7 KB
/
Copy pathbuild.gradle
File metadata and controls
277 lines (220 loc) · 10.7 KB
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
apply plugin: 'maven'
gppVer = '0.9.0'
def improveDependencies(pom) {
pom.dependencies = pom.dependencies.findAll { dep ->
!(dep.artifactId in ['groovypp', 'groovypp-all', 'groovypp-nodep', 'groovypp-all-nodep'])
}
pom.dependencies.each { dep ->
println dep
}
println()
}
[':G17X' : '1.7.10', ':G18X' : '1.8.2'].each { prj, groovyVer ->
project("Test${prj.substring(1)}") {
apply plugin: 'groovy'
apply plugin: 'idea'
repositories {
mavenCentral()
mavenRepo urls: 'http://groovypp.artifactoryonline.com/groovypp/libs-releases-local/'
mavenRepo urls: 'http://repository.codehaus.org/'
}
dependencies {
groovy(group: 'org.codehaus.groovy', name: 'groovy', version: groovyVer)
compile(group: 'org.codehaus.groovy', name: 'groovy', version: groovyVer)
compile files("../${prj.substring(1)}/build/classes/main")
compile "junit:junit:4.8.1"
testRuntime(group: 'org.apache.ant', name: 'ant', version: '1.8.1')
testRuntime(group: 'commons-cli', name: 'commons-cli', version: '1.1')
testRuntime(group: 'org.apache.ivy', name: 'ivy', version: '2.2.0')
testRuntime(group: 'org.mortbay.jetty', name: 'servlet-api', version: '3.0.20100224')
}
sourceSets {
test {
groovy {
srcDirs file("../Tests/tests"), file("../StdLib/tests")
}
}
}
sourceSets.test.groovy.filter.include "**/*.gpp", "**/*.grunit", "**/*.gpptl", "**/*.groovy"
compileTestGroovy.dependsOn << ["$prj:compileGroovy"]
test.maxParallelForks = 3
}
project(prj) {
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'maven'
group = 'org.mbte.groovypp'
version = "${gppVer}_$groovyVer"
repositories {
mavenCentral()
mavenRepo urls: new File("${System.getProperty('user.home')}/.m2/repository").toURL().toString()
mavenRepo urls: 'http://groovypp.artifactoryonline.com/groovypp/libs-releases-local/'
mavenRepo urls: 'http://repository.codehaus.org/'
}
dependencies {
groovy(group: 'org.codehaus.groovy', name: 'groovy', version: groovyVer)
compile(group: 'org.codehaus.groovy', name: 'groovy', version: groovyVer)
compile(group: 'org.mbte.groovypp', name: 'groovypp-nodep', version: "0.4.295_${groovyVer == '1.8.2' ? '1.8.0' : groovyVer }")
compile "junit:junit:4.8.1"
}
sourceSets {
compiler {
groovy {
srcDir file("../Compiler/src")
}
classesDir = file('build/classes/main')
}
stdlib {
groovy {
srcDir file("../StdLib/src")
}
classesDir = file('build/classes/main')
}
}
task copyMetaInf << {
def myFile = file("build/classes/main/META-INF/groovypp-release-info.properties")
copy {
from file('../Compiler/src/META-INF')
into file('build/classes/main/META-INF')
}
def src = myFile.text
src = src.replaceAll("##ImplementationVersion##", gppVer)
def dateTime = new Date()
src = src.replaceAll("##BuildDate##", dateTime.format("dd-MMM-yyyy"))
src = src.replaceAll("##BuildTime##", dateTime.format("hh:mm aa"))
myFile.text = src
}
compileGroovy.dependsOn << [compileCompilerGroovy, compileStdlibGroovy, copyMetaInf]
task sourcesJar(type: Jar) {
baseName = 'groovypp'
classifier = 'sources'
from sourceSets.compiler.allSource + sourceSets.stdlib.allSource
}
task allSourcesJar(type: Jar) {
baseName = 'groovypp'
classifier = 'sources'
appendix = 'all'
from sourceSets.compiler.allSource + sourceSets.stdlib.allSource
}
task nodepSourcesJar(type: Jar) {
baseName = 'groovypp'
classifier = 'sources'
appendix = 'nodep'
from sourceSets.compiler.allSource + sourceSets.stdlib.allSource
}
task allNodepSourcesJar(type: Jar) {
baseName = 'groovypp'
classifier = 'sources'
appendix = 'all-nodep'
from sourceSets.compiler.allSource + sourceSets.stdlib.allSource
}
jar {
from = file('build/classes/main')
dependsOn << compileGroovy
baseName = 'groovypp'
}
task allJar(type:Jar, dependsOn:[jar]) {
appendix = 'all'
baseName = 'groovypp'
doLast {
ant.taskdef(name:'jarjar', classname: 'com.tonicsystems.jarjar.JarJarTask', classpath: '../lib/jarjar-1.0.jar')
ant.jarjar(jarfile: "build/libs/groovypp-all-${version}.jar") {
zipfileset(dir: 'build/classes/main')
rule(pattern:"org.objectweb.**", result:"groovyjarjarasm.@1")
}
}
}
task nodepAllJar(type:Jar, dependsOn:[jar]) {
appendix = 'all-nodep'
baseName = 'groovypp'
doLast {
ant.taskdef(name:'jarjar', classname: 'com.tonicsystems.jarjar.JarJarTask', classpath: '../lib/jarjar-1.0.jar')
ant.jarjar(jarfile: "build/libs/groovypp-all-nodep-${version}.jar") {
zipfileset(dir: 'build/classes/main')
rule(pattern:"org.objectweb.**", result:"groovyjarjarasm.@1")
}
}
}
task nodepJar(type:Jar, dependsOn:jar) {
appendix = 'nodep'
baseName = 'groovypp'
doLast {
ant.jar(jarfile: "build/libs/groovypp-nodep-${version}.jar") {
zipfileset(dir: 'build/classes/main')
}
}
}
artifacts {
archives sourcesJar
archives nodepSourcesJar
archives allNodepSourcesJar
archives allSourcesJar
archives jar
archives allJar
archives nodepJar
archives nodepAllJar
}
uploadArchives.doFirst {
println 'copying archives'
ant.copy(file: "build/libs/groovypp-${version}.jar", tofile:"build/libs/groovypp-nodep-${version}.jar")
}
if (project.hasProperty('ARTIFACTORY_USER') && project.hasProperty('ARTIFACTORY_PASSWORD')) {
uploadArchives {
repositories.mavenDeployer {
def repo = "http://groovypp.artifactoryonline.com/groovypp/libs-releases-local/"
if(System.getProperty("repo") == 'local')
repo = "file://" + new File(System.getProperty('user.home'), ".m2" + File.separatorChar + "repository").absolutePath
repository(url: repo) {
authentication(userName: ARTIFACTORY_USER, password: ARTIFACTORY_PASSWORD)
}
addFilter('groovypp') {artifact, file ->
!artifact.toString().contains('-all') && !artifact.toString().contains('-nodep')
}.whenConfigured { pom ->
improveDependencies pom
}
addFilter('groovypp-nodep') {artifact, file ->
!artifact.toString().contains('-all') && artifact.toString().contains('-nodep')
}.whenConfigured { pom ->
pom.dependencies = []
}
addFilter('groovypp-all-nodep') {artifact, file ->
artifact.toString().contains('-all') && artifact.toString().contains('-nodep')
}.whenConfigured { pom ->
pom.dependencies = []
}
addFilter('groovypp-all') {artifact, file ->
artifact.toString().contains('-all') && !artifact.toString().contains('-nodep')
}.whenConfigured { pom ->
pom.dependencies.each { dep ->
if(dep.artifactId == 'groovy') {
dep.artifactId = 'groovy-all'
}
}
improveDependencies pom
}
}
}
}
else {
println "Note: '$prj:uploadArchives' unavailable as properties ARTIFACTORY_USER/ARTIFACTORY_PASSWORD are not defined"
}
task installZip(dependsOn:['jar', 'allJar']) << {
ant.zip(destfile:"build/groovypp-${version}.zip",comment:"The Groovy++ binary distribution.") {
zipfileset dir:"./install", prefix=""
zipfileset file:"build/libs/groovypp-${version}.jar", prefix:"lib"
zipfileset file:"build/libs/groovypp-all-${version}.jar", prefix:"embeddable"
}
}
task deployGoogle(dependsOn:[sourcesJar, installZip]) << {
ant.taskdef(name:"gcupload", classname:"net.bluecow.googlecode.ant.GoogleCodeUploadTask", classpath:"../lib/ant-googlecode-0.0.2.jar")
ant.gcupload(username:GOOGLE_USER, password:GOOGLE_PASSWORD, projectname:"groovypptest", filename:file("build/groovypp-${version}.zip").absolutePath, targetfilename:"groovypp-${version}.zip", summary:"Groovy $groovyVer installation including Groovy++ ${version}", labels:"Featured", verbose:"true")
ant.gcupload(username:GOOGLE_USER, password:GOOGLE_PASSWORD, projectname:"groovypptest", filename:file("build/libs/groovypp-${version}.jar").absolutePath, targetfilename:"groovypp-${version}.jar", summary:"Groovy++ Jar ${version} (use with groovy-${groovyVer}+.jar)", labels:"Featured", verbose:"true")
ant.gcupload(username:GOOGLE_USER, password:GOOGLE_PASSWORD, projectname:"groovypptest", filename:file("build/libs/groovypp-all-${version}.jar").absolutePath, targetfilename:"groovypp-all-${version}.jar", summary:"Groovy++ Embeddable Jar ${version} (use with groovy-all-${groovyVer}.jar)", labels:"Featured", verbose:"true")
ant.gcupload(username:GOOGLE_USER, password:GOOGLE_PASSWORD, projectname:"groovypptest", filename:file("build/libs/groovypp-${version}-sources.jar").absolutePath, targetfilename:"groovypp-${version}-sources.jar", summary:"Groovy++ Sources Jar", labels:"Featured", verbose:"true")
}
}
}
task test(dependsOn: [':TestG17X:test', ':TestG18X:test'])
task uploadArchives(dependsOn: [':G17X:uploadArchives', ':G18X:uploadArchives'])
task compile(dependsOn: ':Compiler:compileGroovy')
task deployGoogle(dependsOn: ':G17X:deployGoogle')