-
Notifications
You must be signed in to change notification settings - Fork 355
Expand file tree
/
Copy pathbuild.gradle
More file actions
85 lines (72 loc) · 3.17 KB
/
Copy pathbuild.gradle
File metadata and controls
85 lines (72 loc) · 3.17 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
import org.datanucleus.enhancer.DataNucleusEnhancer
buildscript {
repositories {
mavenLocal()
if (project.rootProject.hasProperty("mavenRepositoryProxy")) {
maven {
url project.rootProject.property("mavenRepositoryProxy")
allowInsecureProtocol true
}
}
mavenCentral()
}
dependencies {
classpath group: 'org.datanucleus', name: 'datanucleus-core', version: '4.0.5'
classpath group: 'org.datanucleus', name: 'datanucleus-api-jdo', version: '4.0.5'
classpath group: 'org.datanucleus', name: 'javax.jdo', version: '3.2.0-m1'
}
}
muzzle {
// 2 libraries are instrumented.
// Muzzle is tested by keeping one version fixed and modifying the other
// Ideally, muzzle would handle this directly and keep both versions in lockstep
pass {
group = "org.datanucleus"
module = "datanucleus-core"
versions = "[4.0.5,]"
extraDependency "org.datanucleus:datanucleus-api-jdo:4.0.5"
extraDependency "org.datanucleus:javax.jdo:3.2.0-m1"
}
pass {
group = "org.datanucleus"
module = "datanucleus-api-jdo"
versions = "[4.0.5,]"
extraDependency "org.datanucleus:datanucleus-core:4.0.5"
extraDependency "org.datanucleus:javax.jdo:3.2.0-m1"
}
}
apply from: "${rootDir}/gradle/java.gradle"
def datanucleusVersion = '4.0.5'
// Datanucleus modifies persistable objects with bytecode manipulation
// The unofficial plugin (org.rm3l.datanucleus-gradle-plugin) doesn't work with our build
// The enhancement is done manually here for the test classes
// LatestDepTest can't be used because the enhancer class generates incompatible code
// Specifically, org.datanucleus.enhancer.Persistable changes package
// Only one version can be set as the script classpath in the 'buildScript' block
tasks.register('enhance') {
doLast {
def outputUrls = (sourceSets.test.output.classesDirs.files + sourceSets.test.output.resourcesDir)
.collect { it.toURI().toURL() } as URL[]
def testClassloader = new URLClassLoader(outputUrls, Thread.currentThread().getContextClassLoader())
DataNucleusEnhancer enhancer = new DataNucleusEnhancer("JDO", null)
enhancer.setVerbose(true).addPersistenceUnit("testPersistenceUnit")
enhancer.setSystemOut(true)
enhancer.setClassLoader(testClassloader)
enhancer.enhance()
}
dependsOn "testClasses"
}
tasks.withType(Test).configureEach {
dependsOn "enhance"
}
dependencies {
compileOnly group: 'org.datanucleus', name: 'datanucleus-core', version: datanucleusVersion
compileOnly group: 'org.datanucleus', name: 'datanucleus-api-jdo', version: datanucleusVersion
compileOnly group: 'org.datanucleus', name: 'javax.jdo', version: '3.2.0-m1'
testImplementation project(':dd-java-agent:instrumentation:jdbc')
testImplementation group: 'org.datanucleus', name: 'datanucleus-core', version: datanucleusVersion
testImplementation group: 'org.datanucleus', name: 'datanucleus-api-jdo', version: datanucleusVersion
testImplementation group: 'org.datanucleus', name: 'datanucleus-rdbms', version: datanucleusVersion
testImplementation group: 'org.datanucleus', name: 'javax.jdo', version: '3.2.0-m1'
testImplementation group: 'com.h2database', name: 'h2', version: '1.3.169'
}