forked from lf-lang/lingua-franca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
122 lines (104 loc) · 3.66 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
import com.diffplug.gradle.spotless.SpotlessTask
import lfformat.LfFormatStep
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.xtext:xtext-gradle-plugin:${xtextGradleVersion}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
}
}
plugins {
id "com.github.johnrengelman.shadow" version "${shadowJarVersion}"
id 'java'
id 'jacoco'
id "com.diffplug.spotless" version "${spotlessVersion}"
}
subprojects {
repositories {
mavenCentral()
}
apply plugin: 'kotlin'
compileKotlin {
destinationDir = compileJava.destinationDir
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}
dependencies {
implementation platform("org.eclipse.xtext:xtext-dev-bom:${xtextVersion}")
// https://mvnrepository.com/artifact/com.google.inject/guice
implementation group: 'com.google.inject', name: 'guice', version: guiceVersion
// https://mvnrepository.com/artifact/commons-cli/commons-cli
implementation group: 'commons-cli', name: 'commons-cli', version: commonsCliVersion
}
dependencies {
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlinVersion
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlinVersion
}
apply plugin: 'org.xtext.xtend'
apply from: "${rootDir}/gradle/source-layout.gradle"
apply plugin: 'eclipse'
// generate xtend sources before kotlin compilation
compileKotlin.dependsOn("generateXtext")
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
configurations.all {
exclude group: 'asm'
}
// Delete generated sources on `gradle clean`
clean.doFirst {
project.logger.info("Deleting ${projectDir}/src-gen")
delete "${projectDir}/src-gen/"
}
}
// Our CI uses --tests filters, which fails if some
// subprojects have no matching test.
//
// https://stackoverflow.com/questions/26147480/how-to-make-gradle-not-to-mark-build-failed-if-no-tests-are-found
subprojects {
test {
filter {
setFailOnNoMatchingTests(false)
}
testLogging {
// print exception message when a test fails.
exceptionFormat "full"
}
}
}
spotless {
repositories {
mavenCentral()
}
// optional: limit format enforcement to just the files changed by this feature branch
ratchetFrom 'origin/master'
format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
format 'linguaFranca', {
addStep(LfFormatStep.create(project.projectDir))
target 'test/*/src/**/*.lf' // you have to set the target manually
targetExclude 'test/**/failing/**'
}
java {
target 'org.lflang*/src/**/*.java', 'buildSrc/**/*.java'
// The following is quoted from https://github.com/google/google-java-format
// "Note: There is no configurability as to the formatter's algorithm for formatting.
// This is a deliberate design decision to unify our code formatting on a single format."
googleJavaFormat(googleJavaFormatVersion).reflowLongStrings()
formatAnnotations()
}
}
tasks.withType(SpotlessTask) { it.dependsOn(":org.lflang:jarCliTools") }