-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
157 lines (137 loc) · 3.78 KB
/
Copy pathbuild.gradle
File metadata and controls
157 lines (137 loc) · 3.78 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
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
156
/*
* This file was generated by the Gradle 'init' task.
*/
plugins {
id 'application'
id 'java-library'
id 'maven-publish'
id 'java'
id 'org.graalvm.buildtools.native' version '1.0.0'
id 'signing'
}
repositories {
mavenLocal()
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
}
dependencies {
api 'org.apache.commons:commons-lang3:3.20.0'
api 'commons-cli:commons-cli:1.11.0'
testImplementation 'org.junit.jupiter:junit-jupiter:6.0.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
group = 'io.reliza'
version = '2023.07.5'
description = 'versioning'
java.sourceCompatibility = JavaVersion.VERSION_21
java.targetCompatibility = JavaVersion.VERSION_21
task changeVersion {
doLast {
if(project.hasProperty('newVersion')) {
String s=buildFile.text.replaceFirst("version = '$version'","version = '"+newVersion+"'")
buildFile.text = s
}
}
}
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
if (!project.hasProperty("centralUser")) {
ext.centralUser = 'test'
}
if (!project.hasProperty("centralPassword")) {
ext.centralPassword = 'test'
}
java {
withJavadocJar()
withSourcesJar()
}
jar {
manifest {
attributes "Main-Class": 'io.reliza.versioning.VersionCli'
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
test {
useJUnitPlatform()
}
publishing {
publications {
versioning(MavenPublication) {
artifactId = 'versioning'
from components.java
pom {
name = 'versioning'
description = 'Reliza Versioning allows for automatic generation and bumping of CalVer or SemVer or custom version schemas.'
url = 'https://reliza.io'
licenses {
license {
name = 'MIT License'
url = 'https://github.com/relizaio/versioning/blob/main/LICENSE'
}
}
developers {
developer {
id = 'taleodor'
name = 'Pavel Shukhman'
email = 'info@reliza.io'
}
}
scm {
connection = 'scm:git:git://github.com/relizaio/versioning.git'
developerConnection = 'scm:git:ssh://github.com/relizaio/versioning.git'
url = 'https://github.com/relizaio/versioning/'
}
}
}
}
repositories {
maven {
name = 'central'
url = 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/'
credentials {
username "$centralUser"
password "$centralPassword"
}
}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
}
tasks.withType(Sign) {
onlyIf { gradle.taskGraph.hasTask(":publishAllPublicationsToCentralRepository") }
}
signing {
def signingKey = findProperty('GPG_SIGNING_KEY') ?: ''
def signingPassword = findProperty('GPG_SIGNING_PASSWORD') ?: ''
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.versioning
}
graalvmNative {
binaries.all {
resources.autodetect()
}
testSupport = true
toolchainDetection = true
binaries {
main {
// Main options
// sharedLibrary = false
imageName = 'versioning' // The name of the native image, defaults to the project name
mainClass = 'io.reliza.versioning.VersionCli' // The main class to use, defaults to the application.mainClass
sharedLibrary = false // Determines if image is a shared library, defaults to false if `java-library` plugin isn't included
useFatJar = true // Instead of passing each jar individually, builds a fat jar
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(25)
vendor = JvmVendorSpec.matching("GraalVM Community")
}
buildArgs.add('--no-fallback')
}
}
}