-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
155 lines (142 loc) · 4.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
buildscript {
repositories {
maven { url = 'https://plugins.gradle.org/m2/' }
mavenCentral()
}
dependencies {
// https://plugins.gradle.org/plugin/org.beryx.jlink
classpath "org.beryx:badass-jlink-plugin:3.1.1"
}
}
def getAppVersionUnchecked = { ->
if (project.hasProperty("noVersionTag")) {
return ''
}
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
}
}
} as Object
def getAppVersion = { ->
if (project.hasProperty("noVersionTag")) {
return ''
}
return getAppVersionUnchecked()
} as Object
ext {
VERSION = getAppVersion()
VCS_URL = 'https://github.com/sava-software/services'
}
subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
project.group = 'software.sava'
project.version = "$VERSION"
final JLV = JavaLanguageVersion.of(project.findProperty('targetJava') as Integer ?: 23)
plugins.withType(JavaPlugin).configureEach {
java {
modularity.inferModulePath = true
toolchain {
languageVersion = JLV
}
}
}
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")
}
}
maven {
url = "https://maven.pkg.github.com/sava-software/sava"
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.token") ?: System.getenv("GITHUB_TOKEN")
}
}
maven {
url = "https://maven.pkg.github.com/sava-software/solana-programs"
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.token") ?: System.getenv("GITHUB_TOKEN")
}
}
maven {
url = "https://maven.pkg.github.com/sava-software/anchor-src-gen"
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.token") ?: System.getenv("GITHUB_TOKEN")
}
}
maven {
url = "https://maven.pkg.github.com/sava-software/anchor-programs"
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.token") ?: System.getenv("GITHUB_TOKEN")
}
}
mavenCentral()
}
dependencies {
testImplementation libs.junit.jupiter
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
test {
jvmArgs '-XX:+UseZGC'
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
exceptionFormat "full"
showStandardStreams true
}
}
tasks.register('sourcesJar', Jar) {
from sourceSets.main.allJava
archiveClassifier.set('sources')
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
groupId project.group
artifactId project.name + '-services'
version = project.version
pom {
name = project.name + '-services'
url = "$VCS_URL"
scm {
connection = 'scm:git:[email protected]:sava-software/services.git'
url = "$VCS_URL"
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/sava-software/services"
credentials {
username = System.getenv("GITHUB_ACTOR") ?: project.findProperty("gpr.user.write")
password = System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.token.write")
}
}
}
}
}