forked from gmai2006/grammar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·201 lines (160 loc) · 7.33 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
apply plugin: 'java'
project.version = '1.0'
compileJava.options.encoding = 'UTF-8'
repositories {
mavenCentral()
flatDir { dirs "./" }
}
dependencies {
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
implementation("com.google.guava:guava:30.1-jre")
implementation group: 'com.typesafe', name: 'config', version: '1.2.1'
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
implementation group: 'org.antlr', name: 'antlr4', version: '4.9.2'
implementation group: 'org.antlr', name: 'ST4', version: '4.3.1'
testImplementation "junit:junit:4.+"
testImplementation group: 'org.antlr', name: 'antlr4', version: '4.9.2'
testImplementation group: 'org.antlr', name: 'ST4', version: '4.3.1'
}
test {
filter {
exclude '**/*IT*'
exclude '**/*It*'
}
}
task IntegrationTest( type: Test ) {
include '**/*IT*'
include '**/*It*'
}
task generatePbDwLexer(type: JavaExec) {
def grammarFile = "./src/main/java/com/datascience9/pb/datawindow/parse/PowerBuilderDWLexer.g4"
def packageName = "com.datascience9.pb.datawindow.parse"
def outputDir = "./"
println 'input args: grammar file ' + grammarFile + ': packageName ' + packageName + ' : outputDir ' + outputDir
classpath sourceSets.main.runtimeClasspath
main = "org.antlr.v4.Tool"
args grammarFile, "-visitor", "-package", packageName, "-o", outputDir
}
task generatePbDwParser(type: JavaExec) {
def grammarFile = "./src/main/java/com/datascience9/pb/datawindow/parse/PowerBuilderDWParser.g4"
def packageName = "com.datascience9.pb.datawindow.parse"
def outputDir = "./"
println 'input args: grammar file ' + grammarFile + ': packageName ' + packageName + ' : outputDir ' + outputDir
classpath sourceSets.main.runtimeClasspath
main = "org.antlr.v4.Tool"
args grammarFile, "-visitor", "-package", packageName, "-o", outputDir
}
task generatePbDw() {
dependsOn generatePbDwLexer, generatePbDwParser
println 'Generate both lexer and parser successsfully'
}
task generatePbLexer(type: JavaExec) {
def grammarFile = "./src/main/java/com/datascience9/pb/parse/PowerBuilderLexer.g4"
def packageName = "com.datascience9.pb.parse"
def outputDir = "./"
println 'input args: grammar file ' + grammarFile + ': packageName ' + packageName + ' : outputDir ' + outputDir
classpath sourceSets.main.runtimeClasspath
main = "org.antlr.v4.Tool"
args grammarFile, "-visitor", "-package", packageName, "-o", outputDir
}
task generatePbParser(type: JavaExec) {
def grammarFile = "./src/main/java/com/datascience9/pb/parse/PowerBuilderParser.g4"
def packageName = "com.datascience9.pb.parse"
def outputDir = "./"
println 'input args: grammar file ' + grammarFile + ': packageName ' + packageName + ' : outputDir ' + outputDir
classpath sourceSets.main.runtimeClasspath
main = "org.antlr.v4.Tool"
args grammarFile, "-visitor", "-package", packageName, "-o", outputDir
}
task generatePbWithCommentLexer(type: JavaExec) {
def grammarFile = "./src/main/java/com/datascience9/pb/parse/PowerBuilderWithCommentLexer.g4"
def packageName = "com.datascience9.pb.parse"
def outputDir = "./"
println 'input args: grammar file ' + grammarFile + ': packageName ' + packageName + ' : outputDir ' + outputDir
classpath sourceSets.main.runtimeClasspath
main = "org.antlr.v4.Tool"
args grammarFile, "-visitor", "-package", packageName, "-o", outputDir
}
task generatePbWithCommentParser(type: JavaExec) {
def grammarFile = "./src/main/java/com/datascience9/pb/parse/PowerBuilderWithCommentParser.g4"
def packageName = "com.datascience9.pb.parse"
def outputDir = "./"
println 'input args: grammar file ' + grammarFile + ': packageName ' + packageName + ' : outputDir ' + outputDir
classpath sourceSets.main.runtimeClasspath
main = "org.antlr.v4.Tool"
args grammarFile, "-visitor", "-package", packageName, "-o", outputDir
}
task generatePb() {
dependsOn generatePbLexer, generatePbParser
println 'Generate both lexer and parser successsfully'
}
task testBb(type: JavaExec) {
println 'Start integration test of PB'
classpath sourceSets.main.runtimeClasspath
main = "com.datascience9.pb.parse.ParserTestIt"
}
task testBbWithComments(type: JavaExec) {
println 'Start integration test for PB with comments'
classpath sourceSets.main.runtimeClasspath
main = "com.datascience9.pb.parse.ParserWithCommentTestIt"
}
task generatePbWithComment() {
dependsOn generatePbWithCommentLexer, generatePbWithCommentParser
println 'Generate both lexer and parser successsfully'
}
task generateMySqlLexer(type: JavaExec) {
def grammarFile = "./src/main/java/com/datascience9/mysql/parse/MySqlLexer.g4"
def packageName = "com.datascience9.mysql.parse"
def outputDir = "./"
println 'input args: grammar file ' + grammarFile + ': packageName ' + packageName + ' : outputDir ' + outputDir
classpath sourceSets.main.runtimeClasspath
main = "org.antlr.v4.Tool"
args grammarFile, "-visitor", "-package", packageName, "-o", outputDir
}
task generateMySqlParser(type: JavaExec) {
def grammarFile = "./src/main/java/com/datascience9/mysql/parse/MySqlParser.g4"
def packageName = "com.datascience9.mysql.parse"
def outputDir = "./"
println 'input args: grammar file ' + grammarFile + ': packageName ' + packageName + ' : outputDir ' + outputDir
classpath sourceSets.main.runtimeClasspath
main = "org.antlr.v4.Tool"
args grammarFile, "-visitor", "-package", packageName, "-o", outputDir
}
task generateMySql() {
dependsOn generateMySqlLexer, generateMySqlParser
println 'Generate both lexer and parser successsfully'
}
task testMySql(type: JavaExec) {
println 'Start integration test'
classpath sourceSets.main.runtimeClasspath
main = "com.datascience9.mysql.parse.MySqlParserTestIt"
}
task generatePostgresLexer(type: JavaExec) {
def grammarFile = "./src/main/java/com/datascience9/postgres/parse/PostgreSQLLexer.g4"
def packageName = "com.datascience9.postgres.parse"
def outputDir = "./"
println 'input args: grammar file ' + grammarFile + ': packageName ' + packageName + ' : outputDir ' + outputDir
classpath sourceSets.main.runtimeClasspath
main = "org.antlr.v4.Tool"
args grammarFile, "-visitor", "-package", packageName, "-o", outputDir
}
task generatePostgresParser(type: JavaExec) {
def grammarFile = "./src/main/java/com/datascience9/postgres/parse/PostgreSQLParser.g4"
def packageName = "com.datascience9.postgres.parse"
def outputDir = "./"
println 'input args: grammar file ' + grammarFile + ': packageName ' + packageName + ' : outputDir ' + outputDir
classpath sourceSets.main.runtimeClasspath
main = "org.antlr.v4.Tool"
args grammarFile, "-visitor", "-package", packageName, "-o", outputDir
}
task generatePostgres() {
dependsOn generatePostgresLexer, generatePostgresParser
println 'Generate both lexer and parser successsfully'
}
task testPostgres(type: JavaExec) {
println 'Start integration test'
classpath sourceSets.main.runtimeClasspath
main = "com.datascience9.postgres.parse.ParserTestIt"
}