build.gradle 5.26 KB
Newer Older
1
2
3
4
5
apply plugin: 'jastadd'
apply plugin: 'application'

sourceCompatibility = 1.8

6
mainClassName = 'org.jastadd.ragconnect.compiler.Compiler'
7
8
9
10
11
12
13
14
15
16
17
18
19

repositories {
    jcenter()
}

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

dependencies {
René Schöne's avatar
René Schöne committed
20
    implementation group: 'com.github.spullara.mustache.java', name: 'compiler', version: '0.9.6'
René Schöne's avatar
René Schöne committed
21
    implementation group: 'org.apache.logging.log4j', name: 'log4j-jul', version: '2.11.2'
René Schöne's avatar
René Schöne committed
22
    runtime group: 'org.jastadd', name: 'jastadd', version: '2.3.4'
René Schöne's avatar
René Schöne committed
23
    api group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
}

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

test {
    useJUnitPlatform()

    maxHeapSize = '1G'
}

jar {
    manifest {
40
        attributes "Main-Class": 'org.jastadd.ragconnect.compiler.Compiler'
41
42
43
44
45
46
47
    }

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

48
49
50
51
52
53
task relast(type: JavaExec) {
    group = 'Build'
    main = "-jar"

    doFirst {
        delete "src/gen/jastadd/*.ast"
54
55
56
        delete "src/gen/jastadd/RagConnect.jadd"
        delete "src/gen/jastadd/RagConnectRefResolver.jadd"
        delete "src/gen/jastadd/RagConnectResolverStubs.jrag"
57
58
59
60
61
        mkdir  "src/gen/jastadd/"
    }

    args = [
            "../libs/relast.jar",
62
            "../relast.preprocessor/src/main/jastadd/RelAst.relast",
63
            "./src/main/jastadd/RagConnect.relast",
René Schöne's avatar
René Schöne committed
64
            "./src/main/jastadd/MustacheNodes.relast",
65
66
67
68
69
            "--listClass=java.util.ArrayList",
            "--jastAddList=JastAddList",
            "--useJastAddNames",
            "--file",
            "--resolverHelper",
70
            "--grammarName=./src/gen/jastadd/RagConnect"
71
72
73
    ]

    inputs.files file("../libs/relast.jar"),
74
            file("../relast.preprocessor/src/main/jastadd/RelAST.relast"),
75
            file("./src/main/jastadd/RagConnect.relast")
76
            file("./src/main/jastadd/MustacheNodes.relast")
77
78
79
80
    outputs.files file("./src/gen/jastadd/RagConnect.ast"),
            file("./src/gen/jastadd/RagConnect.jadd"),
            file("./src/gen/jastadd/RagConnectRefResolver.jadd"),
            file('./src/gen/jastadd/RagConnectResolverStubs.jrag')
81
82
}

83
84
85
86
jastadd {
    configureModuleBuild()
    modules {
        //noinspection GroovyAssignabilityCheck
87
        module("RagConnect") {
88
89

            java {
90
91
92
                basedir ".."
                include "relast.preprocessor/main/**/*.java"
                include "relast.preprocessor/gen/**/*.java"
93
94
                include "ragconnect.base/src/main/**/*.java"
                include "ragconnect.base/src/gen/**/*.java"
95
96
97
            }

            jastadd {
98
99
100
101
                basedir ".."
                include "relast.preprocessor/src/main/jastadd/**/*.ast"
                include "relast.preprocessor/src/main/jastadd/**/*.jadd"
                include "relast.preprocessor/src/main/jastadd/**/*.jrag"
102
103
104
105
106
107
                include "ragconnect.base/src/main/jastadd/**/*.ast"
                include "ragconnect.base/src/main/jastadd/**/*.jadd"
                include "ragconnect.base/src/main/jastadd/**/*.jrag"
                include "ragconnect.base/src/gen/jastadd/**/*.ast"
                include "ragconnect.base/src/gen/jastadd/**/*.jadd"
                include "ragconnect.base/src/gen/jastadd/**/*.jrag"
108
109
110
            }

            scanner {
111
                basedir ".."
112
                include "ragconnect.base/src/main/jastadd/scanner/Header.flex",               [-5]
113
114
                include "relast.preprocessor/src/main/jastadd/scanner/Preamble.flex",      [-4]
                include "relast.preprocessor/src/main/jastadd/scanner/Macros.flex",        [-3]
115
                include "ragconnect.base/src/main/jastadd/scanner/Macros.flex",               [-3]
116
                include "relast.preprocessor/src/main/jastadd/scanner/RulesPreamble.flex", [-2]
117
118
                include "ragconnect.base/src/main/jastadd/scanner/MappingContent.flex",       [-1]
                include "ragconnect.base/src/main/jastadd/scanner/Keywords.flex"
119
120
121
                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]
122
123
124
            }

            parser {
125
                basedir ".."
126
127
                include "ragconnect.base/src/main/jastadd/parser/Preamble.parser"
                include "ragconnect.base/src/main/jastadd/parser/RagConnect.parser"
128
                include "relast.preprocessor/src/main/jastadd/parser/RelAst.parser"
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
            }
        }
    }

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

    preprocessParser.doFirst {

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

    }

144
    module = "RagConnect"
145

146
    astPackage = 'org.jastadd.ragconnect.ast'
147

148
    parser.name = 'RagConnectParser'
149
150
151
152
153

    genDir = 'src/gen/java'

    buildInfoDir = 'src/gen-res'

154
155
    scanner.genDir = "src/gen/java/org/jastadd/ragconnect/scanner"
    parser.genDir = "src/gen/java/org/jastadd/ragconnect/parser"
156

157
    jastaddOptions = ["--lineColumnNumbers", "--List=JastAddList", "--safeLazy", "--visitCheck=true", "--rewrite=cnta", "--cache=all"]
158
159
}

160
generateAst.dependsOn relast