forked from ben-manes/caffeine
/
build.gradle
101 lines (87 loc) · 3.37 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
/**
* JCache compatibility adapter.
*/
configurations {
tck
doc
}
dependencies {
api project(':caffeine')
api libraries.jcache
api libraries.config
api libraries.jsr330
api libraries.osgiComponentAnnotations
testImplementation libraries.guava
testImplementation testLibraries.junit
testImplementation testLibraries.testng
testImplementation testLibraries.mockito
testImplementation testLibraries.hamcrest
testImplementation testLibraries.jcacheTck
testImplementation testLibraries.jcacheTckTests
testImplementation testLibraries.jcacheGuice
testImplementation testLibraries.guavaTestLib
tck dependencies.create(testLibraries.jcacheTckTests) {
transitive = false
}
doc "${libraries.jcache}:javadoc"
}
compileJava {
modularity.inferModulePath = false
}
jar.manifest {
attributes 'Bundle-SymbolicName': 'com.github.ben-manes.caffeine.jcache'
attributes 'Import-Package': [
'!org.checkerframework.checker.*',
'*'].join(',')
attributes 'Export-Package': [
'com.github.benmanes.caffeine.jcache.spi',
'com.github.benmanes.caffeine.jcache.copy',
'com.github.benmanes.caffeine.jcache.configuration'].join(',')
attributes 'Automatic-Module-Name': 'com.github.benmanes.caffeine.jcache'
attributes '-exportcontents': '${removeall;${packages;VERSIONED};${packages;CONDITIONAL}}'
attributes '-snapshot': 'SNAPSHOT'
attributes '-noextraheaders': true
}
task unzipJCacheJavaDoc(type: Copy, group: 'Build', description: 'Unzips the JCache JavaDoc') {
from configurations.doc.collect { zipTree(it) }
into { "${buildDir}/jcache-docs" }
}
javadoc.dependsOn(unzipJCacheJavaDoc)
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
javadoc.options.linksOffline(
"https://static.javadoc.io/javax.cache/cache-api/${versions.jcache}/",
"${buildDir}/jcache-docs",
)
test {
useTestNG()
}
task unzipTestKit(type: Copy, group: 'Build', description: 'Unzips the JCache TCK') {
from configurations.tck.collect { zipTree(it) }
into { "${buildDir}/tck" }
}
task testCompatibilityKit(type: Test, group: 'Build', description: 'Runs the JCache TCK') {
dependsOn(unzipTestKit)
onlyIf { compileTestJava.didWork || unzipTestKit.didWork }
useJUnit()
testClassesDirs = files("${buildDir}/tck")
def pkg = 'com.github.benmanes.caffeine.jcache'
systemProperty 'java.net.preferIPv4Stack', 'true'
systemProperty 'javax.cache.Cache', "${pkg}.CacheProxy"
systemProperty 'javax.cache.Cache.Entry', "${pkg}.EntryProxy"
systemProperty 'javax.cache.CacheManager', "${pkg}.CacheManagerImpl"
systemProperty 'org.jsr107.tck.management.agentId', 'CaffeineMBeanServer'
systemProperty 'javax.management.builder.initial', "${pkg}.management.JCacheMBeanServerBuilder"
}
test.dependsOn(testCompatibilityKit)
task osgiTests(type: Test, group: 'Build', description: 'Isolated OSGi tests') {
useJUnit()
tasks.test.dependsOn(it)
systemProperty 'config.osgi.version', versions.config
systemProperty 'jcache.osgi.version', versions.jcache
systemProperty 'checkerAnnotations.version', versions.checkerFramework
systemProperty 'felixScr.version', testVersions.felixScr
systemProperty 'osgiUtil.function', testVersions.osgiUtilFunction
systemProperty 'osgiUtil.promise', testVersions.osgiUtilPromise
systemProperty 'caffeine.osgi.jar', project(':caffeine').jar.archivePath.path
systemProperty 'caffeine-jcache.osgi.jar', project(':jcache').jar.archivePath.path
}