| import org.gradle.plugins.ide.idea.model.* |
| import org.apache.tools.ant.filters.ReplaceTokens |
| import t5build.* |
| |
| description = "Central module for Tapestry, containing all core services and components" |
| |
| project.ext { |
| antlrSource = "src/main/antlr" |
| mainGeneratedDir = "src/main/generated" |
| testGeneratedDir = "src/test/generated" |
| antlrOutput = "$mainGeneratedDir/antlr" |
| } |
| |
| configurations { |
| antlr3 |
| } |
| |
| dependencies { |
| compile project(':tapestry-ioc') |
| compile project(':tapestry-json') |
| |
| provided project(":tapestry-test") |
| provided project(":tapestry-test-constants") |
| |
| provided "javax.servlet:servlet-api:${versions.servletapi}" |
| |
| 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", { |
| exclude group: "org.antlr", module: "stringtemplate" |
| } |
| |
| // Antlr3 tool path used with the antlr3 task |
| antlr3 "org.antlr:antlr:3.3" |
| |
| 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(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(' ')}" |
| } |
| } |
| |
| task preprocessCoffeeScript(type: PreprocessCoffeeScript) { |
| } |
| |
| task compileCoffeeScript(type: CompileCoffeeScript) { |
| outputDir "${mainGeneratedDir}/compiled-coffeescript" |
| } |
| |
| task compileProcessedCoffeescript(type: CompileCoffeeScript) { |
| dependsOn preprocessCoffeeScript |
| srcDir preprocessCoffeeScript.outputDir |
| outputDir "${mainGeneratedDir}/compiled-processed-coffeescript" |
| } |
| |
| task compileTestCoffeeScript(type: CompileCoffeeScript) { |
| srcDir "src/test/coffeescript" |
| outputDir "${testGeneratedDir}/compiled-coffeescript" |
| } |
| |
| sourceSets { |
| main { |
| output.dir(compileCoffeeScript.outputDir, builtBy: compileCoffeeScript) |
| output.dir(compileProcessedCoffeescript.outputDir, builtBy: compileProcessedCoffeescript) |
| output.dir(antlrOutput, builtBy: generateGrammarSource) |
| java { |
| srcDir antlrOutput |
| } |
| } |
| test { |
| output.dir(compileTestCoffeeScript.outputDir, builtBy: compileTestCoffeeScript) |
| } |
| } |
| |
| clean.delete mainGeneratedDir, testGeneratedDir |
| |
| compileJava { |
| dependsOn generateGrammarSource |
| options.fork(memoryMaximumSize: '512m') |
| } |
| |
| // Not sure why this is necessary: |
| compileTestGroovy.dependsOn compileTestJava |
| |
| jar { |
| from("src/main/filtered-resources") { |
| filter(ReplaceTokens, tokens: [version: project.version]) |
| } |
| } |