-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
222 lines (186 loc) · 6 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
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
import aQute.bnd.osgi.Processor
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:6.2.0'
}
}
apply plugin: 'java-library'
apply plugin: 'biz.aQute.bnd.builder'
apply plugin: 'signing'
apply plugin: 'maven-publish'
group = 'org.jdrupes.httpcodec'
description = "HTTP coders and decoders for non-blocking I/O"
ext.releaseVersion = "3.1.0"
ext.isSnapshot = false
version = releaseVersion + (isSnapshot ? "-SNAPSHOT" : "")
archivesBaseName = 'httpcodec'
repositories {
mavenCentral()
}
ext {
isCiBuild = System.getenv().get("CI") == 'true'
isJitPackBuild = System.getenv().get("JITPACK") == 'true'
}
configurations {
javadocTaglets
}
dependencies {
implementation 'jakarta.activation:jakarta.activation-api:[2.1.0,3.0.0)'
testImplementation 'junit:junit:4.12'
testRuntimeOnly 'org.eclipse.angus:angus-activation:[2.0.0,3.0.0)'
// Use gradle mechanims to get the artifact to baseline against.
// We baseline against the previous release
// (latest excluding current)
baseline("${group}:${archivesBaseName}:(,${releaseVersion})") {
transitive false
}
}
// Configure sensible layout
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'resources'
}
}
test {
java {
srcDir 'test'
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
String bundleVersion = releaseVersion +
(isSnapshot ? ".-\${tstamp}-SNAPSHOT" : ".rel")
jar {
manifest {
attributes('Bundle-Version': bundleVersion)
}
}
if (project.hasProperty('ignoreBaselineFailures')) {
baseline {
ignoreFailures true
}
}
configurations {
markdownDoclet
javadocTaglets
}
dependencies {
markdownDoclet "org.jdrupes.mdoclet:doclet:3.1.0"
javadocTaglets "org.jdrupes.taglets:plantuml-taglet:2.0.1"
}
ext.javadocDestinationDir = file("../org.jdrupes.httpcodec.gh-pages/javadoc")
task java11doc(type: JavaExec) {
enabled = JavaVersion.current() == JavaVersion.VERSION_17 && !isJitPackBuild
dependsOn classes
inputs.file "overview.md"
inputs.dir "src"
jvmArgs = ['--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED']
classpath sourceSets.main.compileClasspath
classpath files(tasks.jar)
outputs.dir(javadocDestinationDir)
main = 'jdk.javadoc.internal.tool.Main'
args = ['-doctitle', "JDrupes HTTP Codecs ${project.version}",
'-use',
'-linksource',
'-link', 'https://docs.oracle.com/en/java/javase/11/docs/api/',
'--add-exports', 'jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED',
'--add-exports', 'jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'-doclet', 'org.jdrupes.mdoclet.MDoclet',
'-docletpath', configurations.markdownDoclet.files.asType(List).join(":"),
'--disable-auto-highlight',
'-tagletpath', configurations.javadocTaglets.files.asType(List).join(":"),
'-taglet', 'org.jdrupes.taglets.plantUml.PlantUml',
'-taglet', 'org.jdrupes.taglets.plantUml.StartUml',
'-taglet', 'org.jdrupes.taglets.plantUml.EndUml',
'-overview', 'overview.md',
'-d', javadocDestinationDir,
'-sourcepath', 'src/',
'-subpackages', 'org.jdrupes.httpcodec',
'-bottom', file("misc/javadoc.bottom.txt").text,
'--allow-script-in-comments',
'-Xdoclint:-html',
'--add-exports=jdk.javadoc/jdk.javadoc.internal.doclets.formats.html=ALL-UNNAMED'
]
ignoreExitValue true
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
classifier "sources"
}
task javadocJar(type: Jar) {
dependsOn "java11doc"
from project.javadocDestinationDir
classifier "javadoc"
}
// Allow build without signing information (e.g. travis)
if (project.hasProperty('signing.keyId')) {
signing {
sign configurations.archives
}
}
// MavenPublishing
publishing {
repositories {
maven {
name "snapshot"
url "https://oss.sonatype.org/content/repositories/snapshots/"
credentials {
username project.properties['sonatypeUsername'] ?: "nouser"
password project.properties['sonatypePassword'] ?: "nopass"
}
}
maven {
name "release"
url "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username project.properties['sonatypeUsername'] ?: "nouser"
password project.properties['sonatypePassword'] ?: "nopass"
}
}
}
}
// Additional configuration of publishing
apply plugin: ConfigurePublishing
configurePublishing {
withPomXml {
asNode().with {
appendNode('url', 'https://github.com/mnlipp/jdrupes-httpcodec')
appendNode('scm').with {
appendNode('url', 'scm:[email protected]:mnlipp/jdrupes-httpcodec.git')
appendNode('connection', 'scm:[email protected]:mnlipp/jdrupes-httpcodec.git')
appendNode('developerConnection', '[email protected]:mnlipp/jdrupes-httpcodec.git')
}
appendNode('licenses').with {
appendNode('license').with {
appendNode('name', 'LGPL 3.0')
appendNode('url', 'https://www.gnu.org/licenses/lgpl-3.0.en.html')
appendNode('distribution', 'repo')
}
}
appendNode('developers').with {
appendNode('developer').with {
appendNode('id', 'mnlipp')
appendNode('name', 'Michael N. Lipp')
}
}
}
}
}
jar {
into("META-INF/maven/$project.group/$project.name") {
from { generatePomFileForMavenPublication }
rename ".*", "pom.xml"
}
}
apply from: "${project.rootDir}/gradle/eclipse.gradle"