-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
141 lines (122 loc) · 4.24 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
plugins {
id 'java'
id 'application'
id 'jacoco'
id 'org.cadixdev.licenser' version '0.6.1'
id 'org.graalvm.buildtools.native' version '0.10.2'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
// define these in the `gradle.properties` file
ext.githubUser = project.findProperty('github.packages.user')
ext.githubToken = project.findProperty('github.packages.token')
repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/seqeralabs/tower-java-sdk")
credentials {
username = githubUser ?: System.getenv("GITHUB_USERNAME")
password = githubToken ?: System.getenv("GITHUB_TOKEN")
}
}
}
dependencies {
implementation 'javax.activation:activation:1.1.1'
implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'ch.qos.logback:logback-core:1.2.11'
implementation 'ch.qos.logback:logback-classic:1.2.11'
implementation 'io.seqera.tower:tower-java-sdk:1.9.7'
implementation 'info.picocli:picocli:4.6.3'
implementation 'org.apache.commons:commons-compress:1.22'
implementation 'org.tukaani:xz:1.9'
annotationProcessor 'info.picocli:picocli-codegen:4.6.3'
testImplementation 'org.mock-server:mockserver-client-java:5.13.0'
testImplementation 'org.mock-server:mockserver-netty:5.13.0'
testImplementation 'org.mock-server:mockserver-junit-jupiter:5.13.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}
license {
header = project.file('HEADER.txt')
properties {
name = 'Seqera'
year = '2021-2023'
}
exclude '**/*.properties'
exclude 'gradlew'
exclude 'conf/**'
}
task buildInfo {
doLast {
def version = rootProject.file('VERSION').text.trim()
def versionApi = rootProject.file('VERSION-API').text.trim()
def commitId = System.env.getOrDefault("GITHUB_SHA", "unknown").substring(0,7)
def platform = System.env.getOrDefault("PLATFORM", "java")
def info = """\
version=${version}
versionApi=${versionApi}
commitId=${commitId}
platform=${platform}
""".stripIndent().toString()
def f = file("src/main/resources/META-INF/build-info.properties")
f.parentFile.mkdirs()
f.text = info
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
compileJava {
sourceCompatibility = JavaVersion.toVersion("11")
targetCompatibility = JavaVersion.toVersion("11")
options.compilerArgs += ["-Aproject=${project.name}"]
dependsOn buildInfo
}
application {
mainClass.set('io.seqera.tower.cli.Tower')
// This doesn't work on M1
applicationDefaultJvmArgs = ["-agentlib:native-image-agent=config-merge-dir=conf/"]
}
shadowJar {
archiveBaseName.set('tw')
archiveClassifier.set('')
archiveVersion.set('')
}
test {
// Use junit platform for unit tests
useJUnitPlatform()
dependsOn checkLicenses
}
graalvmNative {
toolchainDetection = true
binaries {
main {
imageName = 'tw'
mainClass = 'io.seqera.tower.cli.Tower'
configurationFileDirectories.from(file('conf'))
if (System.env.getOrDefault("PLATFORM", "") == "linux-x86_64") {
buildArgs(['--static', '--libc=musl', '--gc=G1', '-march=compatibility'])
}
buildArgs.add('--allow-incomplete-classpath')
buildArgs.add('--report-unsupported-elements-at-runtime')
buildArgs.add('-H:+AddAllCharsets')
buildArgs.add('-H:EnableURLProtocols=https,http')
buildArgs.add('-H:+ReportExceptionStackTraces')
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(21)
vendor = JvmVendorSpec.matching("Oracle Corporation")
}
}
test {
verbose = true
}
}
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
}