-
Notifications
You must be signed in to change notification settings - Fork 77
/
build.gradle
101 lines (85 loc) · 3.53 KB
/
build.gradle
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
import de.itemis.mps.gradle.GitBasedVersioning
import de.itemis.mps.gradle.RunAntScript
plugins {
id 'de.itemis.mps.gradle.common' version '1.28.+'
id 'download-jbr' version '1.28.+'
}
repositories {
maven { url 'https://artifacts.itemis.cloud/repository/maven-mps' }
}
downloadJbr {
jbrVersion = '17.0.8.1-b1000.32'
}
//MPS version
ext.mpsMajor = "2023.2"
ext.mpsBuild = "2023.2.2"
//MPS-extensions version
ext.mpsExtensionsVersion = findNonEmptyProperty('mpsExtensionsVersion') ?: "$mpsMajor.+"
ext.artifactsDir = new File(rootDir, 'artifacts')
ext.ciBuild = project.hasProperty("forceCI") || project.hasProperty("teamcity")
afterEvaluate {
ext["itemis.mps.gradle.ant.defaultJavaExecutable"] = tasks.getByName('downloadJbr').javaExecutable
}
def hasNonEmptyProperty(property) {
return project.hasProperty(property) && !project.getProperty(property).empty
}
def findNonEmptyProperty(property) {
if (hasNonEmptyProperty(property)) {
return project.getProperty(property)
}
return null
}
ext.additionalPomInfo = {
licenses {
// official SPDX identifier
// see https://spdx.org/licenses/ for list
license {
name = "EPL-2.0"
url = "https://www.eclipse.org/legal/epl-v20.html"
comments = "Eclipse Public License - v 2.0"
distribution = "repo"
}
}
organization {
name = "itemis AG"
url = "https://www.itemis.com"
}
scm {
tag = GitBasedVersioning.getGitCommitHash()
url = "https://github.com/mbeddr/mbeddr.core.git"
}
}
subprojects {
ext.mbeddrMajor = mpsMajor.replaceFirst(/(\d{4})\.(\d)/) { all, major, minor -> major }
ext.mbeddrMinor = mpsMajor.replaceFirst(/(\d{4})\.(\d)/) { all, major, minor -> minor }
ext.mbeddrBuild = GitBasedVersioning.getGitBranch()
if(mbeddrBuild == "stable" || mbeddrBuild.matches(/(maintenance|mps)[\/-](mps)?\d+(\.\d+)*/)) {
ext.mbeddrBuild = "master"
}
if (ciBuild) {
if (project.hasProperty("mbeddrBuildCounter")) {
ext.mbeddrBuildCounter = project.getProperty("mbeddrBuildCounter")
} else {
ext.mbeddrBuildCounter = GitBasedVersioning.getGitCommitCount()
}
if(mbeddrBuild == "master" || mbeddrBuild.matches(/(maintenance|mps)[\/-](mps)?\d+(\.\d+)*/)) {
ext.mbeddrBuildNumber = GitBasedVersioning.getVersion(mbeddrBuild, mbeddrMajor, mbeddrMinor, mbeddrBuildCounter as int)
} else {
// use same logic as in all other platforms for snapshot publications
ext.mbeddrBuildNumber = GitBasedVersioning.getVersion(mbeddrBuild, mbeddrMajor, mbeddrMinor, mbeddrBuildCounter as int) + "-SNAPSHOT"
}
} else {
ext.mbeddrBuildNumber = "${ext.mbeddrMajor}.${ext.mbeddrMinor}-SNAPSHOT"
// TODO: not clear why this has been added - makes local builds from any branch to behave like a master build
//ext.mbeddrBuild = "master"
}
ext.mbeddrPlatformBuildNumber = findNonEmptyProperty('mbeddrPlatformVersion') ?: mbeddrBuildNumber
if (ciBuild) {
// Coerce TeamCity build number to mbeddrBuildNumber by default
// (see https://octopus.com/blog/teamcity-version-numbers-based-on-branches for details)
println "##teamcity[buildNumber '${mbeddrBuildNumber}']"
} else {
println "Local build detected. mbeddr version $ext.mbeddrBuildNumber, mbeddr platform version $ext.mbeddrPlatformBuildNumber"
}
tasks.withType(RunAntScript).configureEach(task -> { task.dependsOn(':downloadJbr') })
}