This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
67 lines (58 loc) · 2.31 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
plugins {
`maven-publish`
id("com.palantir.git-version") version "0.15.0"
}
group = "org.modelix.mps.api-gen"
description = "API generator"
version = computeVersion()
println("Version: $version")
val mpsVersion: String by project
val mpsExtensionsVersion: String by project
println("GPR user: " + project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR"))
fun computeVersion(): Any {
val versionFile = file("version.txt")
val gitVersion: groovy.lang.Closure<String> by extra
var version = if (versionFile.exists()) versionFile.readText().trim() else gitVersion()
if (!versionFile.exists() && "true" != project.findProperty("ciBuild")) {
version = "$version-SNAPSHOT"
}
return version
}
subprojects {
apply(plugin = "maven-publish")
version = rootProject.version
group = rootProject.group
repositories {
mavenLocal()
maven { url = uri("https://artifacts.itemis.cloud/repository/maven-mps/") }
mavenCentral()
}
publishing {
repositories {
mavenLocal()
if ("true" == project.findProperty("ciBuild")) {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/modelix/api-gen")
credentials {
username = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN")
}
}
if (project.hasProperty("artifacts.itemis.cloud.user")) {
maven {
name = "itemis"
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()
}
}
}
}
}
}
}