| description="Central module for Tapestry, containing all core services and components" |
| |
| antlrSource = "src/main/antlr" |
| antlrOutput = "$buildDir/generated-sources/antlr" |
| |
| configurations { |
| antlr3 |
| } |
| |
| sourceSets.main.java.srcDir antlrOutput |
| |
| dependencies { |
| compile project(':tapestry-ioc') |
| compile project(':tapestry-json') |
| |
| provided project(":tapestry-test") |
| provided "javax.servlet:servlet-api:$servletAPIVersion" |
| |
| compile "commons-codec:commons-codec:1.3" |
| |
| // 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" |
| } |
| |
| // 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 generateProjectProperties(dependsOn: compileJava) { |
| description = "Generates META-INF/gradle/org.apache.tapestry/tapestry-core/project.properties similar to Maven's pom.properties." |
| def outputDir = new File("$processResources.destinationDir/META-INF/gradle/org.apache.tapestry/tapestry-core") |
| def outputFile = new File(outputDir, 'project.properties') |
| |
| outputs.dir outputDir |
| |
| doLast { |
| outputDir.mkdirs() |
| outputFile << "version=${version}"; |
| println "Generating $outputFile" |
| } |
| |
| } |
| |
| compileJava.options.fork(memoryMaximumSize: '512m') |
| compileJava.dependsOn generateGrammarSource |
| |
| // Not sure why this is necessary: |
| compileTestGroovy.dependsOn compileTestJava |
| |
| jar.dependsOn generateProjectProperties |