-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
205 lines (169 loc) · 5.13 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
// Copyright (c) 2015-2016 IBM Corporation.
/**
* Main Gradle build.
*
* The default tasks is install, which creates a candidate Tosca distibution file in build.
*
* By default, the distribution is created from Tosca source files compiled using a previous Tosca stable build.
*
* There are various ways of overriding the default behavior by specifying -P option on the gradle command line.
* These options are:
* - dev : use latest Tosca class files stored in targets/java/build
* - crsx3: use crsx3 source files
*/
import org.transscript.gradle.*
defaultTasks 'install'
apply plugin:'base'
project.ext {
// Change to true when changes are made to the runtime affecting generated parsers
// See also settings.gradle
nparsers = false
}
// -- Configure build script which requires Tosca gradle plugin
buildscript {
repositories {
flatDir { dirs 'gradle' } // to find transscript-gradle-plugin.jar
}
dependencies {
classpath 'org.transscript.gradle:transscript-gradle-plugin:1.+'
}
}
apply plugin:'org.transscript.gradle'
repositories {
flatDir { dirs 'targets/java/dist' } // where to find Tosca jar
flatDir { dirs 'targets/java/dist/lib' } // where to find crsx3.jar
mavenCentral() // Where to find ANTLR
}
dependencies {
transscript project.hasProperty('dev') ? 'org.transscript:transscript:1.0.0-SNAPSHOT@jar' : 'org.transscript:transscript:1.0.0-ALPHA@jar'
transscript 'org.crsx:crsx3@jar'
transscript 'org.antlr:antlr4:4.5'
}
// --- Generate all meta and term parsers
task coreParsers(type: PG4Task) {
description "Generate Core term and meta parsers"
source = file('src/core/Core.g4')
generatedFileDir = file('src/core')
metaPrefix = '##'
ncg = true
locsort = 'Region({})'
}
/*
task coreParsers(type: TransScriptTask) {
description = "Generate Core term and meta parsers"
command = "pg"
dependencies = fileTree(dir: 'src/core', include: ['Core.g4'])
sources = fileTree(dir: 'src/core', include: ['Core.g4'])
outputDir = file('src/core2/')
bootparserpath = "file:parsers/build/classes/main/" // override Tosca parsers location. MUST END WITH /
metaprefix = '##'
location = 'Region({})'
}
*/
task toscaParsers(type: PG4Task) {
description 'Generate Tosca term and meta parsers'
source = file('src/parser/TransScript.g4')
generatedFileDir = file('src/parser')
metaPrefix = '##'
ncg = true
//locsort = 'Region({})'
}
/*
task toscaParsers(type: TransScriptTask) {
description 'Generate Tosca term and meta parsers'
command = "pg"
dependencies = fileTree(dir: 'src/parser', include: ['TransScript.g4'])
sources = fileTree(dir: 'src/parser', include: ['TransScript.g4'])
outputDir = file('src/parser2/')
bootparserpath = "file:parsers/build/classes/main/" // override Tosca parsers location. MUST END WITH /
metaprefix = '##'
// location = 'Region({})'
}
*/
task textParsers(type: PG4Task) {
description 'Generate Text term and meta parsers'
source = file('src/std/text/Text4.g4')
generatedFileDir = file('src/std/text')
defaultRule = 'text'
ncg = true
notext = true
}
/*
task textParsers(type: TransScriptTask) {
description 'Generate Text term and meta parsers'
command = "pg"
dependencies = fileTree(dir: 'src/std/text', include: ['Text4.g4'])
sources = fileTree(dir: 'src/std/text', include: ['Text4.g4'])
outputDir = file('src/std/text2/')
bootparserpath = "file:parsers/build/classes/main/" // override Tosca parsers location. MUST END WITH /
defaultrule = 'text'
notext = true
}
*/
// --- dependencies
// --- To make sure we don't delete something important by accident
task cleanCoreParsers(overwrite : true) {}
task cleanTransScriptParsers(overwrite : true) {}
task cleanTextParsers(overwrite : true) {}
// --- The tarball full distribution
task tarAll(type: Tar, dependsOn: ':targets:java:snapshot') {
baseName 'tosca'
version '1.0'
compression Compression.GZIP
// Tosca compiler.
into ('.') {
from 'targets/java/dist/transscript-1.0.0-SNAPSHOT.jar'
rename { String fileName -> 'tosca.jar' }
}
// Java libraries
into ('lib') {
from 'targets/java/dist/lib'
include '*.jar'
}
// Standard library
into ('lib/std/') {
from 'src/std/'
include '**/*.tsc'
}
into ('lib') {
from 'src/'
include 'std.tsc'
}
// C++ Target
into ('targets/cpp/runtime') {
from 'targets/cpp/runtime/'
include '*.*'
}
into ('targets/cpp') {
from 'targets/cpp'
include 'build.gradle'
}
into ('targets/cpp/resources') {
from '.'
include 'gradle/wrapper/**/*'
include 'gradlew.*'
include 'gradlew'
}
into ('targets/cpp/resources') {
from 'targets/cpp/resources/'
include '*.*'
}
into ('targets/cpp/std/src/std/') {
from 'targets/cpp/std/src/std'
include '*-extern*.*'
}
into ('.') {
from '.'
include 'VERSION'
include 'LICENSE.TXT'
}
}
// --- Local install
task install(type: Copy, dependsOn:'tarAll') {
from tarTree(resources.gzip(tasks.getByPath(':tarAll').archivePath))
into "${buildDir}/install"
}
// --- The Gradle wrapper.
task wrapper(type: Wrapper) {
gradleVersion = '2.13'
}