-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
build.gradle
91 lines (82 loc) · 3.25 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
import lfformat.LfFormatStep
plugins {
id 'com.diffplug.spotless'
id 'org.lflang.distribution-conventions'
id 'idea'
}
spotless {
format 'misc', {
target rootProject.fileTree(rootProject.rootDir) {
include '**/*.gradle', '**/*.md', '.gitignore', '**/*.yml', '**/*.sh', '**/*.psi'
exclude '**/reactor-cpp/**', '**/reactor-c/**', '**/reactor-rs/**', '**/lf-python-support/**',
'**/src-gen/**', '**/fed-gen/**', '**/test-gen/**', '**/build/**',
'test/*/include', 'test/*/bin/', 'test/*/share', 'test/*/lib'
}
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces(2) // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
format 'linguaFranca', {
addStep(LfFormatStep.create())
target 'test/*/src/**/*.lf' // you have to set the target manually
targetExclude 'test/**/failing/**'
}
}
// Make the LF formatting task depend on lff
spotlessLinguaFranca.dependsOn('cli:lff:installDist')
spotlessLinguaFranca.inputs.files(tasks.getByPath('cli:lff:installDist').outputs)
distributions {
clitools {
distributionBaseName = "lf-cli"
if (project.hasProperty('nightly')) {
distributionClassifier = 'nightly-' + project.nightly + '-' + platform.os + '-' + platform.arch
} else if (!platform.isNative) {
distributionClassifier = platform.os + '-' + platform.arch
}
contents {
from tasks.getByPath('cli:lfc:installDist').outputs
from tasks.getByPath('cli:lff:installDist').outputs
from tasks.getByPath('cli:lfd:installDist').outputs
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}
}
installDist.dependsOn('installClitoolsDist')
assemble.dependsOn('installDist')
// Alias tasks for simpler access
tasks.register('runLfc', JavaExec) {
dependsOn('cli:lfc:run')
}
tasks.register('runLff', JavaExec) {
dependsOn('cli:lff:run')
}
tasks.register('targetTest') {
doLast {
if (!project.hasProperty('target')) {
def testFiles = rootProject.fileTree("${rootProject.rootDir}/core/src/integrationTest/java/org/lflang/tests/runtime").files
def targets = testFiles.collect { it.getName().substring(0, it.getName().length() - 9); }
throw new GradleException("Please set the \'target\' project property using -Ptarget=<...>. You may chose any of $targets")
}
}
finalizedBy('core:integrationTestCodeCoverageReport')
}
tasks.register('singleTest') {
doLast {
if (System.getProperty('singleTest') == null) {
throw new GradleException('Please set the \'singleTest\' system property using -DsingleTest=<...> to specify the LF test file that you would like to run.')
}
}
finalizedBy('core:integrationTest')
}
// Old deprecated tasks.
tasks.register('buildAll') {
doLast {
throw new GradleException('The "buildAll" task was removed. Pleas use "./gradlew build" or "./gradlew assemble instead')
}
}
tasks.register('runSingleTestl') {
doLast {
throw new GradleException('The "runSingleTest" task was removed. Pleas use "./gradlew singleTest -DsingleTest=testFile.lf" instead')
}
}