Introduce src/gen/java for generated sources

Previously, sources generated from the serpent antlr grammar in
ethereumj-core/src/main/antlr4 were output into the build/generated-src
directory by default. This worked from the command line without issue,
but caused issues within IDEA, because the entirety of the 'build'
directory is excluded from compilation by default when working with a
Gradle-based project in IDEA.

This change simplifies the arrangement by writing these antlr-generated
sources to the src/gen/java. A .gitignore file has been added to ensure
that transient source files don't accidentally get checked in. A readme
file has been added to explain the situation to the uninitiated.
This commit is contained in:
Chris Beams 2014-12-26 17:14:39 +01:00
parent 7af08b54b5
commit 2a8ecab299
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
4 changed files with 23 additions and 6 deletions

View File

@ -26,6 +26,12 @@ Run `./gradlew build`.
- run `./gradlew run`, or
- build a standalone executable jar with `./gradlew shadow` and execute the `-all` jar in `build/libs` using `java -jar [jarfile]`.
#### Import sources into IntelliJ IDEA
Use IDEA 14 or better and import project based on Gradle sources.
Note that in order to build the project without errors in IDEA, you will need to run `gradle antlr4` manually.
#### Publish ethereumj-core builds
_TODO: integrate bintray gradle plugin_

View File

@ -15,18 +15,21 @@ version = '0.7.15-SNAPSHOT'
mainClassName = 'org.ethereum.Start'
compileJava.dependsOn antlr4
ext.generatedSrcDir = file('src/gen/java')
sourceSets.main.java.srcDirs += antlr4.output
sourceSets.main.java.srcDirs += generatedSrcDir
antlr4 {
extraArgs = ['-package', 'org.ethereum.serpent']
output = file("${generatedSrcDir}/org/ethereum/serpent")
}
compileJava.dependsOn antlr4
configurations {
compile.extendsFrom antlr4
}
antlr4 {
extraArgs=['-package', 'org.ethereum.serpent']
}
ext {
slf4jVersion = '1.7.7'
leveldbVersion = '0.7'

View File

@ -0,0 +1,3 @@
*
!.gitignore
!README.md

View File

@ -0,0 +1,5 @@
This is the output directory for transient sources generated from grammars in
the `src/main/antlr4` directory using the `gradle antlr4` task. Sources are
output here instead of the typical `build/generated-src` output directory in
order to avoid confusing IntelliJ IDEA. See the antlr plugin configuration in
`build.gradle` for details.