-
Notifications
You must be signed in to change notification settings - Fork 26
/
alpn-boot.gradle
56 lines (52 loc) · 1.61 KB
/
alpn-boot.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
// This adds alpn-boot to the boot classpath for for testing h2 using okhttp
// https://github.com/square/okhttp/wiki/Building#desktop-testing-with-maven
dependencies {
testCompile group: 'org.mortbay.jetty.alpn', name: 'alpn-boot', version: getAlpnVersion()
}
ext {
def alpn_boot_jar = project.configurations.testCompile.find { it.name.startsWith("alpn-boot-") }
xbcp = "-Xbootclasspath/p:$alpn_boot_jar"
}
test {
jvmArgs = [xbcp]
testLogging {
showStandardStreams = true
}
}
def getAlpnVersion() {
def javaVersion = System.getProperty("java.version")
def matcher = (javaVersion =~ /_(\d+)(-.*)?/)
def version = matcher.find() ? Integer.parseInt(matcher.group(1)) : 0
def alpnVersion = {
switch(version) {
case 0..24:
return '8.1.0.v20141016'
case 25..30:
return '8.1.2.v20141202'
case 31..50:
return '8.1.3.v20150130'
case 51..59:
return '8.1.4.v20150727'
case 60..64:
return '8.1.5.v20150921'
case 65..70:
return '8.1.6.v20151105'
case 71..77:
return '8.1.7.v20160121'
case 78..101:
return '8.1.8.v20160420'
case 102..111:
return '8.1.9.v20160720'
case 112..120:
return '8.1.10.v20161026'
case 121..160:
return '8.1.11.v20170118'
case 161..181:
return '8.1.12.v20180117'
default:
throw new IllegalStateException("ALPN version not defined for Java version: ${javaVersion}; extracted minor version: ${version}")
}
}()
// project.logger.quiet("Resolved ALPN version ${alpnVersion} for Java ${javaVersion}")
return alpnVersion
}