You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2012/01/24 01:59:24 UTC

svn commit: r1235101 - /tapestry/tapestry5/trunk/tapestry-core/build.gradle

Author: hlship
Date: Tue Jan 24 00:59:24 2012
New Revision: 1235101

URL: http://svn.apache.org/viewvc?rev=1235101&view=rev
Log:
Optimize the Antlr3 logic in the tapestry-core build

Modified:
    tapestry/tapestry5/trunk/tapestry-core/build.gradle

Modified: tapestry/tapestry5/trunk/tapestry-core/build.gradle
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/build.gradle?rev=1235101&r1=1235100&r2=1235101&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/build.gradle (original)
+++ tapestry/tapestry5/trunk/tapestry-core/build.gradle Tue Jan 24 00:59:24 2012
@@ -6,59 +6,58 @@ antlrSource = "src/main/antlr"
 antlrOutput = "$buildDir/generated-sources/antlr"
 
 configurations {
-    antlr3
+  antlr3
 }
 
 sourceSets.main.java.srcDir antlrOutput
 
 dependencies {
-    compile project(':tapestry-ioc')
-    compile project(':tapestry-json')
+  compile project(':tapestry-ioc')
+  compile project(':tapestry-json')
 
-    provided project(":tapestry-test")
-    provided "javax.servlet:servlet-api:$servletAPIVersion"
+  provided project(":tapestry-test")
+  provided "javax.servlet:servlet-api:$servletAPIVersion"
 
-    compile "commons-codec:commons-codec:1.5"
+  compile "commons-codec:commons-codec:1.5"
 
-    // Transitive will bring in the unwanted string template library as well
-    compile "org.antlr:antlr-runtime:3.3", { transitive = false }
+  // Transitive will bring in the unwanted string template library as well
+  compile "org.antlr:antlr-runtime:3.3", { transitive = false }
 
-    // Antlr3 tool path used with the antlr3 task
-    antlr3 "org.antlr:antlr:3.3"
+  // Antlr3 tool path used with the antlr3 task
+  antlr3 "org.antlr:antlr:3.3"
 
-    testRuntime "org.hsqldb:hsqldb:1.8.0.10"
+  testRuntime "org.hsqldb:hsqldb:1.8.0.10"
 }
 
 // This may spin out as a plugin once we've got the details down pat
 
-task generateGrammarSource {
-    description = "Generates Java sources from Antlr3 grammars."
-    inputs.dir file(antlrSource)
-    outputs.dir file(antlrOutput)
-} << {
-    mkdir(antlrOutput)
-
-    // Might have a problem here if the current directory has a space in its name
-
-    def grammars = fileTree(antlrSource).include("**/*.g")
-
-    ant.java(classname: 'org.antlr.Tool', fork: true, classpath: "${configurations.antlr3.asPath}") {
-        arg(line: "-o ${antlrOutput}/org/apache/tapestry5/internal/antlr")
-        arg(line: grammars.files.join(" "))
-    }
+task generateGrammarSource(type: JavaExec) {
+  description "Generates Java sources from Antlr3 grammars."
+  inputs.source fileTree(dir: antlrSource, include: "**/*.g")
+  outputs.dir file(antlrOutput)
+
+  classpath configurations.antlr3
+
+  main "org.antlr.Tool"
+  args "-o", "${antlrOutput}/org/apache/tapestry5/internal/antlr"
+  args inputs.sourceFiles
+
+  doFirst {
+    logger.info "Executing Antlr3 grammar generation:\n${commandLine.join(' ')}"
+  }
 }
 
 ideaModule.dependsOn generateGrammarSource
 
 ideaModule.doFirst {
 
-    excludeDirs -= buildDir
+  excludeDirs -= buildDir
 
-    def generatedDir = file("$buildDir/generated-sources")
+  def generatedDir = file("$buildDir/generated-sources")
 
-    def buildMinusGeneratedDir = (buildDir.listFiles() - generatedDir) as Set<File>
+  def buildMinusGeneratedDir = (buildDir.listFiles() - generatedDir) as Set<File>
 
-    excludeDirs += buildMinusGeneratedDir
+  excludeDirs += buildMinusGeneratedDir
 }
 
 compileJava.options.fork(memoryMaximumSize: '512m')
@@ -68,7 +67,7 @@ compileJava.dependsOn generateGrammarSou
 compileTestGroovy.dependsOn compileTestJava
 
 jar {
-    from("src/main/filtered-resources") {
-        filter(ReplaceTokens, tokens: [version: project.version])
-    }
+  from("src/main/filtered-resources") {
+    filter(ReplaceTokens, tokens: [version: project.version])
+  }
 }