-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.gradle
More file actions
182 lines (156 loc) · 4.87 KB
/
build.gradle
File metadata and controls
182 lines (156 loc) · 4.87 KB
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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
/* (c) https://github.com/MontiCore/monticore */
plugins {
id 'java'
id "maven-publish"
id "io.github.themrmilchmann.ecj" version "0.2.0" apply(false) // Eclipse compiler as it's much faster than javac
id "de.se_rwth.codestyle" version "$mc_version"
}
description = "CD4Analysis"
buildDir = file("$projectDir/target")
ext {
findbugs_version = "3.0.2"
guava_version = "31.1-jre"
antlr_version = "4.12.0"
plantuml_version = "1.2020.15"
jackson_version = "2.13.4"
commons_cli_version = "1.5.0"
commons_lang_version = "3.11"
junit_version = "5.14.1"
junit_platform_version = "1.14.1"
freemarker_version = "2.3.31"
javaparser_version = "3.14.11"
mockito_version = "5.11.0"
logback_version = "1.2.3"
apache_commons_version = '4.4'
}
repositories {
if (("true").equals(getProperty('useLocalRepo'))) {
mavenLocal()
}
mavenCentral()
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'io.github.themrmilchmann.ecj'
apply plugin: 'maven-publish'
apply plugin: 'de.se_rwth.codestyle'
ecj {
compilerVersion = "3.43.0"
}
sourceCompatibility = JavaVersion.VERSION_21
allprojects {
group = "de.monticore.lang.cd4analysis"
}
ext.grammarDir = 'src/main/grammars'
buildDir = file("$projectDir/target")
repositories {
if (("true").equals(getProperty('useLocalRepo'))) {
mavenLocal()
}
maven {
credentials.username mavenUser
credentials.password mavenPassword
url repo
}
mavenCentral()
}
jar {
archiveBaseName = 'cd4analysis'
archiveClassifier = project.name
}
tasks.withType(Test) {
useJUnitPlatform()
testLogging {
// controls whether test output is shown
showExceptions true
showCauses true
showStackTraces true
exceptionFormat TestExceptionFormat.FULL
info {
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
}
}
afterTest { desc, result ->
logger.lifecycle "${desc.className} > ${desc.name} ${result.resultType}"
}
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
logger.lifecycle startItem + output + endItem
}
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.deprecation false
options.warnings = false
options.forkOptions.jvmArgs += ["-Xmx4G"]
// TODO: reevaluate with new ecj plugin
outputs.cacheIf { false } // ECJ has problem with caching
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
}
evaluationDependsOnChildren()
publishing {
publications {
def publ = maven(MavenPublication)
// Use the Jar and grammarsJar, as well as the dependencies and module information from :cdlang
publ.from project(":cdlang").components.java
// the bootstrap property causes us to only build the main projects,
// which are required by most downstream projects (cdlang & the symtabdef tool)
if (!project.hasProperty('bootstrap')) {
// trafolib is different
// cdtool as -tool
def subprojectsToBePublished = [
":cd2plantuml",
":cd2smt",
":cddiff",
":cdlang",
":cdmerge",
":language-server"
]
subprojectsToBePublished
.findAll { it != ':cdlang' }
.each { subprojectName ->
publ.artifact(project(subprojectName).tasks.jar) {
group "de.monticore.lang"
}
}
publ.artifact(project(":cdtool").tasks.jar) {
group "de.monticore.lang"
classifier "tool"
}
publ.artifact(project(":cdtool").tasks.shadowJar)
}
publ.artifact(project(":symtabdefinitiontool").tasks.shadowJar)
publ.artifact(project(":symtabdefinitiontool:stdefgradle").tasks.jar)
if (("false").equals(getProperty('publishMain'))) {
publ.artifact(project(":cdlang").tasks.testSourcesJar) {
group "de.monticore.lang"
}
}
}
repositories.maven {
credentials.username mavenUser
credentials.password mavenPassword
def releasesRepoUrl = "https://nexus.se.rwth-aachen.de/content/repositories/monticore-releases/"
def snapshotsRepoUrl = "https://nexus.se.rwth-aachen.de/content/repositories/monticore-snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
/*
TODO (ALu): Once all dependant projects are published,
we can properly use transitive dependencies:
- cd4analysis (empty grammar project -> depends on cd4a:cdlang
- ...
*/