-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
139 lines (116 loc) · 4 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
/*
* Copyright (c) 2021, Seqera Labs.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This Source Code Form is "Incompatible With Secondary Licenses", as
* defined by the Mozilla Public License, v. 2.0.
*/
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
plugins {
id 'org.cadixdev.licenser' version '0.6.1'
id 'org.graalvm.buildtools.native'
id("io.micronaut.application") version "2.0.6"
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
version = project.file('VERSION').text.strip()
group = "io.seqera.tower.agent"
repositories {
mavenCentral()
}
micronaut {
runtime("netty")
testRuntime("junit5")
processing {
incremental(true)
annotations("io.seqera.tower.agent.*")
}
}
def junitVersion = providers.gradleProperty('junit.jupiter.version')
.forUseAtConfigurationTime()
.get()
dependencies {
annotationProcessor("info.picocli:picocli-codegen")
annotationProcessor("io.micronaut:micronaut-http-validation")
annotationProcessor("io.micronaut:micronaut-inject-java")
annotationProcessor("io.micronaut:micronaut-graal")
implementation("io.micronaut:micronaut-http-client")
implementation("io.micronaut:micronaut-runtime")
implementation("io.micronaut.picocli:micronaut-picocli")
implementation("io.micronaut.rxjava2:micronaut-rxjava2")
implementation("io.micronaut.rxjava2:micronaut-rxjava2-http-client")
implementation("info.picocli:picocli")
implementation("javax.annotation:javax.annotation-api")
implementation("javax.inject:javax.inject:1")
runtimeOnly("ch.qos.logback:logback-classic")
compileOnly("org.graalvm.nativeimage:svm")
implementation("io.micronaut:micronaut-validation")
testImplementation(platform("org.junit:junit-bom:${junitVersion}"))
testImplementation('org.junit.jupiter:junit-jupiter')
}
license {
header = project.file('HEADER.txt')
properties {
name = 'Seqera'
year = '2021-2024'
}
exclude '**/*.properties'
exclude 'gradlew'
}
application {
mainClass.set("io.seqera.tower.agent.Agent")
}
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 info = """\
version=${version}
versionApi=${versionApi}
commitId=${commitId}
""".stripIndent().toString()
def f = file("src/main/resources/META-INF/build-info.properties")
f.parentFile.mkdirs()
f.text = info
}
}
compileJava {
sourceCompatibility = JavaVersion.toVersion("21")
targetCompatibility = JavaVersion.toVersion("21")
options.compilerArgs += ["-Aproject=${project.name}"]
dependsOn buildInfo
}
shadowJar {
archiveBaseName.set('tw-agent')
archiveClassifier.set('')
archiveVersion.set('')
}
test {
useJUnitPlatform()
dependsOn checkLicenses
}
graalvmNative {
binaries {
main {
imageName = 'tw-agent'
mainClass = 'io.seqera.tower.agent.Agent'
configurationFileDirectories.from(file('conf'))
buildArgs(DefaultNativePlatform.currentOperatingSystem.isLinux() ? ['--static', '--libc=musl'] : [])
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(17)
}
}
test {
verbose = true
agent = true
}
}
}