Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cc1d5e6

Browse files
author
Vincent Cantin
committed
Cleaned up the build script, added input and output to the antlr4 source code generation to make the build incremental.
1 parent b1048ba commit cc1d5e6

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

‎build.gradle

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,33 @@ dependencies {
1313
antlr4 'org.antlr:antlr4:4.1'
1414
}
1515

16+
ext.antlr4GeneratedSourceDir = new File(buildDir, 'generated-sources/antlr4')
17+
1618
sourceSets {
1719
main {
1820
java {
19-
srcDir newFile(buildDir, 'generated-sources/antlr4')
21+
srcDir antlr4GeneratedSourceDir
2022
}
2123
}
2224
}
2325

24-
task generateGrammarSource << {
25-
javaexec {
26-
classpath configurations.antlr4
27-
main 'org.antlr.v4.Tool'
28-
args '-o', new File(buildDir, 'generated-sources/antlr4/com/lemoulinstudio/sdiff/parser/java'),
29-
'-package', 'com.lemoulinstudio.sdiff.parser.java',
30-
new File(projectDir, 'src/main/antlr4/Java.g4')
26+
task generateGrammarSource {
27+
ext.grammarFile = new File(projectDir, 'src/main/antlr4/Java.g4')
28+
ext.outputPackage = 'com.lemoulinstudio.sdiff.java.tree.lex'
29+
ext.outputDir = new File(antlr4GeneratedSourceDir, outputPackage.replace('.' as char, File.pathSeparatorChar))
30+
31+
inputs.file grammarFile
32+
inputs.property 'outputPackage', outputPackage
33+
outputs.dir outputDir
34+
35+
doLast {
36+
javaexec {
37+
classpath configurations.antlr4
38+
main 'org.antlr.v4.Tool'
39+
args '-o', outputDir,
40+
'-package', outputPackage,
41+
grammarFile
42+
}
3143
}
3244
}
3345

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /