-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
169 lines (150 loc) · 4.14 KB
/
build.gradle
File metadata and controls
169 lines (150 loc) · 4.14 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
157
158
159
160
161
162
163
164
165
166
167
168
169
plugins {
id 'java-library'
id 'io.toolebox.git-versioner' version '1.6.7'
id 'com.diffplug.spotless' version '7.2.1'
id 'maven-publish'
id 'org.jreleaser' version '1.21.0'
}
group = 'dev.jbang'
def javaVersion = System.getProperty('java.version')
def majorVersion = javaVersion.split('\\.')[0].toInteger()
if (majorVersion < 11) {
throw new GradleException("""
⚠️ This build requires Java 11 or newer but you're using Java ${javaVersion}
Please use JAVA_HOME with Java 11 or newer to run this build.
Current JAVA_HOME: ${System.getProperty('java.home')}.
If you have jbang installed, you can run it with:
eval \$(jbang jdk java-env 11+)
""".stripIndent())
}
javadoc {
options.encoding = 'UTF-8'
//remove this to see all the missing tags/parameters.
options.addStringOption('Xdoclint:none', '-quiet')
}
repositories {
mavenCentral()
}
java {
withJavadocJar()
withSourcesJar()
}
compileJava {
options.encoding = 'UTF-8'
options.release = 8;
}
versioner {
pattern {
pattern = "%M.%m.%p(.%c-SNAPSHOT)"
}
git {
authentication {
https {
token = project.hasProperty('github_token') ? getProperty('github_token') : "unknown_github_token"
}
}
}
}
dependencies {
implementation 'org.apache.commons:commons-compress:1.28.0'
implementation 'com.google.code.gson:gson:2.13.2'
implementation 'org.jspecify:jspecify:1.0.0'
implementation('org.apache.httpcomponents.client5:httpclient5:5.6') {
// Optional: Only needed if using DefaultRemoteAccessProvider
}
implementation('org.apache.httpcomponents.client5:httpclient5-cache:5.6') {
// Optional: Only needed if using DefaultRemoteAccessProvider
}
testImplementation platform('org.junit:junit-bom:6.0.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation "org.hamcrest:hamcrest-library:3.0"
testImplementation "uk.org.webcompere:system-stubs-jupiter:2.1.8"
testImplementation "uk.org.webcompere:system-stubs-core:2.1.8"
}
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
spotless {
format 'misc', {
target '**/*.gradle', '**/*.md', '**/.gitignore'
targetExclude 'build/**/*', 'out/**/*'
trimTrailingWhitespace()
leadingSpacesToTabs()
endWithNewline()
}
java {
importOrder 'java', 'javax', 'org', 'com', 'dev.jbang', ''
removeUnusedImports()
eclipse().configFile "misc/eclipse_formatting_nowrap.xml"
targetExclude 'build/**/*'
}
format 'xml', {
targetExclude 'build/test-results', fileTree('.idea')
target '**/*.xml', '**/*.nuspec'
}
}
test {
useJUnitPlatform()
jvmArgs = [
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED"
]
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'dev.jbang'
artifactId = 'devkitman'
from components.java
pom {
name = 'JBang JDK Manager'
description = 'Library for managing JDK installations'
url = 'https://github.com/jbangdev/jbang-devkitman'
inceptionYear = '2025'
licenses {
license {
name = 'MIT'
url = 'https://github.com/jbangdev/jbang-devkitman/blob/main/LICENSE'
}
}
developers {
developer {
id = 'maxandersen'
name = 'Max Rydahl Andersen'
}
developer {
id = 'quintesse'
name = 'Tako Schotanus'
}
}
scm {
connection = 'scm:git:https://github.com/jbangdev/jbang-devkitman'
developerConnection = 'scm:git:https://github.com/jbangdev/jbang-devkitman'
url = 'http://github.com/jbangdev/jbang-devkitman'
}
// Mark Apache HttpClient dependencies as optional
withXml {
def dependenciesNode = asNode().dependencies[0]
dependenciesNode.dependency.each { dep ->
def groupId = dep.groupId[0].text()
def artifactId = dep.artifactId[0].text()
if (groupId == 'org.apache.httpcomponents.client5' &&
(artifactId == 'httpclient5' || artifactId == 'httpclient5-cache')) {
dep.appendNode('optional', true)
}
}
}
}
}
}
repositories {
maven {
url = layout.buildDirectory.dir('staging-deploy')
}
}
}
jreleaser {
configFile = file('jreleaser.yml')
}