Permalink
Browse files

First pass at the new Gradle build for Groovy, courtesy of Hans Dokter

git-svn-id: http://svn.codehaus.org/groovy/trunk/groovy/groovy-core@19858 a5544e8c-8a19-0410-ba12-f9af4593a198
  • Loading branch information...
glaforge committed Apr 13, 2010
1 parent b899619 commit 527c8a44cd32efa8e8c856c6bf9ebdced69ebaad
Showing with 1,637 additions and 102 deletions.
  1. +239 −102 build.gradle
  2. +20 −0 gradle.properties
  3. +293 −0 gradle/assemble.gradle
  4. +64 −0 gradle/docs.gradle
  5. +528 −0 gradle/pomconfigurer.gradle
  6. +87 −0 gradle/test.gradle
  7. +117 −0 gradle/upload.gradle
  8. +9 −0 gradle/wrapper/gradle-wrapper.properties
  9. +142 −0 gradlew
  10. +126 −0 gradlew.bat
  11. +12 −0 security/groovy.policy
View
@@ -1,113 +1,250 @@
-// -*- mode: groovy; coding: utf-8; -*-
-
-// Gradle build script for Groovy.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
-// compliance with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software distributed under the License is
-// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-// implied. See the License for the specific language governing permissions and limitations under the License.
-//
-// This work is copyright by the author(s) and is part of a greater work collectively copyright by Codehaus on
-// behalf of the Groovy community. See the NOTICE.txt file distributed with this work for additional information.
-//
-// Author : Russel Winder <russel.winder@concertant.com>
-
-// Assumes Gradle 0.9 is being used.
-
-usePlugin ( 'groovy' )
-
-version = '1.8.0-beta-1-SNAPSHOT'
-sourceCompatibility = 5
-targetCompatibility = 5
-
-//usePlugin ( 'maven' )
-//group = 'org.codehaus.groovy'
+apply plugin: 'groovy'
+
+group = 'org.codehaus.groovy'
+version = groovyVersion
+
+sourceCompatibility = 1.5
+targetCompatibility = 1.5
+
+buildDirName = 'target'
repositories {
- mavenCentral ( )
- mavenRepo ( urls : 'http://jansi.fusesource.org/repo/release' )
+ // todo Some repos are needed only for some configs. Declare them just for the configuration once Gradle allows this.
+ mavenRepo urls: ["http://repo1.maven.org/maven2"] // default, tools
+ mavenRepo urls: ["http://www.aQute.biz/repo"] // examples
+ mavenRepo urls: ["http://repository.jboss.org/maven2"] // examples, tools
+}
+
+// todo do we need compile and runtime scope for examples?
+configurations {
+ tools
+ examplesCompile.extendsFrom compile
+ examplesRuntime.extendsFrom examplesCompile
+ antlr
}
dependencies {
- groovy ( files ( compileJava.destinationDir ) )
- compile ( [
- // Core dependencies.
- 'antlr:antlr:2.7.7' ,
- 'asm:asm:3.2' ,
- 'junit:junit:4.7' ,
- // For CliBuilder
- 'commons-cli:commons-cli:1.2' ,
- // For AntBuilder
- 'org.apache.ant:ant:1.7.1' ,
- // For testing helper classes
- 'asm:asm-commons:3.2' ,
- 'asm:asm-util:3.2' ,
- 'asm:asm-analysis:3.2' ,
- 'asm:asm-tree:3.2' ,
- // For the BSF adaptor
- 'bsf:bsf:2.4.0' ,
- // For servelet / GSP
- 'javax.servlet:servlet-api:2.4' ,
- 'javax.servlet:jsp-api:2.0' ,
- // Used for dumping out the AST.
- 'com.thoughtworks.xstream:xstream:1.3.1' ,
- // For Groovysh
- 'jline:jline:0.9.94' ,
- // For Grapes (@Grabe, etc.)
- 'org.apache.ivy:ivy:2.1.0' ,
- // For the Windwos command line prettification.
- 'org.fusesource.jansi:jansi:1.1' ,
- ] )
- testRuntime ( [
- //'asm:asm-attrs:3.2' ,
- // For testing helper classes
- 'jmock:jmock:1.2.0' ,
- 'jmock:jmock-clib:1.2.0' ,
- // For the BSF adaptor
- 'xmlunit:xmlunit:1.3' ,
- // For the SQL library
- 'hsqldb:hsqldb:1.8.0.10' ,
- ] )
- runtime ( [
- // Used by optional features.
- // For AntBuilder
- 'org.apache.ant:ant-junit:1.7.1' ,
- 'org.apache.ant:ant-launcher:1.7.1' ,
- // For BSF adaptor
- 'commons-logging:commons-logging:1.1.1' ,
- ] )
-
- // How to specify the provided dependency of org.livetribe:livetribe-jsr223:2.0.6
+// groovy files('/home/hd/tmp/groovy-all.jar') // files(sourceSets.main.classesDir)
+ groovy files("$buildDir/classes")
+ groovy "asm:asm:3.2"
+ groovy "antlr:antlr:2.7.7"
+ groovy "asm:asm-commons:3.2"
+ groovy "asm:asm-util:3.2"
+ groovy "asm:asm-analysis:3.2"
+ groovy "asm:asm-tree:3.2"
+
+ compile("bsf:bsf:2.4.0") {
+ exclude(group: 'commons-logging', module: 'commons-logging')
+ }
+ compile "junit:junit:4.8.1"
+ compile "commons-cli:commons-cli:1.2"
+ compile "org.apache.ant:ant:1.8.0"
+ compile "javax.servlet:servlet-api:2.4"
+ compile "javax.servlet:jsp-api:2.0"
+ compile("com.thoughtworks.xstream:xstream:1.3.1") {
+ exclude(group: 'xpp3', module: 'xpp3_min')
+ }
+ compile("jline:jline:0.9.94") {
+ exclude(group: 'junit', module: 'junit')
+ }
+ compile "org.fusesource.jansi:jansi:1.2.1"
+ compile("org.apache.ivy:ivy:2.1.0") {
+ transitive = false
+ }
+ runtime "org.apache.ant:ant-junit:1.8.0"
+ runtime "org.apache.ant:ant-launcher:1.8.0"
+ runtime("org.apache.ant:ant-trax:1.8.0") {
+ exclude(group: 'xerces', module: 'xercesImpl')
+ exclude(group: 'xml-apis', module: 'xml-apis')
+ exclude(group: 'xalan', module: 'xalan')
+ exclude(group: 'org.apache.ant', module: 'ant-nodeps')
+ }
+ runtime "org.apache.ant:ant-antlr:1.8.0"
+ runtime("commons-logging:commons-logging:1.1.1") {
+ exclude(group: 'log4j', module: 'log4j')
+ exclude(group: 'logkit', module: 'logkit')
+ exclude(group: 'avalon-framework', module: 'avalon-framework')
+ }
+ testCompile "jmock:jmock:1.2.0"
+ testCompile "jmock:jmock-cglib:1.2.0"
+ testCompile "xmlunit:xmlunit:1.3"
+ testCompile "hsqldb:hsqldb:1.8.0.10"
+
+ // todo this was provided
+ compile "org.livetribe:livetribe-jsr223:2.0.6"
+
+ tools "com.google.code:jarjar:1.0"
+ tools("checkstyle:checkstyle:4.4") {
+ exclude(module: 'junit')
+ }
+ tools "redhill:simian:2.2.4"
+ tools("net.sourceforge.cobertura:cobertura:1.9.3") {
+ exclude(module: 'asm')
+ exclude(module: 'asm')
+ exclude(module: 'ant')
+ }
+ tools "asm:asm:3.2"
+ tools "com.thoughtworks.qdox:qdox:1.10"
+ tools "biz.aQute:bnd:0.0.388"
+
+ examplesCompile "lucene:lucene:1.4.3"
+ examplesCompile "org.eclipse:osgi:3.4.3.R34x_v20081215-1030"
+ examplesRuntime("commons-httpclient:commons-httpclient:3.0.1") {
+ exclude(module: 'junit')
+ exclude(module: 'commons-logging')
+ exclude(module: 'commons-codec')
+ }
+ examplesRuntime("openejb:openejb-loader:1.0") {
+ exclude(module: 'log4j')
+ exclude(module: 'openejb-core')
+ exclude(module: 'geronimo-jta_1.0.1B_spec')
+ exclude(module: 'geronimo-servlet_2.4_spec')
+ exclude(module: 'geronimo-ejb_2.1_spec')
+ exclude(module: 'geronimo-j2ee-connector_1.5_spec')
+ }
+
+ antlr "org.apache.ant:ant-antlr:1.8.0"
}
sourceSets {
- main {
- java {
- srcDir ( 'src/main' )
- // These Java classes depend on Groovy classes and so cannot be compiled at this time.
- exclude ( [
- 'groovy/ui/ConsoleTextEditor.java' ,
- 'groovy/ui/text/TextEditor.java' ,
- ] )
- }
- groovy {
- srcDir ( 'src/main' )
- }
- }
- test {
- java {
- srcDir ( 'src/test' )
- }
- groovy {
- srcDir ( 'src/test' )
- }
- }
+ main {
+ java {
+ srcDirs = ["$projectDir/src/main"]
+ fileTree("$projectDir/src/main/groovy/ui").matching {
+ exclude 'GroovyMain.java', 'GroovySocketServer.java'
+ }.visit {details ->
+ exclude "groovy/ui/$details.path"
+ }
+ }
+ groovy {
+ srcDirs = ["$projectDir/src/main"]
+ }
+ resources {
+ srcDirs = ["$projectDir/src/main", "$projectDir/src/tools"]
+ include "META-INF/services/*", "META-INF/groovy-release-info.properties",
+ "groovy/grape/*.xml", "groovy/ui/*.properties", "groovy/ui/**/*.png",
+ "groovy/inspect/swingui/AstBrowserProperties.groovy",
+ "org/codehaus/groovy/tools/shell/**/*.properties",
+ "org/codehaus/groovy/tools/shell/**/*.xml",
+ "org/codehaus/groovy/antlib.xml",
+ "org/codehaus/groovy/tools/groovydoc/gstringTemplates/**/*.*",
+ "org/codehaus/groovy/tools/groovy.ico"
+ }
+ classesDir = "$buildDir/classes" as File
+ }
+ test {
+ groovy {
+ srcDirs = ["$projectDir/src/test"]
+ if (!isJava16()) {
+ exclude "groovy/**/vm6/*Test.groovy"
+ }
+ }
+ classesDir = "$buildDir/test-classes" as File
+ }
+ tools {
+ groovy {
+ srcDirs = ["$projectDir/src/tools"]
+ }
+ resources {
+ srcDirs = ["$projectDir/src/tools"]
+ }
+ compileClasspath = configurations.tools + sourceSets.main.runtimeClasspath
+ runtimeClasspath = classes + compileClasspath
+ classesDir = "$buildDir/tools-classes" as File
+ }
+ examples {
+ groovy {
+ srcDirs = ["$projectDir/src/examples"]
+ }
+ resources {
+ srcDirs = ["$projectDir/src/examples"]
+ }
+ compileClasspath = configurations.examplesRuntime + sourceSets.main.classes
+ classesDir = "$buildDir/examples-classes" as File
+ }
+}
+
+// remove this from config once GRADLE-854 is fixed.
+processResources.doLast {
+ copy {
+ from("$projectDir/src/main") {
+ include "groovy/inspect/swingui/AstBrowserProperties.groovy",
+ "org/codehaus/groovy/tools/groovydoc/gstringTemplates/GroovyDocTemplateInfo.java"
+ }
+ into sourceSets.main.classesDir
+ }
}
-test {
- include ( '**/*Test.class' )
+task ensureGrammars {
+ description = "Ensure all the Antlr generated files are up to date."
+ antlrDirectory = "$projectDir/src/main/org/codehaus/groovy/antlr"
+ groovyParserDirectory = "$antlrDirectory/parser"
+ javaParserDirectory = "$antlrDirectory/java"
+ doFirst {
+ ant {
+ taskdef(name: 'antlr',
+ classname: 'org.apache.tools.ant.taskdefs.optional.ANTLR',
+ classpath: configurations.antlr.asPath)
+
+ mkdir dir: groovyParserDirectory
+ antlr(target: "$antlrDirectory/groovy.g", outputdirectory: groovyParserDirectory) {
+ classpath path: configurations.compile.asPath
+ }
+ antlr(target: "$javaParserDirectory/java.g", outputdirectory: javaParserDirectory) {
+ classpath path: configurations.compile.asPath
+ }
+ }
+ }
+}
+
+compileJava {
+ dependsOn ensureGrammars
+ doLast {
+ mkdir "$sourceSets.main.classesDir/META-INF"
+ ant {
+ java(classname: "org.codehaus.groovy.tools.DgmConverter",
+ fork: "true",
+ failonerror: "true",
+ outputproperty: 'outy',
+ errorproperty: 'errr',
+ classpath: sourceSets.main.runtimeClasspath.asPath)
+ }
+// println "Out: " + ant.properties.outy
+// println "Err: " + ant.properties.errr
+ }
}
+
+
+compileGroovy {
+ groovyOptions.fork(memoryMaximumSize: groovycMain_mx)
+}
+
+compileTestGroovy {
+ groovyOptions.fork(memoryMaximumSize: groovycTest_mx)
+}
+
+compileExamplesGroovy {
+ groovyOptions.fork(memoryMaximumSize: groovycExamples_mx)
+}
+
+def isJava16() {
+ System.properties['java.version'].contains('1.6')
+}
+
+// provide to other build scripts
+isJava6 = this.&isJava16()
+
+apply from: "$projectDir/gradle/test.gradle"
+apply from: "$projectDir/gradle/docs.gradle"
+apply from: "$projectDir/gradle/assemble.gradle"
+apply from: "$projectDir/gradle/upload.gradle"
+
+task wrapper(type: Wrapper) {
+ jarPath = 'gradle/wrapper'
+ gradleVersion = '0.9-20100330132924+0200'
+}
+
+
+
+
+
View
@@ -0,0 +1,20 @@
+groovyVersion = 1.8.0-beta-1-SNAPSHOT
+# bundle version format: major('.'minor('.'micro('.'qualifier)?)?)? (first 3 only digits)
+groovyBundleVersion = 1.8.0.beta-1-SNAPSHOT
+
+# Many people have reported problems testing UberTestCaseGroovySourceSubPackages, others have no difficulties with the default
+# values ant junit task uses. The decision has been taken to provide the values to try and cause the least
+# hassle to the most people.
+
+groovyJUnit_ms = 256m
+groovyJUnit_mx = 1000m
+groovyJUnit_permSize = 64m
+groovyJUnit_maxPermSize=128m
+
+groovycMain_mx = 384m
+groovycTest_mx = 640m
+groovycExamples_mx = 384m
+
+javaDoc_mx = 512m
+# This property seems not to make such sense as the Groovydoc Ant task does not allow for setting it.
+groovyDoc_mx = 600m
Oops, something went wrong.

0 comments on commit 527c8a4

Please sign in to comment.