Permalink
Browse files

Make sure generated code is not mixed into a "real" source directory

  • Loading branch information...
1 parent 4ac071a commit f7b582ebb9718ad56d89e4d2b8436a1c49e85277 @melix melix committed Jun 8, 2012
Showing with 14 additions and 16 deletions.
  1. +0 −12 .gitignore
  2. +14 −4 build.gradle
View
@@ -1,18 +1,6 @@
target
build
out
-src/main/org/codehaus/groovy/antlr/parser/GroovyLexer.java
-src/main/org/codehaus/groovy/antlr/parser/GroovyLexer.smap
-src/main/org/codehaus/groovy/antlr/parser/GroovyRecognizer.java
-src/main/org/codehaus/groovy/antlr/parser/GroovyRecognizer.smap
-src/main/org/codehaus/groovy/antlr/parser/GroovyTokenTypes.java
-src/main/org/codehaus/groovy/antlr/parser/GroovyTokenTypes.txt
-src/main/org/codehaus/groovy/antlr/java/JavaLexer.java
-src/main/org/codehaus/groovy/antlr/java/JavaLexer.smap
-src/main/org/codehaus/groovy/antlr/java/JavaRecognizer.java
-src/main/org/codehaus/groovy/antlr/java/JavaRecognizer.smap
-src/main/org/codehaus/groovy/antlr/java/JavaTokenTypes.java
-src/main/org/codehaus/groovy/antlr/java/JavaTokenTypes.txt
*~
.gradle
*.iml
View
@@ -219,6 +219,8 @@ dependencies {
testCompile project(':groovy-test')
}
+ext.generatedDirectory = "${buildDir}/generated-sources"
+
sourceSets {
compiler {
// This sourceSet corresponds to the minimal "bootstrap" Groovy compiler
@@ -231,6 +233,7 @@ sourceSets {
"subprojects/groovy-templates/src/main",
"subprojects/groovy-xml/src/main",
"subprojects/groovy-jmx/src/main",
+ "$generatedDirectory/src/main"
]
if (!useIndy()) {
exclude '**/indy/*'
@@ -243,6 +246,7 @@ sourceSets {
java {
srcDirs = [
"src/main",
+ "$generatedDirectory/src/main"
]
fileTree("src/main/groovy/ui").matching {
exclude 'GroovyMain.java', 'GroovySocketServer.java'
@@ -258,6 +262,7 @@ sourceSets {
groovy {
srcDirs = [
"src/main",
+ "$generatedDirectory/src/main"
]
if (!useIndy()) {
exclude '**/indy/*'
@@ -332,20 +337,25 @@ task ensureGrammars {
ext.antlrDirectory = "$projectDir/src/main/org/codehaus/groovy/antlr"
ext.groovyParserDirectory = "$ext.antlrDirectory/parser"
ext.javaParserDirectory = "$ext.antlrDirectory/java"
+ ext.genPath = "$generatedDirectory/src/main/org/codehaus/groovy/antlr"
+ ext.groovyOutDir = "$ext.genPath/parser"
+ ext.javaOutDir = "$ext.genPath/java"
inputs.dir(antlrDirectory)
- outputs.dir(groovyParserDirectory)
- outputs.dir(javaParserDirectory)
+ outputs.dir(groovyOutDir)
+ outputs.dir(javaOutDir)
doFirst {
+ new File(groovyOutDir).mkdirs()
+ new File(javaOutDir).mkdirs()
ant {
taskdef(name: 'antlr',
classname: 'org.apache.tools.ant.taskdefs.optional.ANTLR',
classpath: configurations.antlr.asPath)
mkdir dir: ext.groovyParserDirectory
- antlr(target: "$ext.antlrDirectory/groovy.g", outputdirectory: ext.groovyParserDirectory) {
+ antlr(target: "$ext.antlrDirectory/groovy.g", outputdirectory: ext.groovyOutDir) {
classpath path: configurations.compile.asPath
}
- antlr(target: "$ext.javaParserDirectory/java.g", outputdirectory: ext.javaParserDirectory) {
+ antlr(target: "$ext.javaParserDirectory/java.g", outputdirectory: ext.javaOutDir) {
classpath path: configurations.compile.asPath
}
}

0 comments on commit f7b582e

Please sign in to comment.