forked from grails/gorm-hibernate5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
132 lines (118 loc) · 5.41 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
dependencies {
api "org.slf4j:slf4j-api:$slf4jVersion"
api "org.codehaus.groovy:groovy:$groovyVersion"
api("org.grails:grails-datastore-gorm:$gormVersion")
api "org.springframework:spring-orm:$springVersion"
api("org.hibernate:hibernate-core:$hibernate5Version") {
exclude group:'commons-logging', module:'commons-logging'
exclude group:'com.h2database', module:'h2'
exclude group:'commons-collections', module:'commons-collections'
exclude group:'org.slf4j', module:'jcl-over-slf4j'
exclude group:'org.slf4j', module:'slf4j-api'
exclude group:'org.slf4j', module:'slf4j-log4j12'
exclude group:'xml-apis', module:'xml-apis'
}
api("org.hibernate:hibernate-validator:$hibernateValidatorVersion") {
exclude group:'commons-logging', module:'commons-logging'
exclude group:'commons-collections', module:'commons-collections'
exclude group:'org.slf4j', module:'slf4j-api'
}
api 'javax.validation:validation-api:2.0.1.Final'
runtimeOnly('javax.el:javax.el-api:3.0.1-b06')
runtimeOnly "javax.xml.bind:jaxb-api:$jaxbVersion"
runtimeOnly "com.sun.xml.bind:jaxb-impl:$jaxbVersion"
compileOnly ("net.sf.ehcache:ehcache-core:2.6.11") {
exclude group: 'commons-logging', module:'commons-logging'
}
compileOnly ("org.hibernate:hibernate-ehcache:$hibernate5Version") {
exclude group:'commons-collections', module:'commons-collections'
exclude group:'commons-logging', module:'commons-logging'
exclude group:'com.h2database', module:'h2'
exclude group:'net.sf.ehcache', module:'ehcache'
exclude group:'net.sf.ehcache', module:'ehcache-core'
exclude group:'org.hibernate', module:'hibernate-core'
exclude group:'org.slf4j', module:'jcl-over-slf4j'
exclude group:'org.slf4j', module:'slf4j-api'
exclude group:'org.slf4j', module:'slf4j-log4j12'
exclude group:'xml-apis', module:'xml-apis'
}
testImplementation "org.codehaus.groovy:groovy-test-junit5:$groovyVersion"
testImplementation "org.codehaus.groovy:groovy-sql:$groovyVersion"
testImplementation "org.codehaus.groovy:groovy-json:$groovyVersion"
testImplementation "org.grails:grails-datastore-gorm-tck:$gormVersion", {
exclude group: "org.spockframework"
}
testImplementation "com.h2database:h2:$h2Version"
testImplementation "net.sf.ehcache:ehcache-core:2.6.11"
testImplementation "org.hibernate:hibernate-ehcache:$hibernate5Version"
// groovy proxy fixes bytebuddy to be a bit smarter when it comes to groovy metaClass
testImplementation "org.yakworks:hibernate-groovy-proxy:$hibernateGroovyProxy"
testImplementation "org.apache.tomcat:tomcat-jdbc:$tomcatVersion"
testRuntimeOnly "org.springframework:spring-aop:$springVersion"
testRuntimeOnly "org.apache.tomcat.embed:tomcat-embed-logging-log4j:$tomcatLog4jVersion"
testRuntimeOnly "org.slf4j:slf4j-simple:$slf4jVersion"
testRuntimeOnly "org.slf4j:jcl-over-slf4j:$slf4jVersion"
// The groovydoc task needs the Hibernate 4.x jars in the classpath
documentation("org.hibernate:hibernate-core:${hibernate5Version}")
}
test {
if (isTravisBuild || isCiBuild) {
maxParallelForks = 2
forkEvery = 10
}
else {
maxParallelForks = 4
forkEvery = 20
}
jvmArgs = ['-Xmx1028M']
afterSuite {
System.out.print('.')
System.out.flush()
}
}
test.doFirst {
def toBaseClassRelativePathWithoutExtension = { String base, String classFile ->
if (classFile.startsWith(base)) {
def sansClass = classFile[0 .. classFile.size() - ".class".size() - 1]
def dollarIndex = sansClass.indexOf('$')
def baseClass = dollarIndex > 0 ? sansClass[0..dollarIndex - 1] : sansClass
def relative = baseClass - base - '/'
relative
}
else {
null
}
}
def tckClassesFile = project
.configurations
.testCompileClasspath
.resolvedConfiguration
.getResolvedArtifacts()
.find { resolved ->
resolved.moduleVersion.id.name == 'grails-datastore-gorm-tck'
}.file
def tckClassesDir = project.file("${project.buildDir}/tck")
copy {
from zipTree(tckClassesFile)
into tckClassesDir
}
copy {
from tckClassesDir
into sourceSets.test.output.classesDirs.find { it.path.contains('classes' + File.separator + 'groovy') }
include "**/*.class"
exclude { details ->
// Do not copy across any TCK class (or nested classes of that class)
// If there is a corresponding source file in the particular modules
// test source tree. Allows a module to override a test/helper.
if (!details.file.isFile()) {
return false
}
def candidatePath = details.file.absolutePath
def relativePath = toBaseClassRelativePathWithoutExtension(tckClassesDir.absolutePath, candidatePath)
if (relativePath == null) {
throw new IllegalStateException("$candidatePath does not appear to be in the TCK")
}
project.file("src/test/groovy/${relativePath}.groovy").exists()
}
}
}