-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
130 lines (109 loc) · 3.15 KB
/
build.gradle
File metadata and controls
130 lines (109 loc) · 3.15 KB
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
plugins {
id 'io.micronaut.application' version '4.5.3'
id 'com.palantir.git-version' version '0.15.0'
id 'com.gradleup.shadow' version '8.3.6'
}
group = "org.owpk"
repositories {
mavenCentral()
}
dependencies {
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.0'
annotationProcessor 'org.projectlombok:lombok'
annotationProcessor 'info.picocli:picocli-codegen'
implementation 'info.picocli:picocli'
implementation 'io.micronaut.picocli:micronaut-picocli'
implementation 'io.micronaut.reactor:micronaut-reactor-http-client'
implementation 'io.micronaut:micronaut-jackson-databind'
implementation 'io.micronaut.serde:micronaut-serde-jackson'
implementation "io.micronaut.serde:micronaut-serde-api"
// implementation 'io.vavr:vavr:0.10.6'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'ch.qos.logback:logback-classic'
}
def buildTimeAndDate = new Date()
def gitDetails = versionDetails()
print gitDetails
version = gitDetails.version ?: "0.0.1"
if (gitDetails.isCleanTag) {
version = gitDetails.lastTag
} else {
version = "${gitDetails.lastTag}.${gitDetails.commitDistance}-SNAPSHOT"
}
var gitHash = gitDetails.gitHash
var buildTime = buildTimeAndDate.format('yyyy-MM-dd HH:mm:ss')
processResources {
filesMatching('**/version.properties') {
expand(
project_version: version,
build_time: buildTime,
git_commit: gitHash
)
}
}
jar {
manifest {
attributes(
'Implementation-Version': version,
'Build-Time': buildTime,
'Git-Commit': gitHash,
)
}
}
application {
mainClass = "org.owpk.Jllama"
}
graalvmNative {
binaries {
main {
imageName.set('jllama')
// buildArgs.add('-Ob')
}
}
}
java {
sourceCompatibility = JavaVersion.toVersion("21")
targetCompatibility = JavaVersion.toVersion("21")
}
micronaut {
testRuntime("junit5")
processing {
incremental(true)
annotations("org.owpk.*")
}
}
tasks.named("dockerfileNative") {
jdkVersion = "21"
}
task createVersion {
doLast {
def newVersion = project.hasProperty('newVersion') ? project.newVersion : null
if (!newVersion) {
throw new GradleException("Please specify version: -PnewVersion=X.Y.Z")
}
exec {
commandLine 'git', 'tag', '-a', "v${newVersion}", '-m', "Release version ${newVersion}"
}
exec {
commandLine 'git', 'push', 'origin', "v${newVersion}"
}
}
}
task release {
dependsOn 'clean', 'test', 'build', 'createVersion'
doLast {
println "Released version ${version}"
}
}
task checkVersionProperties {
doLast {
def resourcesDir = new File(buildDir, 'resources/main')
def versionFile = new File(resourcesDir, 'version.properties')
if (versionFile.exists()) {
println "Version properties content:"
println versionFile.text
} else {
println "Version properties file not found at: ${versionFile.absolutePath}"
}
}
}