build.gradle 5.28 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
apply plugin: 'jastadd'
apply plugin: 'application'

sourceCompatibility = 1.8

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

repositories {
    jcenter()
}

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

dependencies {
René Schöne's avatar
René Schöne committed
20
21
    implementation 'com.fasterxml.jackson.core:jackson-core:2.9.8'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
René Schöne's avatar
René Schöne committed
22
    implementation 'com.github.spullara.mustache.java:compiler:0.9.6'
René Schöne's avatar
René Schöne committed
23
    implementation group: 'org.apache.logging.log4j', name: 'log4j-jul', version: '2.11.2'
René Schöne's avatar
René Schöne committed
24
//    api 'org.jastadd:jastadd:2.3.4'
25
    runtime 'org.jastadd:jastadd:2.3.4'
René Schöne's avatar
René Schöne committed
26
    api group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
}

sourceSets {
    main {
        java.srcDir "src/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) }
    }
}

51
52
53
54
55
56
57
58
59
60
61
62
63
64
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",
65
            "../relast.preprocessor/src/main/jastadd/RelAst.relast",
66
            "./src/main/jastadd/Ros2Rag.relast",
René Schöne's avatar
René Schöne committed
67
            "./src/main/jastadd/MustacheNodes.relast",
68
69
70
71
72
            "--listClass=java.util.ArrayList",
            "--jastAddList=JastAddList",
            "--useJastAddNames",
            "--file",
            "--resolverHelper",
73
            "--grammarName=./src/gen/jastadd/Ros2Rag"
74
75
76
    ]

    inputs.files file("../libs/relast.jar"),
77
            file("../relast.preprocessor/src/main/jastadd/RelAST.relast"),
78
79
            file("./src/main/jastadd/Ros2Rag.relast")
            file("./src/main/jastadd/MustacheNodes.relast")
80
    outputs.files file("./src/gen/jastadd/Ros2Rag.ast"),
81
82
83
            file("./src/gen/jastadd/Ros2Rag.jadd"),
            file("./src/gen/jastadd/Ros2RagRefResolver.jadd"),
            file('./src/gen/jastadd/Ros2RagResolverStubs.jrag')
84
85
}

86
87
88
89
jastadd {
    configureModuleBuild()
    modules {
        //noinspection GroovyAssignabilityCheck
90
        module("Ros2Rag") {
91
92

            java {
93
94
95
96
97
                basedir ".."
                include "relast.preprocessor/main/**/*.java"
                include "relast.preprocessor/gen/**/*.java"
                include "ros2rag.base/src/main/**/*.java"
                include "ros2rag.base/src/gen/**/*.java"
98
99
100
            }

            jastadd {
101
102
103
104
105
106
107
108
109
110
                basedir ".."
                include "relast.preprocessor/src/main/jastadd/**/*.ast"
                include "relast.preprocessor/src/main/jastadd/**/*.jadd"
                include "relast.preprocessor/src/main/jastadd/**/*.jrag"
                include "ros2rag.base/src/main/jastadd/**/*.ast"
                include "ros2rag.base/src/main/jastadd/**/*.jadd"
                include "ros2rag.base/src/main/jastadd/**/*.jrag"
                include "ros2rag.base/src/gen/jastadd/**/*.ast"
                include "ros2rag.base/src/gen/jastadd/**/*.jadd"
                include "ros2rag.base/src/gen/jastadd/**/*.jrag"
111
112
113
            }

            scanner {
114
115
116
117
118
119
120
121
122
123
124
                basedir ".."
                include "ros2rag.base/src/main/jastadd/scanner/Header.flex",               [-5]
                include "relast.preprocessor/src/main/jastadd/scanner/Preamble.flex",      [-4]
                include "relast.preprocessor/src/main/jastadd/scanner/Macros.flex",        [-3]
                include "ros2rag.base/src/main/jastadd/scanner/Macros.flex",               [-3]
                include "relast.preprocessor/src/main/jastadd/scanner/RulesPreamble.flex", [-2]
                include "ros2rag.base/src/main/jastadd/scanner/MappingContent.flex",       [-1]
                include "ros2rag.base/src/main/jastadd/scanner/Keywords.flex"
                include "relast.preprocessor/src/main/jastadd/scanner/Keywords.flex"
                include "relast.preprocessor/src/main/jastadd/scanner/Symbols.flex",        [1]
                include "relast.preprocessor/src/main/jastadd/scanner/RulesPostamble.flex", [2]
125
126
127
            }

            parser {
128
                basedir ".."
129
130
131
                include "ros2rag.base/src/main/jastadd/parser/Preamble.parser"
                include "ros2rag.base/src/main/jastadd/parser/Ros2Rag.parser"
                include "relast.preprocessor/src/main/jastadd/parser/RelAst.parser"
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
            }
        }
    }

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

    preprocessParser.doFirst {

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

    }

147
    module = "Ros2Rag"
148
149
150

    astPackage = 'org.jastadd.ros2rag.ast'

151
    parser.name = 'Ros2RagParser'
152
153
154
155
156
157
158
159

    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"

160
    jastaddOptions = ["--lineColumnNumbers", "--List=JastAddList", "--safeLazy", "--visitCheck=true", "--rewrite=cnta", "--cache=all"]
161
162
}

163
generateAst.dependsOn relast