forked from robaho/httpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
202 lines (179 loc) · 5.3 KB
/
build.gradle
File metadata and controls
202 lines (179 loc) · 5.3 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
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
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("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")
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
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' ]
}
}
}
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
}
}
}
}
/** used for developmet to run a single test */
task testSingleTest(type: Test) {
dependsOn testMainsClasses
doLast {
def testname = "Test1"
println jvmArgs
println systemProperties
def props = systemProperties
javaexec {
classpath sourceSets.testMains.runtimeClasspath
main testname
systemProperties = props
// debug true
}
}
}
task runSimpleFileServer(type: Test) {
dependsOn testClasses
doLast {
def props = systemProperties
mkdir 'fileserver'
javaexec {
classpath sourceSets.test.runtimeClasspath
main "SimpleFileServer"
systemProperties = props
args = ['fileserver','8888','fileserver/logfile.txt']
// debug true
}
}
}
task run(type: JavaExec) {
classpath sourceSets.testMains.runtimeClasspath
dependsOn testMainsClasses
}
publish {
dependsOn test
dependsOn testMainsTest
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'io.github.robaho'
artifactId = 'httpserver'
version = "1.0.7"
from components.java
pom {
name = 'HttpServer'
description = 'A zero dependency implements of the JDK httpserver designed for Virtual Threads. Includes websocket 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'
url = 'https://www.gnu.org/licenses/old-licenses/gpl-2.0.html'
}
license {
name = 'nanohttpd'
url = 'https://github.com/NanoHttpd/nanohttpd/blob/efb2ebf85a2b06f7c508aba9eaad5377e3a01e81/LICENSE.md'
}
}
developers {
developer {
id = 'robaho'
name = 'Robert Engels'
email = 'robaho@me.com'
}
}
}
}
}
repositories {
maven {
name = "OSSRH"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = "$maven_user"
password = "$maven_password"
}
}
}
}