This repository has been archived by the owner on Jul 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
91 lines (77 loc) · 2.88 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
import java.text.SimpleDateFormat
buildscript {
repositories {
// it is useful to have the central maven repo before the Itemis's one as it is more reliable
mavenLocal()
maven { url = uri("https://repo.maven.apache.org/maven2") }
maven { url = uri("https://plugins.gradle.org/m2/") }
mavenCentral()
maven { url = uri("https://artifacts.itemis.cloud/repository/maven-mps/") }
}
dependencies {
classpath(mpsCatalog.itemis.mps.gradle.plugin)
}
}
plugins {
`maven-publish`
}
//
// project details
//
group = "org.modelix"
description = "modelix components providing MPS interoperation"
fun getAndWriteModelixVersion(): String {
lateinit var modelixVersion: String
val versionFile = File("$rootDir/modelix.version")
modelixVersion = if (versionFile.exists()) {
versionFile.readText().trim()
} else {
println("No version file exits, generating SNAPSHOT version")
"${mpsCatalog.versions.mpsbase.asProvider().get()}-" + SimpleDateFormat("yyyyMMddHHmm").format(java.util.Date()) + "-SNAPSHOT"
}
versionFile.writeText(modelixVersion)
return modelixVersion
}
version = getAndWriteModelixVersion()
println("Version of this project: ${version}")
println("Version of MPS used in this project: ${mpsCatalog.versions.mpsbase.asProvider().get()}")
println("Version of MPS extension used in this project: ${mpsCatalog.versions.mpsbase.extensions.get()}")
//
// subproject configuration
//
subprojects {
apply(plugin = "maven-publish")
group = rootProject.group
version = rootProject.version
repositories {
mavenLocal()
maven { url = uri("https://repo.maven.apache.org/maven2") }
mavenCentral()
maven { url = uri("https://artifacts.itemis.cloud/repository/maven-mps/") }
}
publishing {
repositories {
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 = rootProject.findProperty("artifacts.itemis.cloud.user").toString()
password = rootProject.findProperty("artifacts.itemis.cloud.pw").toString()
}
}
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/modelix/modelix.mps")
credentials {
username = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN")
}
}
}
}
}
defaultTasks.add("assemble")