-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
111 lines (97 loc) · 3.2 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
102
103
104
105
106
107
108
109
110
111
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id 'org.jetbrains.kotlin.jvm'
id 'de.undercouch.download' version '4.0.0'
id 'idea'
}
allprojects {
group 'com.poterion.monitor'
version obtainVersion()
apply plugin: 'org.jetbrains.kotlin.jvm'
tasks.withType(JavaCompile.class) {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks.withType(KotlinCompile.class) {
kotlinOptions {
freeCompilerArgs = [ "-Xjsr305=strict" ]
jvmTarget = "11"
}
}
repositories {
mavenCentral()
jcenter()
google()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://www.dcm4che.org/maven2/' }
}
}
def obtainVersion() {
def versionFile = new File('version')
if (project.hasProperty('version') && project.version != "unspecified") {
return project.version
} else if (versionFile.exists() && versionFile.text != '') {
return versionFile.readLines().first()
} else {
return '1.0-SNAPSHOT'
}
}
task determineVersion(group: 'build setup', type: Exec) {
commandLine "sh", "-c", '''\
BUILD="\$(($(git tag | grep -E "v$(date +%Y)\\.[0-9]+" | sort -r | head -n1 | cut -d"." -f2) + 1))";
if [[ $(git branch --show-current | grep "master") ]]; then
SUFFIX=""
else
SUFFIX="-SNAPSHOT"
fi
VERSION="$(date +%Y).${BUILD}${SUFFIX}";
echo "Next version: ${VERSION}";
echo "${VERSION}" > version'''
}
task writePropertyFile(group: 'build') {
doLast {
def var = new Properties()
File file = file("src/main/resources/application.properties")
if (file.exists()) var.load(file.newDataInputStream())
var.setProperty("version", "${version}")
var.store(file.newWriter(), null)
}
}
tasks.assemble.dependsOn(writePropertyFile)
task assembleFatJar(type: Jar, group: 'build', dependsOn: [assemble]) {
manifest {
attributes 'Implementation-Title': "Poterion Monitor",
'Implementation-Version': archiveVersion,
'Main-Class': "com.poterion.monitor.Main"
}
archiveBaseName.set(project.name + '-' + (project.hasProperty('flavor') ? project.flavor : 'all'))
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
dependencies {
// Common
api project(':api')
compile project(':control')
compile project(':ui')
// Services
compile project(':alert-manager')
compile project(':gerrit-code-review')
compile project(':jenkins')
compile project(':jira')
compile project(':sonar')
compile project(':storyboard')
compile project(':syndication-feed')
// Notifiers
compile project(':deployment-case')
compile project(':devops-light')
compile project(':notification-tabs')
compile project(':notifications')
compile project(':system-tray')
// Kotlin
compile 'org.jetbrains.kotlin:kotlin-reflect:1.4.10'
// Commons
compile 'commons-cli:commons-cli:1.4'
// Logging
compile "org.slf4j:slf4j-log4j12:1.7.30"
}
apply from: 'build-self-contained.gradle'