Skip to content

Commit 8ddd61b

Browse files
committed
HHH-10664 - Prep 6.0 feature branch - baseline Java 8
1 parent 9570f11 commit 8ddd61b

File tree

5 files changed

+93
-301
lines changed

5 files changed

+93
-301
lines changed

build.gradle

Lines changed: 93 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,17 @@ allprojects {
5454
}
5555

5656
ext {
57-
expectedGradleVersion = '2.10'
58-
hibernateTargetVersion = '5.1.1-SNAPSHOT'
57+
hibernateTargetVersion = '5.1.1-SNAPSHOT'
58+
expectedGradleVersion = '2.10'
59+
baselineJavaVersion = '1.8'
5960

6061
osgiExportVersion = hibernateTargetVersion.replaceAll( '-SNAPSHOT', '.SNAPSHOT' )
6162
}
6263

6364
idea {
6465
project {
65-
jdkName = '1.6'
66-
languageLevel = '1.6'
66+
jdkName = baselineJavaVersion
67+
languageLevel = baselineJavaVersion
6768

6869
vcs = 'Git'
6970
}
@@ -110,6 +111,9 @@ subprojects { subProject ->
110111

111112
apply plugin: org.hibernate.build.HibernateBuildPlugin
112113

114+
sourceCompatibility = rootProject.baselineJavaVersion
115+
targetCompatibility = rootProject.baselineJavaVersion
116+
113117
configurations {
114118
provided {
115119
// todo : need to make sure these are non-exported
@@ -159,6 +163,8 @@ subprojects { subProject ->
159163
}
160164
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
161165

166+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167+
// compilation
162168
task compile
163169
compile.dependsOn compileJava, processResources, compileTestJava, processTestResources
164170

@@ -167,6 +173,70 @@ subprojects { subProject ->
167173
compileClasspath += configurations.jbossLoggingTool
168174
}
169175

176+
subProject.getConvention().findPlugin( JavaPluginConvention.class ).sourceSets.each { sourceSet ->
177+
JavaCompile javaCompileTask = project.tasks.findByName( sourceSet.compileJavaTaskName ) as JavaCompile
178+
179+
// NOTE : this aptDir stuff is needed until we can have IntelliJ run annotation processors for us
180+
// which cannot happen until we can fold hibernate-testing back into hibernate-core/src/test
181+
// which cannot happen until... ugh
182+
File aptDir = subProject.file( "${subProject.buildDir}/generated-src/apt/${sourceSet.name}" )
183+
sourceSet.allJava.srcDir( aptDir )
184+
185+
javaCompileTask.options.compilerArgs += [
186+
"-nowarn",
187+
"-encoding", "UTF-8",
188+
"-s", "${aptDir.absolutePath}"
189+
]
190+
javaCompileTask.doFirst {
191+
aptDir.mkdirs()
192+
}
193+
}
194+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195+
196+
197+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
198+
// testing
199+
subProject.tasks.withType( Test.class ).all { task ->
200+
task.jvmArgs += [
201+
'-XX:+HeapDumpOnOutOfMemoryError',
202+
"-XX:HeapDumpPath=${project.file( "${project.buildDir}/OOM-dump.hprof" ).absolutePath}",
203+
'-XX:MetaspaceSize=512M'
204+
]
205+
206+
task.maxHeapSize = '2G'
207+
208+
task.systemProperties['hibernate.test.validatefailureexpected'] = true
209+
task.systemProperties += System.properties.findAll { it.key.startsWith( "hibernate.") }
210+
211+
// uncomment to help identify pauses in test executions : where they occur
212+
// task.beforeTest { descriptor ->
213+
// println "Starting test: " + descriptor
214+
// }
215+
// task.afterTest { descriptor ->
216+
// println "Completed test: " + descriptor
217+
// }
218+
}
219+
220+
processTestResources.doLast( {
221+
copy {
222+
from( sourceSets.test.java.srcDirs ) {
223+
include '**/*.properties'
224+
include '**/*.xml'
225+
}
226+
into sourceSets.test.output.classesDir
227+
}
228+
copy {
229+
ext.targetDir = file( "${buildDir}/resources/test" )
230+
from file('src/test/resources')
231+
into targetDir
232+
filter( ReplaceTokens, tokens: dbBundle[db] );
233+
}
234+
} )
235+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236+
237+
238+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
239+
// artifact
170240
jar {
171241
manifest = osgiManifest {
172242
// GRADLE-1411: Even if we override Imports and Exports
@@ -197,38 +267,23 @@ subprojects { subProject ->
197267
}
198268
}
199269

200-
test {
201-
systemProperties['hibernate.test.validatefailureexpected'] = true
202-
systemProperties += System.properties.findAll { it.key.startsWith( "hibernate.") }
203-
204-
// beforeTest { descriptor ->
205-
// println "Starting test: " + descriptor
206-
// }
270+
task sourcesJar(type: Jar, dependsOn: compileJava) {
271+
from sourceSets.main.allSource
272+
classifier = 'sources'
273+
}
207274

208-
// afterTest { descriptor ->
209-
// println "Completed test: " + descriptor
210-
// }
275+
sourcesJar {
276+
manifest = jar.manifest
211277
}
278+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212279

213-
processTestResources.doLast( {
214-
copy {
215-
from( sourceSets.test.java.srcDirs ) {
216-
include '**/*.properties'
217-
include '**/*.xml'
218-
}
219-
into sourceSets.test.output.classesDir
220-
}
221-
copy {
222-
ext.targetDir = file( "${buildDir}/resources/test" )
223-
from file('src/test/resources')
224-
into targetDir
225-
filter( ReplaceTokens, tokens: dbBundle[db] );
226-
}
227-
} )
228280

281+
282+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
283+
// IDE options
229284
idea {
230285
module {
231-
jdkName = javaTarget.version
286+
jdkName = subProject.sourceCompatibility
232287

233288
excludeDirs = [file( ".gradle" )]
234289
excludeDirs += file( "$buildDir/classes" )
@@ -249,8 +304,8 @@ subprojects { subProject ->
249304

250305
eclipse {
251306
jdt {
252-
sourceCompatibility = javaTarget.version
253-
targetCompatibility = javaTarget.version
307+
sourceCompatibility = subProject.sourceCompatibility
308+
targetCompatibility = subProject.targetCompatibility
254309
}
255310
classpath {
256311
plusConfigurations.add( configurations.provided )
@@ -261,9 +316,11 @@ subprojects { subProject ->
261316
// TODO: Eclipse's annotation processor handling is also fairly stupid (and completely lacks in the
262317
// Gradle plugin). For now, just compile first in order to get the logging classes.
263318
eclipseClasspath.dependsOn compile
319+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
264320

265321

266-
// Report configs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
322+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
323+
// Report configs
267324
checkstyle {
268325
sourceSets = [ subProject.sourceSets.main ]
269326
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
@@ -303,6 +360,8 @@ subprojects { subProject ->
303360
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
304361

305362

363+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
364+
// Publishing
306365
publishing {
307366
publications {
308367
mavenJava(MavenPublication) {
@@ -327,15 +386,8 @@ subprojects { subProject ->
327386
destination = file( "$subProject.buildDir/generated-pom.xml" )
328387
}
329388
}
389+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330390

331-
task sourcesJar(type: Jar, dependsOn: compileJava) {
332-
from sourceSets.main.allSource
333-
classifier = 'sources'
334-
}
335-
336-
sourcesJar {
337-
manifest = jar.manifest
338-
}
339391
}
340392

341393
task release(type: Task, dependsOn: 'release:release')

0 commit comments

Comments
 (0)