-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
123 lines (100 loc) · 3.67 KB
/
build.gradle
File metadata and controls
123 lines (100 loc) · 3.67 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
/* (c) https://github.com/MontiCore/monticore */
plugins {
id "java-library" // Java plus providing specific knowledge about Java libraries
id "maven-publish"
id "de.monticore.generator-withtr" version "$mc_version" // MontiCore Plugin
id "com.gradleup.shadow" version "$shadow_version" // for creating the all-in-one jar
id 'jacoco' // Test coverage reports
id 'de.se_rwth.codestyle' version "$mc_version" // Enforces & Provides SE CodeStyle
}
group = "de.monticore.lang"
description = "Automata DSL"
// Change the output directory
layout.buildDirectory = file("$projectDir/target")
generateMCGrammars {
// The mc4 grammars are build from the src/main/grammars directory by default
// You do not have to configure anything, the de.monticore.generator plugin does it all
// Reasonable defaults are used, further details: https://monticore.github.io/monticore/docs/Gradle/
}
dependencies {
// Depend on the MontiCore language library (which in term depends on the runtime)
grammar "de.monticore:monticore-grammar:$mc_version"
if ("true".equals(getProperty('genTR'))) {
// and their respective trafo-components (as a grammar dependency of the trafo source set)
trafoGrammar grammar("de.monticore:monticore-grammar-trafo:$mc_version")
}
// Next, dependencies of the project itself
implementation "com.google.guava:guava:$guava_version"
implementation "de.monticore.lang:cd4analysis:$mc_version"
implementation "org.apache.commons:commons-lang3:$commons_lang3_version"
// And dependencies for the test source set
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-engine:$junit_version"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:$junit_version"
// Provide MontiCore-specific tests, such as de.monticore.cocos.helper.Assert
testImplementation("de.monticore:monticore-runtime:$mc_version") {
capabilities {
requireCapability("de.monticore:monticore-runtime-tests")
}
}
}
// Where can we find the dependencies?
repositories {
if (("true").equals(getProperty('useLocalRepo'))) {
mavenLocal()
}
maven {
credentials.username = mavenUser
credentials.password = mavenPassword
url = repo
}
}
java {
withSourcesJar() // Also publish a variant consisting of the Java sources
withJavadocJar() // Also publish a variant consisting of the JavaDocs
}
sourcesJar.dependsOn project.collect { it.tasks.withType(MCGenTask) }
// generated java doc contains errors, disable for now
javadoc.failOnError = false
shadowJar { // all in one jar
manifest {
attributes "Main-Class": "automata.AutomataTool"
}
archiveClassifier = "tool"
}
jar.dependsOn(shadowJar)
// configure deployment
publishing {
// configure what artifacts to publish
publications {
mavenJava(MavenPublication) {
artifactId = "$project.name"
from components.java
}
}
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
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
test {
useJUnitPlatform()
}
tasks.register('testReport', TestReport) {
destinationDirectory = file("$layout.buildDirectory/reports/allTests")
// Include the results from the 'test' task
reportOn tasks.withType(Test)
}
tasks.register('buildAll', GradleBuild) {
tasks = ['build']
}
spotless {
enforceCheck = false
}
defaultTasks 'build'