Debian Codegraph @

build.gradle

raw ◀ ▶
Source reconstructed at patch state 0 of 7 — not the installed (fully patched) source.
7 Debian patches touch this file
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 buildscript {
20 repositories {
21 jcenter()
22 maven {
23 name 'Bintray Asciidoctor repo'
24 url 'http://dl.bintray.com/content/aalmiray/asciidoctor'
25 }
26 maven{
27 name 'Bintray Javadoc Hotfix repo'
28 url 'http://dl.bintray.com/melix/gradle-javadoc-hotfix-plugin'
29 }
30 maven {
31 url "https://plugins.gradle.org/m2/"
32 }
33 }
34
35 dependencies {
36 classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.7'
37 classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3'
38 classpath 'me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1'
39 classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.1.1'
40 //classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
41 classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.1.3"
42 classpath 'com.gradle:build-scan-plugin:1.8'
43 classpath 'me.champeau.gradle:buildscan-recipes-plugin:0.2.0'
44 }
45 }
46
47 if (JavaVersion.current().java7Compatible) {
48 apply plugin: 'com.gradle.build-scan'
49 apply plugin: 'me.champeau.buildscan-recipes'
50
51 buildScan {
52 licenseAgreementUrl = 'https://gradle.com/terms-of-service'
53 licenseAgree = 'yes'
54 publishAlways()
55 }
56 buildScanRecipes {
57 recipe 'git-commit', baseUrl: 'https://github.com/apache/groovy/tree'
58 recipe 'teamcity', baseUrl: 'https://ci.groovy-lang.org', guest: 'true'
59 recipes 'git-status', 'teamcity', 'travis-ci'
60 }
61 }
62
63 ext.modules = {
64 subprojects.findAll{ !['performance', 'tests-vm8'].contains(it.name) }
65 }
66
67 apply from: 'gradle/filter.gradle'
68 apply from: 'gradle/indy.gradle'
69 apply from: 'gradle/publish.gradle'
70 apply plugin: 'javadocHotfix'
71
72 File javaHome = new File(System.getProperty('java.home'))
73 logger.lifecycle "Using Java from $javaHome (version ${System.getProperty('java.version')})"
74 indyBanner()
75
76 // TODO use antlr plugin
77 //apply plugin: 'antlr'
78
79 allprojects {
80 apply plugin: 'java'
81
82 buildDir = 'target'
83 sourceCompatibility = 1.6
84 targetCompatibility = 1.6
85
86 group = 'org.codehaus.groovy'
87 version = groovyVersion
88 repositories {
89 jcenter()
90 maven { url 'http://dl.bintray.com/melix/thirdparty-apache' } // openbeans
91 }
92
93 apply plugin: 'groovy'
94 apply from: "${rootProject.projectDir}/gradle/indy.gradle"
95 if (JavaVersion.current().java7Compatible) {
96 apply from: "${rootProject.projectDir}/gradle/asciidoctor.gradle"
97 }
98 }
99
100 // todo: use the conventional "resources" directory for classpath resources
101 task(copyResources, type: Copy) {
102 destinationDir = file("$buildDir/classes")
103 // text files requiring filtering
104 into('main') {
105 from('src/main')
106 include('**/*.txt', '**/*.xml', '**/*.properties', '**/*.html')
107 filter(rootProject.propertiesFilter, org.apache.tools.ant.filters.ReplaceTokens)
108 }
109 // other resources
110 into('main') {
111 from 'src/main'
112 include('**/*.png', '**/*.gif', '**/*.ico', '**/*.css')
113 }
114 }
115 compileJava.dependsOn(copyResources)
116 task(copyTestResources, type: Copy)
117 .from('src/test')
118 .into("$buildDir/classes/test")
119 .include('**/*.txt', '**/*.xml', '**/*.properties', '**/*.png', '**/*.html', '**/*.gif', '**/*.ico', '**/*.css')
120 compileTestJava.dependsOn(copyTestResources)
121
122 task sourceJar(type: Jar) {
123 classifier = 'sources'
124 from 'src/main'
125 }
126
127 subprojects {
128 task sourceJar(type: Jar) {
129 classifier = 'sources'
130 from sourceSets.main.allSource
131 }
132 }
133
134 repositories {
135 // todo Some repos are needed only for some configs. Declare them just for the configuration once Gradle allows this.
136 maven { url 'http://repository.jboss.org/nexus/content/groups/m2-release-proxy' } // examples, tools
137 }
138
139 // todo do we need compile and runtime scope for examples?
140 configurations {
141 compilerCompile
142 tools
143 examplesCompile.extendsFrom compile
144 examplesRuntime.extendsFrom examplesCompile
145 antlr
146 spec
147 }
148
149 ext {
150 antVersion = '1.9.15'
151 asmVersion = '7.2'
152 antlrVersion = '2.7.7'
153 coberturaVersion = '1.9.4.1'
154 commonsCliVersion = '1.2'
155 commonsHttpClientVersion = '3.1'
156 eclipseOsgiVersion = '3.9.1-v20140110-1610'
157 gparsVersion = '1.2.1'
158 ivyVersion = '2.4.0'
159 jansiVersion = '1.11'
160 jarjarVersion = '1.3'
161 jlineVersion = '2.12'
162 jmockVersion = '1.2.0'
163 logbackVersion = '1.1.2'
164 log4jVersion = '1.2.17'
165 log4j2Version = '2.1'
166 luceneVersion = '4.7.2'
167 openbeansVersion = '1.0'
168 openejbVersion = '1.0'
169 qdoxVersion = '1.12.1'
170 slf4jVersion = '1.7.6'
171 xmlunitVersion = '1.5'
172 xstreamVersion = '1.4.10'
173 isReleaseVersion = !groovyVersion.toLowerCase().endsWith("snapshot")
174 }
175
176 dependencies {
177 compile "antlr:antlr:$antlrVersion"
178 compile "org.ow2.asm:asm:$asmVersion"
179 compile "org.ow2.asm:asm-analysis:$asmVersion"
180 compile "org.ow2.asm:asm-commons:$asmVersion"
181 compile "org.ow2.asm:asm-tree:$asmVersion"
182 compile "org.ow2.asm:asm-util:$asmVersion"
183
184 compile "commons-cli:commons-cli:$commonsCliVersion"
185 compile "org.apache.ant:ant:$antVersion"
186 compile("com.thoughtworks.xstream:xstream:$xstreamVersion") {
187 exclude(group: 'xpp3', module: 'xpp3_min')
188 exclude(group: 'junit', module: 'junit')
189 exclude(group: 'jmock', module: 'jmock')
190 }
191 compile "com.googlecode:openbeans:$openbeansVersion"
192 compile "org.fusesource.jansi:jansi:$jansiVersion"
193 compile("org.apache.ivy:ivy:$ivyVersion") {
194 transitive = false
195 }
196 compile files("${buildDir}/generated-classes")
197
198 runtime("org.codehaus.gpars:gpars:$gparsVersion") {
199 exclude(group: 'org.codehaus.groovy', module: 'groovy-all')
200 }
201 testCompile "jmock:jmock:$jmockVersion"
202 testCompile "jmock:jmock-cglib:$jmockVersion"
203 testCompile "xmlunit:xmlunit:$xmlunitVersion"
204 testCompile "ch.qos.logback:logback-classic:$logbackVersion"
205 testCompile "log4j:log4j:$log4jVersion"
206 testCompile "org.apache.logging.log4j:log4j-core:$log4j2Version"
207 testCompile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
208 testCompile "com.thoughtworks.qdox:qdox:$qdoxVersion"
209
210 tools "com.googlecode.jarjar:jarjar:$jarjarVersion"
211 tools("net.sourceforge.cobertura:cobertura:$coberturaVersion") {
212 exclude(module: 'asm')
213 exclude(module: 'asm')
214 exclude(module: 'ant')
215 }
216 tools "org.ow2.asm:asm:$asmVersion"
217 tools "com.thoughtworks.qdox:qdox:$qdoxVersion"
218
219 examplesCompile project(':groovy-test')
220 examplesCompile project(':groovy-swing')
221 examplesCompile "org.apache.lucene:lucene-core:$luceneVersion"
222 examplesCompile "org.apache.lucene:lucene-analyzers-common:$luceneVersion"
223 examplesCompile "org.apache.lucene:lucene-queryparser:$luceneVersion"
224 examplesCompile "org.eclipse:osgi:$eclipseOsgiVersion"
225 examplesRuntime("commons-httpclient:commons-httpclient:$commonsHttpClientVersion") {
226 exclude(module: 'junit')
227 exclude(module: 'commons-logging')
228 exclude(module: 'commons-codec')
229 }
230 examplesRuntime("openejb:openejb-loader:$openejbVersion") {
231 exclude(module: 'log4j')
232 exclude(module: 'openejb-core')
233 exclude(module: 'geronimo-jta_1.0.1B_spec')
234 exclude(module: 'geronimo-servlet_2.4_spec')
235 exclude(module: 'geronimo-ejb_2.1_spec')
236 exclude(module: 'geronimo-j2ee-connector_1.5_spec')
237 }
238
239 // TODO use antlr plugin
240 // antlr "antlr:antlr:$antlrVersion"
241 antlr "org.apache.ant:ant-antlr:$antVersion"
242
243 testCompile project(':groovy-ant')
244 testCompile project(':groovy-test')
245 }
246
247 ext.generatedDirectory = "${buildDir}/generated-sources"
248
249 sourceSets {
250 main {
251 java {
252 srcDirs = [
253 'src/main',
254 "$generatedDirectory/src/main"
255 ]
256 fileTree('src/main/groovy/ui').matching {
257 exclude 'GroovyMain.java', 'GroovySocketServer.java'
258 }.visit { details ->
259 exclude "groovy/ui/$details.path"
260 }
261 if (!JavaVersion.current().isJava7Compatible()) {
262 exclude '**/indy/*'
263 exclude '**/v7/*'
264 exclude '**/v8/*'
265 exclude '**/vm7/*'
266 }
267 }
268 groovy {
269 srcDirs = [
270 'src/main',
271 "$generatedDirectory/src/main"
272 ]
273 if (!JavaVersion.current().isJava7Compatible()) {
274 exclude '**/indy/*'
275 exclude '**/v7/*'
276 exclude '**/v8/*'
277 exclude '**/vm7/*'
278 }
279 }
280 resources {
281 srcDirs = ['src/main', 'src/resources']
282 include 'META-INF/services/*',
283 'META-INF/groovy-release-info.properties',
284 'groovy/grape/*.xml'
285 }
286 }
287 test {
288 groovy {
289 srcDirs = ['src/test']
290 }
291 resources {
292 srcDirs = ['src/test-resources']
293 }
294 }
295 tools {
296 compileClasspath = sourceSets.main.runtimeClasspath + configurations.tools
297 runtimeClasspath = output + compileClasspath
298 }
299 examples {
300 groovy {
301 srcDirs = ['src/examples']
302 }
303 resources {
304 srcDirs = ['src/examples']
305 }
306 compileClasspath = configurations.examplesRuntime + sourceSets.main.output + project(':groovy-xml').sourceSets.main.output
307 }
308 }
309
310 // make sure examples can be compiled, even if we don't run them
311 // todo: reorganize examples so that we can run them too
312 check {
313 dependsOn examplesClasses
314 }
315
316 // remove this from config once GRADLE-854 is fixed.
317 processResources.doLast {
318 copy {
319 from('src/main') {
320 include 'groovy/inspect/swingui/AstBrowserProperties.groovy',
321 'org/codehaus/groovy/tools/groovydoc/gstringTemplates/GroovyDocTemplateInfo.java'
322 }
323 into sourceSets.main.output.classesDir
324 }
325 }
326
327 task ensureGrammars {
328 description = 'Ensure all the Antlr generated files are up to date.'
329 ext.antlrDirectory = "$projectDir/src/main/org/codehaus/groovy/antlr"
330 ext.groovyParserDirectory = "$ext.antlrDirectory/parser"
331 ext.javaParserDirectory = "$ext.antlrDirectory/java"
332 ext.genPath = "$generatedDirectory/src/main/org/codehaus/groovy/antlr"
333 ext.groovyOutDir = "$ext.genPath/parser"
334 ext.javaOutDir = "$ext.genPath/java"
335 inputs.dir(antlrDirectory)
336 outputs.dir(groovyOutDir)
337 outputs.dir(javaOutDir)
338 doFirst {
339 new File(groovyOutDir).mkdirs()
340 new File(javaOutDir).mkdirs()
341 ant {
342 taskdef(name: 'antlr',
343 classname: 'org.apache.tools.ant.taskdefs.optional.ANTLR',
344 classpath: configurations.antlr.asPath)
345
346 mkdir dir: ext.groovyParserDirectory
347 antlr(target: "$ext.antlrDirectory/groovy.g", outputdirectory: ext.groovyOutDir) {
348 classpath path: configurations.compile.asPath
349 }
350 antlr(target: "$ext.javaParserDirectory/java.g", outputdirectory: ext.javaOutDir) {
351 classpath path: configurations.compile.asPath
352 }
353 }
354 }
355 }
356
357 apply from: 'gradle/utils.gradle'
358 apply from: 'wrapper.gradle'
359
360 task dgmConverter(dependsOn:compileJava) {
361 description = 'Generates DGM info file required for faster startup.'
362 def classesDir = sourceSets.main.output.classesDir
363 def classpath = files(classesDir, configurations.compile).asPath
364
365 //main = 'org.codehaus.groovy.tools.DgmConverter'
366 //args = ['--info', classesDir.absolutePath]
367 doFirst {
368 file("$classesDir/META-INF").mkdirs()
369 // we use ant.java because Gradle is a bit "too smart" with JavaExec
370 // as it will invalidate the task if classpath changes, which will
371 // happen once Groovy files are compiled
372 ant.java(classname:'org.codehaus.groovy.tools.DgmConverter', classpath: classpath) {
373 arg(value: '--info')
374 arg(value: classesDir.absolutePath)
375 }
376 }
377 inputs.files fileTree('src').include('**/*GroovyMethods.java')
378 outputs.file file("${classesDir}/META-INF/dgminfo")
379 }
380
381 compileJava {
382 dependsOn ensureGrammars, exceptionUtils
383 options.fork(memoryMaximumSize: javacMain_mx)
384 }
385
386 // Gradle classloading magic with Groovy will only work if it finds a *jar*
387 // on classpath. This "bootstrap jar" contains the minimal compiler, without .groovy compiled files
388
389 task bootstrapJar {
390 dependsOn compileJava, dgmConverter
391
392 def destinationDir = file("$buildDir/bootstrap")
393 def archiveName = "groovy-${version}-bootstrap.jar"
394 ext.archivePath = file("$destinationDir/$archiveName")
395
396 doLast {
397 // we use ant.jar because Gradle is a bit "too smart" with JavaExec
398 // as it will invalidate the task if classpath changes, which will
399 // happen once Groovy files are compiled
400 destinationDir.mkdirs()
401 ant.jar(
402 destfile: archivePath,
403 basedir: file(sourceSets.main.output.classesDir)
404 )
405 }
406 inputs.property('indy', useIndy())
407 inputs.files sourceSets.main.allJava
408 outputs.file archivePath
409 }
410
411 compileGroovy.dependsOn bootstrapJar
412
413 allprojects {
414
415 tasks.withType(JavaCompile) {
416 options.encoding = 'UTF-8'
417 }
418
419 tasks.withType(GroovyCompile) {
420 groovyOptions.fork(memoryMaximumSize: groovycMain_mx)
421 groovyOptions.encoding = 'UTF-8'
422 groovyClasspath = files(
423 rootProject.compileJava.classpath,
424 rootProject.bootstrapJar.archivePath
425 )
426
427 classpath = classpath + groovyClasspath
428 }
429
430 if (useIndy()) {
431 tasks.withType(GroovyCompile) {
432 logger.info("Building ${project.name}:${name} with InvokeDynamic support activated")
433 groovyOptions.optimizationOptions.indy = true
434 sourceCompatibility = 1.7
435 targetCompatibility = 1.7
436 }
437 tasks.withType(JavaCompile) {
438 sourceCompatibility = 1.7
439 targetCompatibility = 1.7
440 }
441 jar {
442 classifier = 'indy'
443 }
444 }
445 }
446
447 compileTestGroovy {
448 groovyOptions.fork(memoryMaximumSize: groovycTest_mx)
449 }
450
451 // TODO superfluous to check for JDK7 for Gradle version 3.2+ but leave for future?
452 task checkCompatibility {
453 doLast {
454 assert JavaVersion.current().java7Compatible
455 }
456 }
457
458 if (!JavaVersion.current().java7Compatible) {
459 logger.lifecycle '''
460 **************************************** WARNING ********************************************
461 ****** You are running the build with an older JDK. NEVER try to release with 1.6. ******
462 ****** You must use a JDK 1.7+ in order to compile all features of the language. ******
463 *********************************************************************************************
464 '''
465 }
466
467 apply from: 'gradle/test.gradle'
468 apply from: 'gradle/groovydoc.gradle'
469 apply from: 'gradle/docs.gradle'
470 apply from: 'gradle/assemble.gradle'
471 apply from: 'gradle/upload.gradle'
472 apply from: 'gradle/idea.gradle'
473 apply from: 'gradle/eclipse.gradle'
474 apply from: 'gradle/codehaus.gradle'
475 apply from: 'gradle/quality.gradle'
476
477 // If a local configuration file for tweaking the build is present, apply it
478 if (file('user.gradle').exists()) {
479 apply from: 'user.gradle'
480 }
481
482 apply from: 'gradle/signing.gradle'
483
484 // UNCOMMENT THE FOLLOWING TASKS IF YOU WANT TO RUN LICENSE CHECKING
485 //task licenseFormatCustom(type:nl.javadude.gradle.plugins.license.License) {
486 // source = fileTree(dir:"src").include ("**/*.java",'**/*.groovy','**.html','**.css','**.xml','**/*.properties','**/*.properties')
487 //}
488 //
489 //task licenseFormatGradle(type:nl.javadude.gradle.plugins.license.License) {
490 // source = files(fileTree(dir:'.').include('**/*.gradle'),fileTree('buildSrc').include('**/*.groovy'))
491 // mapping('gradle','JAVADOC_STYLE')
492 //}
493 //
494 //licenseFormat.dependsOn licenseFormatCustom
495 //licenseFormat.dependsOn licenseFormatGradle