forked from mbeddr/mps-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
156 lines (123 loc) · 3.71 KB
/
build.gradle.kts
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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI
buildscript {
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
}
val kotlinApiVersion by extra { "1.3" }
val kotlinVersion by extra { "$kotlinApiVersion.11" }
plugins {
groovy
`java-gradle-plugin`
`kotlin-dsl`
`maven-publish`
kotlin("jvm") version "1.3.11"
}
val versionMajor = 1
val versionMinor = 4
group = "de.itemis.mps"
val nexusUsername: String? by project
val nexusPassword: String? by project
val kotlinArgParserVersion by extra { "2.0.7" }
val mpsVersion by extra { "2020.3.1" }
//this version needs to align with the version shiped with MPS found in the /lib folder otherwise, runtime problems will
//surface because mismatching jars on the classpath.
val fastXmlJacksonVersion by extra { "2.11.+" }
version = if (!project.hasProperty("useSnapshot") &&
(project.hasProperty("forceCI") || project.hasProperty("teamcity"))
) {
de.itemis.mps.gradle.GitBasedVersioning.getVersion(versionMajor, versionMinor)
} else {
"$versionMajor.$versionMinor-SNAPSHOT"
}
val mpsConfiguration = configurations.create("mps")
repositories {
mavenCentral()
maven {
url = URI("https://projects.itemis.de/nexus/content/repositories/mbeddr")
}
}
dependencyLocking {
lockAllConfigurations()
}
dependencies {
implementation(localGroovy())
implementation(kotlin("stdlib", version = kotlinVersion))
testImplementation("junit:junit:4.12")
}
gradlePlugin {
plugins {
register("generate-models") {
id = "generate-models"
implementationClass = "de.itemis.mps.gradle.generate.GenerateMpsProjectPlugin"
}
register("modelcheck") {
id = "modelcheck"
implementationClass = "de.itemis.mps.gradle.modelcheck.ModelcheckMpsProjectPlugin"
}
register("download-jbr") {
id = "download-jbr"
implementationClass = "de.itemis.mps.gradle.downloadJBR.DownloadJbrProjectPlugin"
}
}
}
tasks {
wrapper {
gradleVersion = "6.2.2"
distributionType = Wrapper.DistributionType.ALL
}
register("setTeamCityBuildNumber") {
doLast {
println("##teamcity[buildNumber '$version']")
}
}
}
publishing {
repositories {
maven {
name = "itemis"
url = uri("https://projects.itemis.de/nexus/content/repositories/mbeddr")
credentials {
username = nexusUsername
password = nexusPassword
}
}
}
}
subprojects {
dependencyLocking {
lockAllConfigurations()
}
}
tasks.register("createClasspathManifest") {
val outputDir = file("$buildDir/$name")
inputs.files(sourceSets.main.get().runtimeClasspath)
.withPropertyName("runtimeClasspath")
.withNormalizer(ClasspathNormalizer::class)
outputs.dir(outputDir)
.withPropertyName("outputDir")
doLast {
outputDir.mkdirs()
file("$outputDir/plugin-classpath.txt").writeText(sourceSets.main.get().runtimeClasspath.joinToString("\n"))
}
}
dependencies {
testRuntimeOnly(files(tasks["createClasspathManifest"]))
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.apiVersion = kotlinApiVersion
kotlinOptions.allWarningsAsErrors = true
}
tasks.register("resolveAndLockAll") {
doFirst {
require(gradle.startParameter.isWriteDependencyLocks)
}
doLast {
configurations.filter { it.isCanBeResolved }.forEach { it.resolve() }
subprojects.forEach { project ->
project.configurations.filter { it.isCanBeResolved }.forEach { it.resolve() }
}
}
}