build.gradle 3.24 KB
Newer Older
René Schöne's avatar
René Schöne committed
1
2
import org.jastadd.relast.plugin.RelastPlugin
import org.jastadd.relast.plugin.RelastTest
3
apply plugin: 'jastadd'
4
apply plugin: 'com.google.protobuf'
René Schöne's avatar
René Schöne committed
5
6
apply plugin: RelastPlugin

7
8
9
10
11
12
13
14
15
16
sourceCompatibility = 1.8

repositories {
    jcenter()
}

buildscript {
    repositories.jcenter()
    dependencies {
        classpath 'org.jastadd:jastaddgradle:1.13.3'
17
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12'
18
    }
René Schöne's avatar
René Schöne committed
19
20
21
}

dependencies {
22
23
    runtime 'org.jastadd:jastadd:2.3.4'
    implementation project(':ros2rag.base')
René Schöne's avatar
René Schöne committed
24
25
26
27
28
29
30
31
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.0'
    testImplementation 'org.assertj:assertj-core:3.12.1'
    testImplementation group: 'org.fusesource.mqtt-client', name: 'mqtt-client', version: '1.15'
    testImplementation group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
    testImplementation 'com.google.protobuf:protobuf-java:3.0.0'
}

32
33
34
35
36
37
38
39
40
41
test {
    useJUnitPlatform()

    maxHeapSize = '1G'
}

relastTest {
    compilerLocation = '../libs/relast.jar'
}

René Schöne's avatar
René Schöne committed
42
43
44
45
46
47
sourceSets {
    test {
        java.srcDir "src/test/java-gen"
    }
}

48
49
50
51
52
53
54
55
56
protobuf {
    // create strange directories, so use default here
    generatedFilesBaseDir = "$projectDir/src/test/java-gen/proto"
    protoc {
        // The artifact spec for the Protobuf Compiler
        artifact = 'com.google.protobuf:protoc:3.0.0'
    }
}

René Schöne's avatar
René Schöne committed
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
task preprocessExampleTest(type: JavaExec, group: 'verification') {
    doFirst {
        delete 'src/test/02-after-ros2rag/example/Grammar.relast',
                'src/test/02-after-ros2rag/example/MqttUpdater.java',
                'src/test/02-after-ros2rag/example/ROS2RAG.jadd'
    }

    classpath = sourceSets.main.runtimeClasspath
    main = 'org.jastadd.ros2rag.compiler.Compiler'
    //noinspection GroovyAssignabilityCheck
    args '--outputDir=src/test/02-after-ros2rag/example',
            '--inputGrammar=src/test/01-input/example/Example.relast',
            '--inputRos2Rag=src/test/01-input/example/Example.ros2rag',
            '--rootNode=Model'
}

//task compileExampleTest(type: JavaExec, group: 'verification') {
//
//    doFirst {
//        delete 'src/test/java-gen/example'
//    }
//
//    classpath = sourceSets.main.runtimeClasspath
//    main = 'org.jastadd.JastAdd'
//    //noinspection GroovyAssignabilityCheck
//    args '--o=src/test/java-gen/', '--package=example.ast',
//            'src/test/jastadd-gen/example/Grammar.relast',
//            'src/test/jastadd-gen/example/MqttUpdater.java',
//            'src/test/jastadd-gen/example/ROS2RAG.jadd',
//            'src/test/jastadd/Example.jadd'
//}

task compileExampleTest(type: RelastTest) {
90
    verbose = true
91
    useJastAddNames = true
92
    jastAddList = 'JastAddList'
René Schöne's avatar
René Schöne committed
93
94
95
96
97
98
99
100
101
102
    relastFiles 'src/test/02-after-ros2rag/example/Grammar.relast'
    grammarName = 'src/test/03-after-relast/example/example'
    packageName = 'example.ast'
    moreInputFiles 'src/test/01-input/example/Example.jadd',
            'src/test/02-after-ros2rag/example/MqttUpdater.jadd',
            'src/test/02-after-ros2rag/example/ROS2RAG.jadd'
}

test.dependsOn compileExampleTest
compileExampleTest.dependsOn preprocessExampleTest
103
104
105
106

clean {
    delete 'src/test/02-after-ros2rag/example/', 'src/test/03-after-relast/example/'
}