build.gradle 15.7 KB
Newer Older
Johannes Mey's avatar
Johannes Mey committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
apply plugin: 'java'
apply plugin: 'jastadd'
apply plugin: 'application'
apply plugin: "idea"

sourceCompatibility = 1.8

mainClassName = 'org.jastadd.relast.compiler.Compiler'

repositories {
    jcenter()
}

buildscript {
    repositories.jcenter()
    dependencies {
        classpath 'org.jastadd:jastaddgradle:1.13.3'
    }
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.0'
24
    testCompile 'org.assertj:assertj-core:3.12.1'
25
26
    compile 'com.fasterxml.jackson.core:jackson-core:2.9.8'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
27
    runtime 'org.jastadd:jastadd:2.3.2'
Johannes Mey's avatar
Johannes Mey committed
28
    compile group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
Johannes Mey's avatar
Johannes Mey committed
29
30
    compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.10.0'
    compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.10.0'
Johannes Mey's avatar
Johannes Mey committed
31
32
33
34
35
36
}

sourceSets {
    main {
        java.srcDir "src/gen/java"
    }
37
38
39
    test {
        java.srcDir "src/test/java-gen"
    }
Johannes Mey's avatar
Johannes Mey committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
}

jar {
    manifest {
        attributes "Main-Class": 'org.jastadd.relast.compiler.Compiler'
    }

    from {
        configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

jastadd {
    configureModuleBuild()
    modules {
55
        //noinspection GroovyAssignabilityCheck
Johannes Mey's avatar
Johannes Mey committed
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
        module("RelAst") {

            java {
                basedir "."
                include "src/main/**/*.java"
                include "src/gen/**/*.java"
            }

            jastadd {
                basedir "src/main/jastadd/"
                include "**/*.ast"
                include "**/*.jadd"
                include "**/*.jrag"
            }

            scanner {
                include "src/main/jastadd/RelAst.flex"
            }

            parser {
                include "src/main/jastadd/Preamble.parser"
                include "src/main/jastadd/RelAst.parser"
            }
        }
    }

    cleanGen.doFirst {
83
        delete "src/gen/java/org"
Johannes Mey's avatar
Johannes Mey committed
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
        delete "src/gen-res/BuildInfo.properties"
    }

    preprocessParser.doFirst {

        args += ["--no-beaver-symbol"]

    }

    module = "RelAst"

    astPackage = 'org.jastadd.relast.ast'

    parser.name = 'RelAstParser'

    genDir = 'src/gen/java'

    buildInfoDir = 'src/gen-res'

    scanner.genDir = "src/gen/java/org/jastadd/relast/scanner"
    parser.genDir = "src/gen/java/org/jastadd/relast/parser"

    jastaddOptions = ["--lineColumnNumbers", "--safeLazy", "--visitCheck=true", "--rewrite=cnta", "--cache=all"]
}

109
110
111
112
113
114
115
116
task preprocessRelationTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/jastadd/relations/Relations.ast', 'src/test/jastadd/relations/Relations.jadd'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.relast.compiler.Compiler'
117
    //noinspection GroovyAssignabilityCheck
118
    args 'src/test/jastadd/relations/Relations.relast', '--useJastAddNames', '--file', '--grammarName=src/test/jastadd/relations/Relations'
119
120
121
122
123
124
125
126
127
128
}

task doublePreprocessRelationTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/jastadd/relations/Relations2.ast', 'src/test/jastadd/relations/Relations2.jadd'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.relast.compiler.Compiler'
129
    //noinspection GroovyAssignabilityCheck
130
    args 'src/test/jastadd/relations/Relations.ast', '--useJastAddNames', '--file', '--grammarName=src/test/jastadd/relations/Relations2'
131
132
133
134
135
136
137
138
139
140
}

task compileRelationTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/java-gen/relations'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.JastAdd'
141
142
143
144
145
    //noinspection GroovyAssignabilityCheck
    args '--o=src/test/java-gen/', '--package=relations.ast',
            'src/test/jastadd/relations/Relations.ast',
            'src/test/jastadd/relations/Relations.jadd',
            'src/test/jastadd/Utils.jadd'
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
task preprocessDefaultNamesTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/jastadd/relations/Relations.ast', 'src/test/jastadd/relations/Relations.jadd'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.relast.compiler.Compiler'
    args 'src/test/jastadd/relations/Relations.relast', '--file', '--grammarName=src/test/jastadd/relations/Relations'
}

task compileDefaultNamesTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/java-gen/relations'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.JastAdd'
    args '--o=src/test/java-gen/', '--package=defaultnames.ast', 'src/test/jastadd/relations/Relations.ast', 'src/test/jastadd/relations/Relations.jadd', 'src/test/jastadd/Utils.jadd'
}

task preprocessDefaultNamesResolverTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/jastadd/resolver/Resolver.ast', 'src/test/jastadd/resolver/Resolver.jadd', 'src/test/jastadd/resolver/ResolverRefResolver.jadd'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.relast.compiler.Compiler'
    args 'src/test/jastadd/resolver/Resolver.relast', '--file', '--grammarName=src/test/jastadd/resolver/Resolver', '--resolverHelper'
}

task compileDefaultNamesResolverTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/java-gen/resolver'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.JastAdd'
189
190
191
192
193
194
195
196
197
198
    //noinspection GroovyAssignabilityCheck
    args '--o=src/test/java-gen/',
            '--package=defaultnames.resolver.ast',
            'src/test/jastadd/resolver/Resolver.ast',
            'src/test/jastadd/resolver/Resolver.jadd',
            'src/test/jastadd/resolver/ResolverUtils.jadd',
            'src/test/jastadd/resolver/ResolverResolverStubs.jrag',
            'src/test/jastadd/resolver/ResolverRefResolver.jadd',
            'src/test/jastadd/resolver/MyRefResolver.jadd',
            'src/test/jastadd/Utils.jadd'
199
200
}

201
202
203
204
205
206
207
208
task preprocessLowerBoundsTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/jastadd/lowerbounds/LowerBounds.ast', 'src/test/jastadd/lowerbounds/LowerBounds.jadd'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.relast.compiler.Compiler'
209
    //noinspection GroovyAssignabilityCheck
210
    args 'src/test/jastadd/lowerbounds/LowerBounds.relast', '--useJastAddNames', '--file', '--grammarName=src/test/jastadd/lowerbounds/LowerBounds'
211
212
213
214
215
216
217
218
219
220
}

task compileLowerBoundsTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/java-gen/lowerbounds'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.JastAdd'
221
222
223
224
225
    //noinspection GroovyAssignabilityCheck
    args '--o=src/test/java-gen/', '--package=lowerbounds.ast',
            'src/test/jastadd/lowerbounds/LowerBounds.ast',
            'src/test/jastadd/lowerbounds/LowerBounds.jadd',
            'src/test/jastadd/Utils.jadd'
226
}
Johannes Mey's avatar
Johannes Mey committed
227

228
229
230
231
232
233
234
235
task preprocessMultipleTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/jastadd/multiple/Multiple.ast', 'src/test/jastadd/multiple/Multiple.jadd'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.relast.compiler.Compiler'
236
    //noinspection GroovyAssignabilityCheck
237
    args 'src/test/jastadd/multiple/Part1.relast', '--useJastAddNames', 'src/test/jastadd/multiple/Part2.relast', 'src/test/jastadd/multiple/Part3.relast', '--file', '--grammarName=src/test/jastadd/multiple/Multiple'
238
239
240
241
242
243
244
245
246
247
}

task compileMultipleTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/java-gen/multiple'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.JastAdd'
248
249
250
251
252
    //noinspection GroovyAssignabilityCheck
    args '--o=src/test/java-gen/', '--package=multiple.ast',
            'src/test/jastadd/multiple/Multiple.ast',
            'src/test/jastadd/multiple/Multiple.jadd',
            'src/test/jastadd/Utils.jadd'
253
254
}

255
256
257
task preprocessResolverTest(type: JavaExec, group: 'verification') {

    doFirst {
258
        delete 'src/test/jastadd/resolver/Resolver.ast', 'src/test/jastadd/resolver/Resolver.jadd', 'src/test/jastadd/resolver/ResolverRefResolver.jadd', 'src/test/jastadd/resolver/ResolverResolverStubs.jrag'
259
260
261
262
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.relast.compiler.Compiler'
263
    //noinspection GroovyAssignabilityCheck
264
    args 'src/test/jastadd/resolver/Resolver.relast', '--useJastAddNames', '--file', '--grammarName=src/test/jastadd/resolver/Resolver', '--resolverHelper'
265
266
267
268
269
270
271
272
273
274
}

task compileResolverTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/java-gen/resolver'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.JastAdd'
275
276
277
278
279
280
281
282
283
    //noinspection GroovyAssignabilityCheck
    args '--o=src/test/java-gen/', '--package=resolver.ast',
            'src/test/jastadd/resolver/Resolver.ast',
            'src/test/jastadd/resolver/Resolver.jadd',
            'src/test/jastadd/resolver/ResolverUtils.jadd',
            'src/test/jastadd/resolver/ResolverRefResolver.jadd',
            'src/test/jastadd/resolver/ResolverResolverStubs.jrag',
            'src/test/jastadd/resolver/MyRefResolver.jadd',
            'src/test/jastadd/Utils.jadd'
284
285
}

Johannes Mey's avatar
Johannes Mey committed
286
287
288
289
290
291
292
293
294

task preprocessResolver2Test(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/jastadd/resolver2/Resolver.ast', 'src/test/jastadd/resolver2/Resolver.jadd', 'src/test/jastadd/resolver2/ResolverRefResolver.jadd'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.relast.compiler.Compiler'
295
    //noinspection GroovyAssignabilityCheck
296
    args 'src/test/jastadd/resolver2/Resolver.relast', '--useJastAddNames', '--file', '--grammarName=src/test/jastadd/resolver2/Resolver', '--resolverHelper'
Johannes Mey's avatar
Johannes Mey committed
297
298
299
300
301
302
303
304
305
306
}

task compileResolver2Test(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/java-gen/resolver2'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.JastAdd'
307
308
309
310
311
312
313
314
315
    //noinspection GroovyAssignabilityCheck
    args '--o=src/test/java-gen/', '--package=resolver2.ast',
            'src/test/jastadd/resolver2/Resolver.ast',
            'src/test/jastadd/resolver2/Resolver.jadd',
            'src/test/jastadd/resolver2/ResolverUtils.jadd',
            'src/test/jastadd/resolver2/ResolverRefResolver.jadd',
            'src/test/jastadd/resolver2/ResolverResolverStubs.jrag',
            'src/test/jastadd/resolver2/MyRefResolver.jadd',
            'src/test/jastadd/Utils.jadd'
Johannes Mey's avatar
Johannes Mey committed
316
317
}

318
319
320
321
322
323
324
325
task preprocessListNamesTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/jastadd/listnames/ListNames.ast', 'src/test/jastadd/listnames/ListNames.jadd'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.relast.compiler.Compiler'
326
    //noinspection GroovyAssignabilityCheck
327
    args 'src/test/jastadd/listnames/ListNames.relast', '--useJastAddNames', '--file', '--grammarName=src/test/jastadd/listnames/ListNames', '--jastAddList=ListyMcListface'
328
329
330
331
332
333
334
335
336
337
}

task compileListNamesTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/java-gen/listnames'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.JastAdd'
338
339
340
341
342
    //noinspection GroovyAssignabilityCheck
    args '--o=src/test/java-gen/', '--package=listnames.ast', '--List=ListyMcListface',
            'src/test/jastadd/listnames/ListNames.ast',
            'src/test/jastadd/listnames/ListNames.jadd',
            'src/test/jastadd/Utils.jadd'
343
344
}

345
346
347
348
349
350
task preprocessSerializerTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/jastadd/serializer/Serializer.ast',
                'src/test/jastadd/serializer/Serializer.jadd',
                'src/test/jastadd/serializer/SerializerRefResolver.jadd',
351
352
353
                'src/test/jastadd/serializer/SerializerSerializer.jadd',
                'src/test/jastadd/serializer/SerializerRefResolver.jadd',
                'src/test/jastadd/serializer/SerializerResolverStubs.jrag'
354
355
356
357
358
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.relast.compiler.Compiler'
    //noinspection GroovyAssignabilityCheck
359
    args 'src/test/jastadd/serializer/Serializer.relast', '--useJastAddNames', '--file', '--grammarName=src/test/jastadd/serializer/Serializer', '--serializer=jackson'
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
}

task compileSerializerTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/java-gen/serializer'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.JastAdd'
    //noinspection GroovyAssignabilityCheck
    args '--o=src/test/java-gen/', '--package=serializer.ast',
            'src/test/jastadd/serializer/Serializer.ast',
            'src/test/jastadd/serializer/Serializer.jadd',
            'src/test/jastadd/serializer/SerializerRefResolver.jadd',
            'src/test/jastadd/serializer/SerializerSerializer.jadd',
376
            'src/test/jastadd/serializer/SerializerResolverStubs.jrag',
377
378
            'src/test/jastadd/Utils.jadd'
}
379

380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
task preprocessSerializerOriginalNamesTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/jastadd/serializer-names/Serializer.ast',
                'src/test/jastadd/serializer-names/Serializer.jadd',
                'src/test/jastadd/serializer-names/SerializerRefResolver.jadd',
                'src/test/jastadd/serializer-names/SerializerSerializer.jadd',
                'src/test/jastadd/serializer-names/SerializerRefResolver.jadd',
                'src/test/jastadd/serializer-names/SerializerResolverStubs.jrag'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.relast.compiler.Compiler'
    //noinspection GroovyAssignabilityCheck
    args 'src/test/jastadd/serializer-names/Serializer.relast', '--file', '--grammarName=src/test/jastadd/serializer-names/Serializer', '--serializer=jackson'
}

task compileSerializerOriginalNamesTest(type: JavaExec, group: 'verification') {

    doFirst {
        delete 'src/test/java-gen/serializer'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.JastAdd'
    //noinspection GroovyAssignabilityCheck
    args '--o=src/test/java-gen/', '--package=defaultnames.serializer.ast',
            'src/test/jastadd/serializer-names/Serializer.ast',
            'src/test/jastadd/serializer-names/Serializer.jadd',
            'src/test/jastadd/serializer-names/SerializerRefResolver.jadd',
            'src/test/jastadd/serializer-names/SerializerSerializer.jadd',
            'src/test/jastadd/serializer-names/SerializerResolverStubs.jrag',
            'src/test/jastadd/Utils.jadd'
}

Johannes Mey's avatar
Johannes Mey committed
415
test {
Johannes Mey's avatar
Johannes Mey committed
416
    outputs.upToDateWhen { false }
Johannes Mey's avatar
Johannes Mey committed
417
    useJUnitPlatform()
418
419
}

420

421
422
test.dependsOn compileRelationTest
compileRelationTest.dependsOn doublePreprocessRelationTest
423
424
doublePreprocessRelationTest.dependsOn preprocessRelationTest

425
426
427
428
429
test.dependsOn compileDefaultNamesTest
compileDefaultNamesTest.dependsOn preprocessDefaultNamesTest
test.dependsOn compileDefaultNamesResolverTest
compileDefaultNamesResolverTest.dependsOn preprocessDefaultNamesResolverTest

430
431
432
433
test.dependsOn compileLowerBoundsTest
compileLowerBoundsTest.dependsOn preprocessLowerBoundsTest

test.dependsOn compileMultipleTest
434
435
436
compileMultipleTest.dependsOn preprocessMultipleTest

test.dependsOn compileResolverTest
437
438
compileResolverTest.dependsOn preprocessResolverTest

Johannes Mey's avatar
Johannes Mey committed
439
440
441
test.dependsOn compileResolver2Test
compileResolver2Test.dependsOn preprocessResolver2Test

442
test.dependsOn compileListNamesTest
443
compileListNamesTest.dependsOn preprocessListNamesTest
444

445
test.dependsOn compileSerializerTest
446
compileSerializerTest.dependsOn preprocessSerializerTest
447
448
449
450


test.dependsOn compileSerializerOriginalNamesTest
compileSerializerOriginalNamesTest.dependsOn preprocessSerializerOriginalNamesTest