-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
267 lines (238 loc) · 7.24 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
}
repositories {
mavenCentral()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
withSourcesJar()
withJavadocJar()
}
tasks.withType(JavaCompile) {
options.compilerArgs += "--enable-preview"
}
tasks.withType(Test) {
jvmArgs += "--enable-preview"
jvmArgs += "--add-opens=jdk.httpserver/com.sun.net.httpserver=ALL-UNNAMED"
systemProperty("java.util.logging.config.file","logging.properties")
systemProperty("com.sun.net.httpserver.HttpServerProvider","robaho.net.httpserver.DefaultHttpServerProvider")
systemProperty("robaho.net.httpserver.http2OverSSL","true")
systemProperty("robaho.net.httpserver.http2OverNonSSL","true")
// systemProperty("robaho.net.httpserver.http2MaxConcurrentStreams","5000")
// systemProperty("robaho.net.httpserver.http2DisableFlushDelay","true")
systemProperty("robaho.net.httpserver.http2OverSSL","true")
systemProperty("robaho.net.httpserver.http2OverNonSSL","true")
// systemProperty("javax.net.debug","ssl:handshake:verbose:keymanager:trustmanager")
}
tasks.withType(JavaExec) {
jvmArgs += "--enable-preview"
systemProperty("java.util.logging.config.file","logging.properties")
systemProperty("com.sun.net.httpserver.HttpServerProvider","robaho.net.httpserver.DefaultHttpServerProvider")
systemProperty("robaho.net.httpserver.http2OverSSL","true")
systemProperty("robaho.net.httpserver.http2OverNonSSL","true")
systemProperty("robaho.net.httpserver.http2InitialWindowSize","1024000")
systemProperty("robaho.net.httpserver.http2ConnectionWindowSize","1024000000")
systemProperty("robaho.net.httpserver.EnableStats","true")
systemProperty("robaho.net.httpserver.EnableDebug","true")
}
dependencies {
testImplementation 'org.testng:testng:7.8.0'
}
configurations {
testMainsCompile.extendsFrom testCompile
testMainsRuntime.extendsFrom testMainsCompile
}
test {
useTestNG()
testLogging {
// events "passed", "skipped", "failed", "standard_out", "standard_error"
events "failed"
}
}
sourceSets {
main {
java {
srcDirs = [ 'src/main/java' ]
}
}
test {
java {
srcDirs = [
'src/test/extras',
'src/test/java',
'src/test/java_default/bugs',
'src/test/java_default/HttpExchange'
]
}
}
testMains {
java {
srcDirs = ['src/test/test_mains']
compileClasspath = test.output + main.output + configurations.testMainsCompile
runtimeClasspath = output + compileClasspath + configurations.testMainsRuntime
}
resources {
srcDirs = [ 'src/test/resources' ]
}
}
}
def getGitVersion () {
def output = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-list', '--tags', '--max-count=1'
standardOutput = output
}
def revision = output.toString().trim()
output.reset()
exec {
commandLine 'git', 'describe', '--tags', revision
standardOutput = output
}
return output.toString().trim()
}
version = getGitVersion()
task showGitVersion {
doLast {
println "project version is "+version
}
}
build {
doFirst {
getGitVersion
}
}
jar {
manifest {
attributes(
"Implementation-Title": project.name,
"Implementation-Version": version)
}
}
task runSingleUnitTest(type: Test) {
outputs.upToDateWhen { false }
dependsOn testClasses
filter {
includeTestsMatching 'InputNotRead'
}
useTestNG()
}
/** used for development to run a single test */
task runSingleMainTest(type: Test) {
outputs.upToDateWhen { false }
dependsOn testMainsClasses
doLast {
def testname = "B6361557"
println jvmArgs
println systemProperties
def props = systemProperties
javaexec {
classpath sourceSets.testMains.runtimeClasspath
main testname
systemProperties = props
// debug true
}
}
}
task testMainsTest(type: Test) {
dependsOn testMainsClasses
doLast {
def files = sourceSets.testMains.allJava
def is = System.in
files.each { file ->
def fileWithoutExt = file.name.take(file.name.lastIndexOf('.'))
def props = systemProperties
println " *** $fileWithoutExt ***"
javaexec {
classpath sourceSets.testMains.runtimeClasspath
main fileWithoutExt
systemProperties props
standardInput is
}
}
}
}
task runSimpleFileServer(type: JavaExec) {
doFirst {
mkdir 'fileserver'
}
dependsOn testClasses
classpath sourceSets.test.runtimeClasspath
main "SimpleFileServer"
args = ['fileserver','8080','fileserver/logfile.txt']
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(23)
}
// debugOptions {
// enabled = true
// suspend = true
// }
}
task testJar(type: Jar) {
archiveClassifier.set("test")
from sourceSets.test.output, sourceSets.testMains.output
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task runAllTests(type: Test) {
dependsOn test
dependsOn testMainsTest
}
publish {
dependsOn runAllTests
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'io.github.robaho'
artifactId = 'httpserver'
from components.java
pom {
name = 'HttpServer'
description = 'A zero dependency implementation of the JDK httpserver designed for Virtual Threads. Includes websocket and Http2 support.'
signing {
sign publishing.publications.maven
sign configurations.archives
}
url = 'https://github.com/robaho/httpserver'
scm {
url = 'https://github.com/robaho/httpserver.git'
}
licenses {
license {
name = 'gnu v2.0 with classpath exception'
url = 'https://www.gnu.org/software/classpath/license.html'
}
license {
name = 'nanohttpd'
url = 'https://github.com/NanoHttpd/nanohttpd/blob/efb2ebf85a2b06f7c508aba9eaad5377e3a01e81/LICENSE.md'
}
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'robaho'
name = 'Robert Engels'
email = '[email protected]'
}
}
}
}
}
repositories {
maven {
name = "OSSRH"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = "$maven_user"
password = "$maven_password"
}
}
}
}