/
build.gradle
116 lines (100 loc) · 4.02 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
sourceSets {
test {
java.srcDirs = []
kotlin.srcDirs = ['test/kotlin']
resources.srcDir('test/resources')
resources.include '**/*'
}
}
configurations {
cli_impl {
extendsFrom implementation
}
}
compileTestKotlin {
destinationDir = compileTestJava.destinationDir
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}
dependencies {
implementation project(':org.lflang')
implementation "org.eclipse.xtext:org.eclipse.xtext.ide:${xtextVersion}"
implementation "org.eclipse.xtext:org.eclipse.xtext.xbase.ide:${xtextVersion}"
testImplementation "junit:junit:${jUnitVersion}"
}
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
task buildLfc() {
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
mainClassName = 'org.lflang.cli.Lfc'
}
task jarLfc(type: ShadowJar) {
manifest {
attributes('Main-Class': 'org.lflang.cli.Lfc')
}
configurations = [project.configurations.cli_impl]
archiveClassifier.set('lfc')
exclude 'test/*'
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
// We should use minimize() here to reduce the size of the JAR, but it causes problems
// with regard to our Kotlin classes. Since we don't use imports to load them but load
// the classes manually, minimize does not see the dependency. While we can add an exclude
// rule, this does not seem to work very well and causes problems when compiling for a
// second time. Also see https://github.com/lf-lang/lingua-franca/pull/1285
transform(com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer){
resource = 'plugin.properties'
}
from sourceSets.main.output
}
buildLfc.finalizedBy jarLfc
task runLfc(type: JavaExec) {
// builds and runs lfc
// The working directory will be the root directory of the lingua franca project
// CLI arguments can be passed to lfc by using --args. Note that you need
// to escape cli flags which start with --.For instance --args ' --help'.
// Otherwise they're parsed as arguments to the Gradle CLI, not lfc.
description = "Build and run lfc, use --args to pass arguments"
group = "application"
classpath = sourceSets.main.runtimeClasspath
mainClass = 'org.lflang.cli.Lfc'
workingDir = '..'
}
task buildLff() {
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
mainClassName = 'org.lflang.cli.Lff'
}
task jarLff(type: ShadowJar) {
manifest {
attributes('Main-Class': 'org.lflang.cli.Lff')
}
configurations = [project.configurations.cli_impl]
archiveClassifier.set('lff')
exclude 'test/*'
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
// We should use minimize() here to reduce the size of the JAR, but it causes problems
// with regard to our Kotlin classes. Since we don't use imports to load them but load
// the classes manually, minimize does not see the dependency. While we can add an exclude
// rule, this does not seem to work very well and causes problems when compiling for a
// second time. Also see https://github.com/lf-lang/lingua-franca/pull/1285
transform(com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer){
resource = 'plugin.properties'
}
from sourceSets.main.output
}
buildLff.finalizedBy jarLff
task runLff(type: JavaExec) {
// builds and runs lff
// The working directory will be the root directory of the lingua franca project
// CLI arguments can be passed to lff by using --args. Note that you need
// to escape cli flags which start with --.For instance --args ' --help'.
// Otherwise they're parsed as arguments to the Gradle CLI, not lfc.
description = "Build and run lff, use --args to pass arguments"
group = "application"
classpath = sourceSets.main.runtimeClasspath
mainClass = 'org.lflang.cli.Lff'
workingDir = '..'
}