-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
132 lines (119 loc) · 3.39 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
buildscript {
def getAppVersion = { ->
try (final var gitTagOut = new ByteArrayOutputStream()) {
exec {
commandLine 'git', 'tag', '--points-at', 'HEAD'
standardOutput = gitTagOut
}
final var tagName = gitTagOut.toString().strip()
if (tagName.isBlank()) {
try (final var gitHashOut = new ByteArrayOutputStream()) {
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = gitHashOut
}
return 'git-' + gitHashOut.toString().strip()
}
} else {
return tagName
}
}
}
ext {
VERSION = getAppVersion()
VCS_URL = 'https://github.com/comodal/pagerduty-client'
// Used by systems.comodal.pagerduty_event_json_iterator_adapter
jsoniter = "2.11.+" // https://github.com/comodal/json-iterator/releases
}
}
final JLV = JavaLanguageVersion.of(project.findProperty('targetJava') as Integer ?: 23)
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
plugins.withType(JavaPlugin).configureEach {
java {
modularity.inferModulePath = true
toolchain {
languageVersion = JLV
}
}
}
project.group = 'systems.comodal'
repositories {
maven {
url = "https://maven.pkg.github.com/comodal/json-iterator"
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.token") ?: System.getenv("GITHUB_TOKEN")
}
}
mavenCentral()
}
configurations.configureEach {
resolutionStrategy {
cacheDynamicVersionsFor 15, 'minutes'
cacheChangingModulesFor 15, 'minutes'
}
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:+'
testImplementation 'org.junit.jupiter:junit-jupiter-params:+'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:+'
}
test {
useJUnitPlatform()
maxParallelForks = 4
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
exceptionFormat "full"
showStandardStreams true
}
}
tasks.register('sourcesJar', Jar) {
from sourceSets.main.allJava
archiveClassifier.set('sources')
}
tasks.register('javadocJar', Jar) {
from javadoc
archiveClassifier.set('javadoc')
}
javadoc {
options.addBooleanOption('html5', true)
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId project.name
version = "$VERSION"
pom {
name = project.name
url = "$VCS_URL"
licenses {
license {
name = 'Apache License 2.0'
url = 'https://github.com/comodal/pagerduty-client/blob/master/LICENSE'
}
}
scm {
connection = 'scm:git:git@github.com:comodal/pagerduty-client.git'
url = "$VCS_URL"
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/comodal/pagerduty-client"
credentials {
username = System.getenv("GITHUB_ACTOR") ?: project.findProperty("gpr.user.write")
password = System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.token.write")
}
}
}
}
}