-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
69 lines (63 loc) · 2.15 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
plugins {
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.gitVersion)
`maven-publish`
}
val versionFile = projectDir.resolve("version.txt")
version = if (versionFile.exists()) {
versionFile.readText().trim()
} else {
val ci = !project.findProperty("ciBuild")?.toString().toBoolean()
val gitVersion: groovy.lang.Closure<String> by extra
gitVersion() + (if (ci) "-SNAPSHOT" else "")
}
println("Version: $version")
allprojects {
apply(plugin = "maven-publish")
repositories {
mavenCentral()
}
group = "org.modelix"
version = rootProject.version
publishing {
repositories {
if (project.hasProperty("artifacts.itemis.cloud.user")) {
maven {
name = "itemisNexus3"
url = if (version.toString().contains("SNAPSHOT")) {
uri("https://artifacts.itemis.cloud/repository/maven-mps-snapshots/")
} else {
uri("https://artifacts.itemis.cloud/repository/maven-mps-releases/")
}
credentials {
username = project.findProperty("artifacts.itemis.cloud.user").toString()
password = project.findProperty("artifacts.itemis.cloud.pw").toString()
}
}
}
}
}
// Set maven metadata for all known publishing tasks. The exact tasks and names are only known after evaluation.
afterEvaluate {
tasks.withType<AbstractPublishToMaven>() {
this.publication?.apply {
setMetadata()
}
}
}
}
fun MavenPublication.setMetadata() {
pom {
url.set("https://github.com/modelix/modelix.incremental")
scm {
connection.set("scm:git:https://github.com/modelix/modelix.incremental.git")
url.set("https://github.com/modelix/modelix.incremental")
}
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
}
}