build.gradle 3.74 KB
Newer Older
1
2

apply plugin: 'java'
3
4
apply plugin: 'jastadd'
apply plugin: 'application'
5
apply plugin: "idea"
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

sourceCompatibility = 1.8

mainClassName = 'org.jastadd.ros2rag.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'
    testCompile 'org.assertj:assertj-core:3.12.1'
26
27
    compile 'com.fasterxml.jackson.core:jackson-core:2.9.8'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
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
    compile 'org.jastadd:jastadd:2.3.4'
    runtime 'org.jastadd:jastadd:2.3.4'
    compile group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
}

sourceSets {
    main {
        java.srcDir "src/gen/java"
        java.srcDir "buildSrc/gen/java"
    }
}

test {
    useJUnitPlatform()

    maxHeapSize = '1G'
}

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

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

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
task relast(type: JavaExec) {
    group = 'Build'
    main = "-jar"

    doFirst {
        delete "src/gen/jastadd/*.ast"
        delete "src/gen/jastadd/Ros2Rag.jadd"
        delete "src/gen/jastadd/Ros2RagRefResolver.jadd"
        delete "src/gen/jastadd/Ros2RagResolverStubs.jrag"
        mkdir  "src/gen/jastadd/"
    }

    args = [
            "../libs/relast.jar",
            "./src/main/jastadd/RelAst.relast",
            "./src/main/jastadd/Ros2Rag.relast",
            "--listClass=java.util.ArrayList",
            "--jastAddList=JastAddList",
            "--useJastAddNames",
            "--file",
            "--resolverHelper",
            "--grammarName=./src/gen/jastadd/RelAST"
    ]

    inputs.files file("../libs/relast.jar"),
            file("src/main/jastadd/RelAST.relast"),
            file("src/main/jastadd/Ros2Rag.relast")
    outputs.files file("./src/gen/jastadd/RelAst.ast"),
            file("src/gen/jastadd/RelAst.jadd"),
            file("src/gen/jastadd/RelAstRefResolver.jadd"),
            file('src/gen/jastadd/RelAstResolverStubs.jrag')
}

89
90
91
92
93
94
95
96
97
98
99
100
101
jastadd {
    configureModuleBuild()
    modules {
        //noinspection GroovyAssignabilityCheck
        module("RelAst") {

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

            jastadd {
102
103
104
105
106
107
108
                basedir "."
                include "src/main/jastadd/**/*.ast"
                include "src/main/jastadd/**/*.jadd"
                include "src/main/jastadd/**/*.jrag"
                include "src/gen/jastadd/**/*.ast"
                include "src/gen/jastadd/**/*.jadd"
                include "src/gen/jastadd/**/*.jrag"
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
            }

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

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

    cleanGen.doFirst {
        delete "src/gen/java/org"
        delete "src/gen-res/BuildInfo.properties"
    }

    preprocessParser.doFirst {

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

    }

    module = "RelAst"

    astPackage = 'org.jastadd.ros2rag.ast'

    parser.name = 'RelAstParser'

    genDir = 'src/gen/java'

    buildInfoDir = 'src/gen-res'

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

146
    jastaddOptions = ["--lineColumnNumbers", "--List=JastAddList", "--safeLazy", "--visitCheck=true", "--rewrite=cnta", "--cache=all"]
147
148
}

149
generateAst.dependsOn relast