build.gradle 9.54 KB
Newer Older
René Schöne's avatar
René Schöne committed
1
buildscript {
2
3
    repositories {
        mavenCentral()
René Schöne's avatar
René Schöne committed
4
//        mavenLocal()
5
6
7
8
9
        maven {
            name "gitlab-maven"
            url "https://git-st.inf.tu-dresden.de/api/v4/groups/jastadd/-/packages/maven"
        }
    }
René Schöne's avatar
René Schöne committed
10
11
    dependencies {
        classpath 'org.jastadd:jastaddgradle:1.13.3'
René Schöne's avatar
René Schöne committed
12
        classpath 'org.jastadd.preprocessor:testing:0.2.8'
René Schöne's avatar
René Schöne committed
13
14
15
    }
}

René Schöne's avatar
René Schöne committed
16
17
import org.jastadd.preprocessor.testing.plugin.PreprocessorPlugin
import org.jastadd.preprocessor.testing.plugin.RagConnectTest
René Schöne's avatar
René Schöne committed
18
19
20
21
22
23
24
25
26
27

plugins {
    id 'java'
    id 'java-library'
    id 'idea'
    id 'com.github.ben-manes.versions' version '0.36.0'
    id 'com.google.protobuf' version "0.8.14"
}

apply plugin: 'jastadd'
René Schöne's avatar
René Schöne committed
28
apply plugin: PreprocessorPlugin
René Schöne's avatar
René Schöne committed
29
30
31
32
33
34
35
36
37
38

group = 'de.tudresden.inf.st'

repositories {
    mavenCentral()
}

dependencies {
    implementation project(':ragconnect.base')

39
40
41
//    runtime group: 'org.jastadd', name: 'jastadd', version: '2.3.4'
    runtime fileTree(include: ['jastadd2.jar'], dir: '../libs/')

René Schöne's avatar
René Schöne committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
    testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.4.0'
    testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.4.0'
    testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.12.1'

    // mqtt
    testImplementation group: 'org.fusesource.mqtt-client', name: 'mqtt-client', version: '1.15'

    // rest and client
    testImplementation group: 'com.sparkjava', name: 'spark-core', version: '2.9.2'
    testImplementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.11.2'
    testImplementation group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.31'
    testImplementation group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '2.31'

    testImplementation group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
    api group: 'com.google.protobuf', name: 'protobuf-java', version: '3.0.0'
}

René Schöne's avatar
René Schöne committed
59
60
61
62
63
64
65
//task helper {
//    doLast {
//        println(defaultOnlyRead.inputs.files.files)
//        println(defaultOnlyRead.outputs.files.files)
//    }
//}

René Schöne's avatar
René Schöne committed
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
test {
    useJUnitPlatform {
        excludeTags 'mqtt'
    }

    maxHeapSize = '1G'
}

protobuf {
    protoc {
        // The artifact spec for the Protobuf Compiler
        artifact = 'com.google.protobuf:protoc:3.0.0'
    }
}

task allTests(type: Test, dependsOn: testClasses) {
    description = 'Run every test'
    group = 'verification'

    useJUnitPlatform {
        includeTags 'mqtt'
87
88
89
90
91
92
93
94
    }
}

task specificTest(type: Test, dependsOn: testClasses) {
    description = 'Run test tagged with "NewTest"'
    group = 'verification'

    useJUnitPlatform {
95
        includeTags 'SpecificTest'
René Schöne's avatar
René Schöne committed
96
97
98
    }
}

René Schöne's avatar
René Schöne committed
99
preprocessorTesting {
René Schöne's avatar
René Schöne committed
100
    //noinspection GroovyAssignabilityCheck
René Schöne's avatar
René Schöne committed
101
102
    relastCompilerLocation = '../libs/relast.jar'
//    ragconnectCompilerLocation = '../libs/ragconnect.jar'
René Schöne's avatar
René Schöne committed
103
104
105
106
107
108
109
}

File genSrc = file("src/test/java-gen")
sourceSets.test.java.srcDir genSrc
idea.module.generatedSourceDirs += genSrc

clean {
110
111
112
    delete fileTree(dir: 'src/test/02-after-ragconnect/', exclude: '.gitignore')
    delete fileTree(dir: 'src/test/03-after-relast/', exclude: '.gitignore')
    delete fileTree(dir: 'src/test/java-gen/', exclude: '.gitignore')
René Schöne's avatar
René Schöne committed
113
114
115
}

// --- Test: Example ---
René Schöne's avatar
René Schöne committed
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
task compileExampleTest(type: RagConnectTest) {
    ragconnect {
        outputDir = file('src/test/02-after-ragconnect/example')
        inputFiles = [file('src/test/01-input/example/Test.relast'),
                      file('src/test/01-input/example/Test.connect')]
        rootNode = 'Model'
    }
    relast {
        useJastAddNames = true
        grammarName = 'src/test/03-after-relast/example/example'
    }
    jastadd {
        jastAddList = 'JastAddList'
        packageName = 'example.ast'
        inputFiles = [file('src/test/01-input/example/Test.jadd')]
    }
René Schöne's avatar
René Schöne committed
132
133
134
}

// --- Test: default-only-read ---
René Schöne's avatar
René Schöne committed
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
task compileDefaultOnlyRead(type: RagConnectTest) {
    ragconnect {
        outputDir = file('src/test/02-after-ragconnect/defaultOnlyRead')
        inputFiles = [file('src/test/01-input/defaultOnlyRead/Test.relast'),
                      file('src/test/01-input/defaultOnlyRead/Test.connect')]
        rootNode = 'A'
    }
    relast {
        useJastAddNames = true
        grammarName = 'src/test/03-after-relast/defaultOnlyRead/defaultOnlyRead'
    }
    jastadd {
        jastAddList = 'JastAddList'
        packageName = 'defaultOnlyRead.ast'
    }
René Schöne's avatar
René Schöne committed
150
151
152
}

// --- Test: default-only-write ---
René Schöne's avatar
René Schöne committed
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
task compileDefaultOnlyWrite(type: RagConnectTest) {
    ragconnect {
        outputDir = file('src/test/02-after-ragconnect/defaultOnlyWrite')
        inputFiles = [file('src/test/01-input/defaultOnlyWrite/Test.relast'),
                      file('src/test/01-input/defaultOnlyWrite/Test.connect')]
        rootNode = 'A'
    }
    relast {
        useJastAddNames = true
        grammarName = 'src/test/03-after-relast/defaultOnlyWrite/defaultOnlyWrite'
    }
    jastadd {
        jastAddList = 'JastAddList'
        packageName = 'defaultOnlyWrite.ast'
        inputFiles = [file('src/test/01-input/defaultOnlyWrite/Test.jadd')]
    }
René Schöne's avatar
René Schöne committed
169
170
171
}

// --- Test: read1write2 ---
René Schöne's avatar
René Schöne committed
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
task compileRead1write2(type: RagConnectTest) {
    ragconnect {
        outputDir = file('src/test/02-after-ragconnect/read1write2')
        inputFiles = [file('src/test/01-input/read1write2/Test.relast'),
                      file('src/test/01-input/read1write2/Test.connect')]
        rootNode = 'A'
    }
    relast {
        useJastAddNames = true
        grammarName = 'src/test/03-after-relast/read1write2/read1write2'
    }
    jastadd {
        jastAddList = 'JastAddList'
        packageName = 'read1write2.ast'
        inputFiles = [file('src/test/01-input/read1write2/Test.jadd')]
    }
René Schöne's avatar
René Schöne committed
188
189
190
}

// --- Test: read2write1 ---
René Schöne's avatar
René Schöne committed
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
task compileRead2write1(type: RagConnectTest) {
    ragconnect {
        outputDir = file('src/test/02-after-ragconnect/read2write1')
        inputFiles = [file('src/test/01-input/read2write1/Test.relast'),
                      file('src/test/01-input/read2write1/Test.connect')]
        rootNode = 'A'
    }
    relast {
        useJastAddNames = true
        grammarName = 'src/test/03-after-relast/read2write1/read2write1'
    }
    jastadd {
        jastAddList = 'JastAddList'
        packageName = 'read2write1.ast'
        inputFiles = [file('src/test/01-input/read2write1/Test.jadd')]
    }
René Schöne's avatar
René Schöne committed
207
208
209
}

// --- Test: via ---
René Schöne's avatar
René Schöne committed
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
task compileVia(type: RagConnectTest) {
    ragconnect {
        outputDir = file('src/test/02-after-ragconnect/via')
        inputFiles = [file('src/test/01-input/via/Test.relast'),
                      file('src/test/01-input/via/Test.connect')]
        rootNode = 'A'
        protocols = ['mqtt', 'rest']
    }
    relast {
        useJastAddNames = true
        grammarName = 'src/test/03-after-relast/via/via'
    }
    jastadd {
        jastAddList = 'JastAddList'
        packageName = 'via.ast'
        inputFiles = [file('src/test/01-input/via/Test.jadd')]
    }
René Schöne's avatar
René Schöne committed
227
228
229
}

// --- Test: token-value-send ---
René Schöne's avatar
René Schöne committed
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
task compileTokenValueSend(type: RagConnectTest) {
    ragconnect {
        outputDir = file('src/test/02-after-ragconnect/tokenValueSend')
        inputFiles = [file('src/test/01-input/tokenValueSend/Test.relast'),
                      file('src/test/01-input/tokenValueSend/Test.connect')]
        rootNode = 'A'
    }
    relast {
        useJastAddNames = true
        grammarName = 'src/test/03-after-relast/tokenValueSend/tokenValueSend'
    }
    jastadd {
        jastAddList = 'JastAddList'
        packageName = 'tokenValueSend.ast'
        inputFiles = [file('src/test/01-input/tokenValueSend/Test.jadd')]
    }
René Schöne's avatar
René Schöne committed
246
247
248
}

// --- Test: tutorial ---
René Schöne's avatar
René Schöne committed
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
task compileTutorial(type: RagConnectTest) {
    ragconnect {
        outputDir = file('src/test/02-after-ragconnect/tutorial')
        inputFiles = [file('src/test/01-input/tutorial/Test.relast'),
                      file('src/test/01-input/tutorial/Test.connect')]
        rootNode = 'A'
    }
    relast {
        useJastAddNames = true
        grammarName = 'src/test/03-after-relast/tutorial/tutorial'
    }
    jastadd {
        jastAddList = 'JastAddList'
        packageName = 'tutorial.ast'
        inputFiles = [file('src/test/01-input/tutorial/Test.jadd')]
    }
René Schöne's avatar
René Schöne committed
265
266
}

267
// --- Test: incremental ---
René Schöne's avatar
René Schöne committed
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
task compileIncremental(type: RagConnectTest) {
    ragconnect {
        outputDir = file('src/test/02-after-ragconnect/incremental')
        inputFiles = [file('src/test/01-input/incremental/Test.relast'),
                      file('src/test/01-input/incremental/Test.connect')]
        rootNode = 'A'
    }
    relast {
        useJastAddNames = true
        grammarName = 'src/test/03-after-relast/incremental/incremental'
    }
    jastadd {
        jastAddList = 'JastAddList'
        packageName = 'incremental.ast'
        inputFiles = [file('src/test/01-input/incremental/Test.jadd')]
        extraOptions = ['--tracing=cache,flush',
                        '--incremental=param',
                        '--cache=all',
                        '--rewrite=cnta',
                        '--flush=full']
    }
289
290
}

291
// --- Test: mapping ---
René Schöne's avatar
René Schöne committed
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
task compileMapping(type: RagConnectTest) {
    ragconnect {
        outputDir = file('src/test/02-after-ragconnect/mapping')
        inputFiles = [file('src/test/01-input/mapping/Test.relast'),
                      file('src/test/01-input/mapping/Test.connect')]
        rootNode = 'A'
        logReads = true
        logWrites = true
        verbose = true
    }
    relast {
        useJastAddNames = true
        grammarName = 'src/test/03-after-relast/mapping/mapping'
    }
    jastadd {
        jastAddList = 'JastAddList'
        packageName = 'mapping.ast'
        inputFiles = [file('src/test/01-input/mapping/Test.jadd')]
    }
311
}