HHH-8733 - General build cleanup
This commit is contained in:
parent
5acd232e10
commit
055a750a53
643
build.gradle
643
build.gradle
|
@ -36,6 +36,7 @@ buildscript {
|
||||||
classpath 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1'
|
classpath 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1'
|
||||||
classpath 'org.hibernate.build.gradle:hibernate-matrix-testing:1.0.0-SNAPSHOT'
|
classpath 'org.hibernate.build.gradle:hibernate-matrix-testing:1.0.0-SNAPSHOT'
|
||||||
classpath 'org.hibernate.build.gradle:version-injection-plugin:1.0.0'
|
classpath 'org.hibernate.build.gradle:version-injection-plugin:1.0.0'
|
||||||
|
classpath 'org.hibernate.build.gradle:gradle-apt:1.0.0-SNAPSHOT'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +82,16 @@ def osgiDescription() {
|
||||||
// by default just reuse the pomDescription
|
// by default just reuse the pomDescription
|
||||||
return pomDescription()
|
return pomDescription()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def boolean needsLoggingGeneration() {
|
||||||
|
// by default
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
def SourceSet getMetaGenTargetSourceSet() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
subprojects { subProject ->
|
subprojects { subProject ->
|
||||||
|
@ -95,376 +106,358 @@ subprojects { subProject ->
|
||||||
|
|
||||||
// minimize changes, at least for now (gradle uses 'build' by default)..
|
// minimize changes, at least for now (gradle uses 'build' by default)..
|
||||||
buildDir = "target"
|
buildDir = "target"
|
||||||
if ( ! subProject.name.startsWith( 'release' ) && ! subProject.name.startsWith( 'documentation' ) ) {
|
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'maven-publish'
|
|
||||||
apply plugin: 'maven-publish-auth'
|
|
||||||
apply plugin: 'maven' // temporary, still needed for install task until bug with publishToMavenLocal task is fixed
|
|
||||||
apply plugin: 'osgi'
|
|
||||||
|
|
||||||
apply from: "${rootProject.projectDir}/utilities.gradle"
|
if ( subProject.name.startsWith( 'release' ) || subProject.name.startsWith( 'documentation' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
apply plugin: 'findbugs'
|
// everything below here in the closure applies to java projects
|
||||||
apply plugin: 'checkstyle'
|
apply plugin: 'java'
|
||||||
apply plugin: 'build-dashboard'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'project-report'
|
apply plugin: 'maven-publish-auth'
|
||||||
|
apply plugin: 'osgi'
|
||||||
|
|
||||||
configurations {
|
apply from: "${rootProject.projectDir}/source-generation.gradle"
|
||||||
provided {
|
// apply from: "${rootProject.projectDir}/utilities.gradle"
|
||||||
// todo : need to make sure these are non-exported
|
|
||||||
description = 'Non-exported compile-time dependencies.'
|
|
||||||
}
|
|
||||||
jbossLoggingTool {
|
|
||||||
description = "Dependencies for running the JBoss logging AnnotationProcessor tool"
|
|
||||||
}
|
|
||||||
jaxb {
|
|
||||||
description = 'Dependencies for running ant xjc (jaxb class generation)'
|
|
||||||
}
|
|
||||||
configurations {
|
|
||||||
all*.exclude group: 'xml-apis', module: 'xml-apis'
|
|
||||||
}
|
|
||||||
animalSniffer
|
|
||||||
javaApiSignature
|
|
||||||
}
|
|
||||||
|
|
||||||
// appropriately inject the common dependencies into each sub-project
|
apply plugin: 'findbugs'
|
||||||
dependencies {
|
apply plugin: 'checkstyle'
|
||||||
compile( libraries.logging )
|
apply plugin: 'build-dashboard'
|
||||||
compile( libraries.logging_annotations )
|
apply plugin: 'project-report'
|
||||||
|
|
||||||
testCompile( libraries.junit )
|
configurations {
|
||||||
testCompile( libraries.byteman )
|
provided {
|
||||||
testCompile( libraries.byteman_install )
|
// todo : need to make sure these are non-exported
|
||||||
testCompile( libraries.byteman_bmunit )
|
description = 'Non-exported compile-time dependencies.'
|
||||||
|
}
|
||||||
|
jbossLoggingTool {
|
||||||
|
description = "Dependencies for running the JBoss logging AnnotationProcessor tool"
|
||||||
|
}
|
||||||
|
jaxb {
|
||||||
|
description = 'Dependencies for running ant xjc (jaxb class generation)'
|
||||||
|
}
|
||||||
|
configurations {
|
||||||
|
all*.exclude group: 'xml-apis', module: 'xml-apis'
|
||||||
|
}
|
||||||
|
animalSniffer
|
||||||
|
javaApiSignature
|
||||||
|
}
|
||||||
|
|
||||||
testRuntime( libraries.log4j )
|
// appropriately inject the common dependencies into each sub-project
|
||||||
testRuntime( libraries.javassist )
|
dependencies {
|
||||||
testRuntime( libraries.h2 )
|
compile( libraries.logging )
|
||||||
|
compile( libraries.logging_annotations )
|
||||||
|
|
||||||
jbossLoggingTool( libraries.logging_processor )
|
testCompile( libraries.junit )
|
||||||
|
testCompile( libraries.byteman )
|
||||||
|
testCompile( libraries.byteman_install )
|
||||||
|
testCompile( libraries.byteman_bmunit )
|
||||||
|
|
||||||
jaxb( libraries.jaxb ){
|
testRuntime( libraries.log4j )
|
||||||
exclude group: "javax.xml.stream"
|
testRuntime( libraries.javassist )
|
||||||
}
|
testRuntime( libraries.h2 )
|
||||||
jaxb( libraries.jaxb2_basics )
|
|
||||||
jaxb( libraries.jaxb2_ant )
|
|
||||||
|
|
||||||
animalSniffer ( libraries.animal_sniffer )
|
jbossLoggingTool( libraries.logging_processor )
|
||||||
javaApiSignature ( libraries.java16_signature )
|
|
||||||
}
|
|
||||||
|
|
||||||
// mac-specific stuff ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
jaxb( libraries.jaxb ){
|
||||||
ext.toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar")
|
exclude group: "javax.xml.stream"
|
||||||
if ( ext.toolsJar.exists() ) {
|
}
|
||||||
dependencies{
|
jaxb( libraries.jaxb2_basics )
|
||||||
testCompile files( toolsJar )
|
jaxb( libraries.jaxb2_ant )
|
||||||
}
|
|
||||||
}
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
targetCompatibility = rootProject.javaLanguageLevel
|
animalSniffer ( libraries.animal_sniffer )
|
||||||
sourceCompatibility = rootProject.javaLanguageLevel
|
javaApiSignature ( libraries.java16_signature )
|
||||||
|
}
|
||||||
|
|
||||||
task compile
|
// mac-specific stuff ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
compile.dependsOn compileJava, processResources, compileTestJava, processTestResources
|
ext.toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar")
|
||||||
|
if ( ext.toolsJar.exists() ) {
|
||||||
|
dependencies{
|
||||||
|
testCompile files( toolsJar )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
sourceSets.main {
|
targetCompatibility = rootProject.javaLanguageLevel
|
||||||
compileClasspath += configurations.provided
|
sourceCompatibility = rootProject.javaLanguageLevel
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets.all {
|
task compile
|
||||||
ext.aptGeneratedSourceDir = file( "${buildDir}/generated-src/apt/${name}" )
|
compile.dependsOn compileJava, processResources, compileTestJava, processTestResources
|
||||||
}
|
|
||||||
|
|
||||||
ext.standardJavacOptions = [
|
sourceSets.main {
|
||||||
"-nowarn",
|
compileClasspath += configurations.provided
|
||||||
"-encoding", "UTF-8",
|
}
|
||||||
"-source", rootProject.javaLanguageLevel,
|
|
||||||
"-target", rootProject.javaLanguageLevel
|
|
||||||
]
|
|
||||||
|
|
||||||
tasks.withType( JavaCompile.class ).all { task->
|
tasks.withType( JavaCompile.class ).all { task->
|
||||||
task.options.define(
|
task.options.compilerArgs += [
|
||||||
compilerArgs: standardJavacOptions
|
"-nowarn",
|
||||||
)
|
"-proc:none",
|
||||||
}
|
"-encoding", "UTF-8",
|
||||||
|
"-source", rootProject.javaLanguageLevel,
|
||||||
|
"-target", rootProject.javaLanguageLevel
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
ext.jbossLoggingToolClass = "org.jboss.logging.processor.apt.LoggingToolsProcessor"
|
if ( subProject.needsLoggingGeneration() ) {
|
||||||
|
addLoggingProcessor( sourceSets.main )
|
||||||
|
}
|
||||||
|
|
||||||
// alter the compileJava (src/main/java javac task) to add JBoss Logging AP hooks
|
final SourceSet metaGenSourceSet = subProject.getMetaGenTargetSourceSet();
|
||||||
compileJava {
|
if ( metaGenSourceSet != null ) {
|
||||||
classpath += configurations.jbossLoggingTool
|
addMetaGenProcessor( metaGenSourceSet )
|
||||||
|
}
|
||||||
|
|
||||||
options.compilerArgs += [
|
jar {
|
||||||
"-processor", jbossLoggingToolClass,
|
manifest = osgiManifest {
|
||||||
"-s", "$sourceSets.main.aptGeneratedSourceDir.absolutePath",
|
// GRADLE-1411: Even if we override Imports and Exports
|
||||||
"-Adebug=true",
|
// auto-generation with instructions, classesDir and classpath
|
||||||
"-AskipTranslations=true",
|
// need to be here (temporarily).
|
||||||
"-AtranslationFilesPath=${project.rootDir}/src/main/resources"
|
classesDir = sourceSets.main.output.classesDir
|
||||||
]
|
classpath = configurations.runtime
|
||||||
|
|
||||||
doFirst {
|
instruction 'Import-Package',
|
||||||
if ( !sourceSets.main.aptGeneratedSourceDir.exists() ) {
|
// Temporarily support JTA 1.1 -- Karaf and other frameworks still
|
||||||
sourceSets.main.aptGeneratedSourceDir.mkdirs()
|
// use it. Without this, the plugin generates [1.2,2).
|
||||||
}
|
'javax.transaction;version="[1.1,2)"',
|
||||||
}
|
// Tell Gradle OSGi to still dynamically import the other packages.
|
||||||
}
|
// IMPORTANT: Do not include the * in the modules' .gradle files.
|
||||||
|
// If it exists more than once, the manifest will physically contain a *.
|
||||||
|
'*'
|
||||||
|
|
||||||
task generateSources(type: Task)
|
instruction 'Bundle-Vendor', 'Hibernate.org'
|
||||||
|
instruction 'Bundle-Description', subProject.osgiDescription()
|
||||||
|
instruction 'Implementation-Url', 'http://hibernate.org'
|
||||||
|
instruction 'Implementation-Version', version
|
||||||
|
instruction 'Implementation-Vendor', 'Hibernate.org'
|
||||||
|
instruction 'Implementation-Vendor-Id', 'org.hibernate'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
jar {
|
test {
|
||||||
manifest = osgiManifest {
|
systemProperties['hibernate.test.validatefailureexpected'] = true
|
||||||
// GRADLE-1411: Even if we override Imports and Exports
|
systemProperties += System.properties.findAll { it.key.startsWith( "hibernate.") }
|
||||||
// auto-generation with instructions, classesDir and classpath
|
maxHeapSize = "1024m"
|
||||||
// need to be here (temporarily).
|
// Not strictly needed but useful to attach a profiler:
|
||||||
classesDir = sourceSets.main.output.classesDir
|
jvmArgs '-XX:MaxPermSize=256m'
|
||||||
classpath = configurations.runtime
|
}
|
||||||
|
|
||||||
instruction 'Import-Package',
|
processTestResources.doLast( {
|
||||||
// Temporarily support JTA 1.1 -- Karaf and other frameworks still
|
copy {
|
||||||
// use it. Without this, the plugin generates [1.2,2).
|
from( sourceSets.test.java.srcDirs ) {
|
||||||
'javax.transaction;version="[1.1,2)"',
|
include '**/*.properties'
|
||||||
// Tell Gradle OSGi to still dynamically import the other packages.
|
include '**/*.xml'
|
||||||
// IMPORTANT: Do not include the * in the modules' .gradle files.
|
}
|
||||||
// If it exists more than once, the manifest will physically contain a *.
|
into sourceSets.test.output.classesDir
|
||||||
'*'
|
}
|
||||||
|
} )
|
||||||
|
|
||||||
instruction 'Bundle-Vendor', 'Hibernate.org'
|
idea {
|
||||||
instruction 'Bundle-Description', osgiDescription()
|
module {
|
||||||
instruction 'Implementation-Url', 'http://hibernate.org'
|
iml {
|
||||||
instruction 'Implementation-Version', version
|
beforeMerged { module ->
|
||||||
instruction 'Implementation-Vendor', 'Hibernate.org'
|
module.dependencies.clear()
|
||||||
instruction 'Implementation-Vendor-Id', 'org.hibernate'
|
module.excludeFolders.clear()
|
||||||
}
|
}
|
||||||
}
|
whenMerged { module ->
|
||||||
|
module.dependencies*.exported = true
|
||||||
|
module.excludeFolders += module.pathFactory.path(file(".gradle"))
|
||||||
|
module.excludeFolders += module.pathFactory.path(file("$buildDir/bundles"))
|
||||||
|
module.excludeFolders += module.pathFactory.path(file("$buildDir/classes"))
|
||||||
|
module.excludeFolders += module.pathFactory.path(file("$buildDir/dependency-cache"))
|
||||||
|
module.excludeFolders += module.pathFactory.path(file("$buildDir/libs"))
|
||||||
|
module.excludeFolders += module.pathFactory.path(file("$buildDir/reports"))
|
||||||
|
module.excludeFolders += module.pathFactory.path(file("$buildDir/test-results"))
|
||||||
|
module.excludeFolders += module.pathFactory.path(file("$buildDir/tmp"))
|
||||||
|
module.excludeFolders += module.pathFactory.path(file("$buildDir/matrix"))
|
||||||
|
module.excludeFolders += module.pathFactory.path(file("$buildDir/resources"))
|
||||||
|
module.excludeFolders -= module.pathFactory.path(file("$buildDir"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
downloadSources = true
|
||||||
|
scopes.COMPILE.plus += configurations.provided
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
test {
|
eclipse {
|
||||||
systemProperties['hibernate.test.validatefailureexpected'] = true
|
classpath {
|
||||||
systemProperties += System.properties.findAll { it.key.startsWith( "hibernate.") }
|
plusConfigurations.add( configurations.provided )
|
||||||
maxHeapSize = "1024m"
|
}
|
||||||
// Not strictly needed but useful to attach a profiler:
|
}
|
||||||
jvmArgs '-XX:MaxPermSize=256m'
|
|
||||||
}
|
|
||||||
|
|
||||||
processTestResources.doLast( {
|
// eclipseClasspath will not add sources to classpath unless the dirs actually exist.
|
||||||
copy {
|
// TODO: Eclipse's annotation processor handling is also fairly stupid (and completely lacks in the
|
||||||
from( sourceSets.test.java.srcDirs ) {
|
// Gradle plugin). For now, just compile first in order to get the logging classes.
|
||||||
include '**/*.properties'
|
eclipseClasspath.dependsOn generateSources
|
||||||
include '**/*.xml'
|
|
||||||
}
|
|
||||||
into sourceSets.test.output.classesDir
|
|
||||||
}
|
|
||||||
} )
|
|
||||||
|
|
||||||
idea {
|
|
||||||
module {
|
|
||||||
iml {
|
|
||||||
beforeMerged { module ->
|
|
||||||
module.dependencies.clear()
|
|
||||||
module.excludeFolders.clear()
|
|
||||||
}
|
|
||||||
whenMerged { module ->
|
|
||||||
module.dependencies*.exported = true
|
|
||||||
module.excludeFolders += module.pathFactory.path(file(".gradle"))
|
|
||||||
module.excludeFolders += module.pathFactory.path(file("$buildDir/bundles"))
|
|
||||||
module.excludeFolders += module.pathFactory.path(file("$buildDir/classes"))
|
|
||||||
module.excludeFolders += module.pathFactory.path(file("$buildDir/dependency-cache"))
|
|
||||||
module.excludeFolders += module.pathFactory.path(file("$buildDir/libs"))
|
|
||||||
module.excludeFolders += module.pathFactory.path(file("$buildDir/reports"))
|
|
||||||
module.excludeFolders += module.pathFactory.path(file("$buildDir/test-results"))
|
|
||||||
module.excludeFolders += module.pathFactory.path(file("$buildDir/tmp"))
|
|
||||||
module.excludeFolders += module.pathFactory.path(file("$buildDir/matrix"))
|
|
||||||
module.excludeFolders += module.pathFactory.path(file("$buildDir/resources"))
|
|
||||||
module.excludeFolders -= module.pathFactory.path(file("$buildDir"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
downloadSources = true
|
|
||||||
scopes.COMPILE.plus += configurations.provided
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
eclipse {
|
|
||||||
classpath {
|
|
||||||
plusConfigurations.add( configurations.provided )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// eclipseClasspath will not add sources to classpath unless the dirs actually exist.
|
|
||||||
// TODO: Eclipse's annotation processor handling is also fairly stupid (and completely lacks in the
|
|
||||||
// Gradle plugin). For now, just compile first in order to get the logging classes.
|
|
||||||
eclipseClasspath.dependsOn("testClasses")
|
|
||||||
|
|
||||||
|
|
||||||
// Animal Sniffer ~~~~~~~~~~~~~~~~~~
|
// Animal Sniffer ~~~~~~~~~~~~~~~~~~
|
||||||
// add animal sniffer Java API checking to the main compile tasks
|
// add animal sniffer Java API checking to the main compile tasks
|
||||||
|
|
||||||
// copy the resolved Animal Sniffer signature dependency artifact to a known location and name
|
// copy the resolved Animal Sniffer signature dependency artifact to a known location and name
|
||||||
task copyJavaApiSignature(type: Copy) {
|
task copyJavaApiSignature(type: Copy) {
|
||||||
from configurations.javaApiSignature
|
from configurations.javaApiSignature
|
||||||
into "$buildDir/javaApiSignature/"
|
into "$buildDir/javaApiSignature/"
|
||||||
rename '.*signature', 'javaApi.signature'
|
rename '.*signature', 'javaApi.signature'
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare the Animal Sniffer signature copy every time (before) we compile
|
// prepare the Animal Sniffer signature copy every time (before) we compile
|
||||||
compileJava.dependsOn copyJavaApiSignature
|
compileJava.dependsOn copyJavaApiSignature
|
||||||
|
|
||||||
// and then after compilation, run the Animal Sniffer tool
|
// and then after compilation, run the Animal Sniffer tool
|
||||||
compileJava.doLast {
|
compileJava.doLast {
|
||||||
ant.taskdef(
|
ant.taskdef(
|
||||||
name: 'animalSniffer',
|
name: 'animalSniffer',
|
||||||
classname: 'org.codehaus.mojo.animal_sniffer.ant.CheckSignatureTask',
|
classname: 'org.codehaus.mojo.animal_sniffer.ant.CheckSignatureTask',
|
||||||
classpath: configurations.animalSniffer.asPath
|
classpath: configurations.animalSniffer.asPath
|
||||||
)
|
)
|
||||||
|
|
||||||
ant.animalSniffer(
|
ant.animalSniffer(
|
||||||
signature: "$buildDir/javaApiSignature/javaApi.signature",
|
signature: "$buildDir/javaApiSignature/javaApi.signature",
|
||||||
classpath: sourceSets.main.compileClasspath.asPath) {
|
classpath: sourceSets.main.compileClasspath.asPath) {
|
||||||
path( path: sourceSets.main.output.classesDir )
|
path( path: sourceSets.main.output.classesDir )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// specialized API/SPI checkstyle tasks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// specialized API/SPI checkstyle tasks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
task checkstylePublicSources(type: Checkstyle) {
|
task checkstylePublicSources(type: Checkstyle) {
|
||||||
checkstyleClasspath = checkstyleMain.checkstyleClasspath
|
checkstyleClasspath = checkstyleMain.checkstyleClasspath
|
||||||
classpath = checkstyleMain.classpath
|
classpath = checkstyleMain.classpath
|
||||||
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
|
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
|
||||||
source subProject.sourceSets.main.java.srcDirs
|
source subProject.sourceSets.main.java.srcDirs
|
||||||
// exclude generated sources
|
// exclude generated sources
|
||||||
exclude '**/generated-src/**'
|
exclude '**/generated-src/**'
|
||||||
// because cfg package is a mess mainly from annotation stuff
|
// because cfg package is a mess mainly from annotation stuff
|
||||||
exclude '**/org/hibernate/cfg/**'
|
exclude '**/org/hibernate/cfg/**'
|
||||||
exclude '**/org/hibernate/cfg/*'
|
exclude '**/org/hibernate/cfg/*'
|
||||||
// because this should only report on api/spi
|
// because this should only report on api/spi
|
||||||
exclude '**/internal/**'
|
exclude '**/internal/**'
|
||||||
exclude '**/internal/*'
|
exclude '**/internal/*'
|
||||||
ignoreFailures = false
|
ignoreFailures = false
|
||||||
showViolations = true
|
showViolations = true
|
||||||
reports {
|
reports {
|
||||||
xml {
|
xml {
|
||||||
destination "$buildDir/reports/checkstyle/public.xml"
|
destination "$buildDir/reports/checkstyle/public.xml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
// Report configs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// Report configs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
checkstyle {
|
checkstyle {
|
||||||
sourceSets = [ subProject.sourceSets.main ]
|
sourceSets = [ subProject.sourceSets.main ]
|
||||||
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
|
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
|
||||||
showViolations = false
|
showViolations = false
|
||||||
ignoreFailures = true
|
ignoreFailures = true
|
||||||
}
|
}
|
||||||
// exclude generated sources
|
// exclude generated sources
|
||||||
// unfortunately this nice easy approach does not seem to work : http://forums.gradle.org/gradle/topics/specify_excludes_to_checkstyle_task
|
// unfortunately this nice easy approach does not seem to work : http://forums.gradle.org/gradle/topics/specify_excludes_to_checkstyle_task
|
||||||
//checkstyleMain.exclude '**/generated-src/**'
|
//checkstyleMain.exclude '**/generated-src/**'
|
||||||
checkstyleMain.exclude '**/org/hibernate/hql/internal/antlr/**'
|
checkstyleMain.exclude '**/org/hibernate/hql/internal/antlr/**'
|
||||||
checkstyleMain.exclude '**/org/hibernate/hql/internal/antlr/*'
|
checkstyleMain.exclude '**/org/hibernate/hql/internal/antlr/*'
|
||||||
checkstyleMain.exclude '**/org/hibernate/sql/ordering/antlr/*'
|
checkstyleMain.exclude '**/org/hibernate/sql/ordering/antlr/*'
|
||||||
checkstyleMain.exclude '**/*_$logger*'
|
checkstyleMain.exclude '**/*_$logger*'
|
||||||
checkstyleMain.exclude '**/org/hibernate/internal/jaxb/**'
|
checkstyleMain.exclude '**/org/hibernate/internal/jaxb/**'
|
||||||
// because cfg package is a mess mainly from annotation stuff
|
// because cfg package is a mess mainly from annotation stuff
|
||||||
checkstyleMain.exclude '**/org/hibernate/cfg/**'
|
checkstyleMain.exclude '**/org/hibernate/cfg/**'
|
||||||
checkstyleMain.exclude '**/org/hibernate/cfg/*'
|
checkstyleMain.exclude '**/org/hibernate/cfg/*'
|
||||||
|
|
||||||
findbugs {
|
findbugs {
|
||||||
sourceSets = [ subProject.sourceSets.main, subProject.sourceSets.test ]
|
sourceSets = [ subProject.sourceSets.main, subProject.sourceSets.test ]
|
||||||
ignoreFailures = true
|
ignoreFailures = true
|
||||||
}
|
}
|
||||||
// exclude generated sources
|
// exclude generated sources
|
||||||
// unfortunately this nice easy approach does not seem to work : http://forums.gradle.org/gradle/topics/specify_excludes_to_checkstyle_task
|
// unfortunately this nice easy approach does not seem to work : http://forums.gradle.org/gradle/topics/specify_excludes_to_checkstyle_task
|
||||||
//findbugsMain.exclude '**/generated-src/**'
|
//findbugsMain.exclude '**/generated-src/**'
|
||||||
findbugsMain.exclude '**/org/hibernate/hql/internal/antlr/**'
|
findbugsMain.exclude '**/org/hibernate/hql/internal/antlr/**'
|
||||||
findbugsMain.exclude '**/org/hibernate/hql/internal/antlr/*'
|
findbugsMain.exclude '**/org/hibernate/hql/internal/antlr/*'
|
||||||
findbugsMain.exclude '**/org/hibernate/sql/ordering/antlr/*'
|
findbugsMain.exclude '**/org/hibernate/sql/ordering/antlr/*'
|
||||||
findbugsMain.exclude '**/*_$logger*'
|
findbugsMain.exclude '**/*_$logger*'
|
||||||
findbugsMain.exclude '**/org/hibernate/internal/jaxb/**'
|
findbugsMain.exclude '**/org/hibernate/internal/jaxb/**'
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
from components.java
|
from components.java
|
||||||
|
|
||||||
artifact sourcesJar {
|
artifact sourcesJar {
|
||||||
classifier "sources"
|
classifier "sources"
|
||||||
}
|
}
|
||||||
|
|
||||||
pom.withXml {
|
pom.withXml {
|
||||||
// append additional metadata
|
// append additional metadata
|
||||||
asNode().children().last() + {
|
asNode().children().last() + {
|
||||||
resolveStrategy = Closure.DELEGATE_FIRST
|
resolveStrategy = Closure.DELEGATE_FIRST
|
||||||
|
|
||||||
name subProject.pomName()
|
name subProject.pomName()
|
||||||
description subProject.pomDescription()
|
description subProject.pomDescription()
|
||||||
url 'http://hibernate.org'
|
url 'http://hibernate.org'
|
||||||
organization {
|
organization {
|
||||||
name 'Hibernate.org'
|
name 'Hibernate.org'
|
||||||
url 'http://hibernate.org'
|
url 'http://hibernate.org'
|
||||||
}
|
}
|
||||||
issueManagement {
|
issueManagement {
|
||||||
system 'jira'
|
system 'jira'
|
||||||
url 'https://hibernate.atlassian.net/browse/HHH'
|
url 'https://hibernate.atlassian.net/browse/HHH'
|
||||||
}
|
}
|
||||||
scm {
|
scm {
|
||||||
url 'http://github.com/hibernate/hibernate-orm'
|
url 'http://github.com/hibernate/hibernate-orm'
|
||||||
connection 'scm:git:http://github.com/hibernate/hibernate-orm.git'
|
connection 'scm:git:http://github.com/hibernate/hibernate-orm.git'
|
||||||
developerConnection 'scm:git:git@github.com:hibernate/hibernate-orm.git'
|
developerConnection 'scm:git:git@github.com:hibernate/hibernate-orm.git'
|
||||||
}
|
}
|
||||||
licenses {
|
licenses {
|
||||||
license {
|
license {
|
||||||
name 'GNU Lesser General Public License'
|
name 'GNU Lesser General Public License'
|
||||||
url 'http://www.gnu.org/licenses/lgpl-2.1.html'
|
url 'http://www.gnu.org/licenses/lgpl-2.1.html'
|
||||||
comments 'See discussion at http://hibernate.org/license for more details.'
|
comments 'See discussion at http://hibernate.org/license for more details.'
|
||||||
distribution 'repo'
|
distribution 'repo'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
developers {
|
developers {
|
||||||
developer {
|
developer {
|
||||||
id 'hibernate-team'
|
id 'hibernate-team'
|
||||||
name 'The Hibernate Development Team'
|
name 'The Hibernate Development Team'
|
||||||
organization 'Hibernate.org'
|
organization 'Hibernate.org'
|
||||||
organizationUrl 'http://hibernate.org'
|
organizationUrl 'http://hibernate.org'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TEMPORARY : currently Gradle Publishing feature is exporting dependencies as 'runtime' scope,
|
// TEMPORARY : currently Gradle Publishing feature is exporting dependencies as 'runtime' scope,
|
||||||
// rather than 'compile'; fix that.
|
// rather than 'compile'; fix that.
|
||||||
asNode().dependencies[0].dependency.each {
|
asNode().dependencies[0].dependency.each {
|
||||||
it.scope[0].value = 'compile'
|
it.scope[0].value = 'compile'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
if ( subProject.version.endsWith( 'SNAPSHOT' ) ) {
|
if ( subProject.version.endsWith( 'SNAPSHOT' ) ) {
|
||||||
name 'jboss-snapshots-repository'
|
name 'jboss-snapshots-repository'
|
||||||
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
|
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
name 'jboss-releases-repository'
|
name 'jboss-releases-repository'
|
||||||
url 'https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/'
|
url 'https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
model {
|
model {
|
||||||
tasks.generatePomFileForMavenJavaPublication {
|
tasks.generatePomFileForMavenJavaPublication {
|
||||||
destination = file( "$project.buildDir/generated-pom.xml" )
|
destination = file( "$project.buildDir/generated-pom.xml" )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: compileJava) {
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
classifier = 'sources'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar, dependsOn: compileJava) {
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
classifier = 'sources'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task release(type: Task, dependsOn: 'release:release')
|
task release(type: Task, dependsOn: 'release:release')
|
||||||
|
|
|
@ -20,7 +20,7 @@ buildscript {
|
||||||
|
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
apply plugin: "jdocbook"
|
apply plugin: "jdocbook"
|
||||||
apply from: "../utilities.gradle"
|
apply from: "${rootProject.projectDir}/utilities.gradle"
|
||||||
|
|
||||||
defaultTasks 'buildDocs'
|
defaultTasks 'buildDocs'
|
||||||
|
|
||||||
|
@ -74,37 +74,35 @@ task aggregateJavadocs(type: Javadoc) {
|
||||||
Set<String> internalPackages = new HashSet<String>()
|
Set<String> internalPackages = new HashSet<String>()
|
||||||
parent.subprojects.each{ Project subProject->
|
parent.subprojects.each{ Project subProject->
|
||||||
// skip certain sub-projects
|
// skip certain sub-projects
|
||||||
if ( ! ['release','documentation'].contains( subProject.name ) ) {
|
if ( ['release','documentation'].contains( subProject.name ) ) {
|
||||||
subProject.sourceSets.each { sourceSet ->
|
return;
|
||||||
// skip certain source sets
|
}
|
||||||
if ( ! ['test','matrix'].contains( sourceSet.name ) ) {
|
|
||||||
source sourceSet.java
|
|
||||||
|
|
||||||
if( classpath ) {
|
// we only care about the main SourceSet...
|
||||||
classpath += sourceSet.output + sourceSet.compileClasspath
|
source subProject.sourceSets.main.java
|
||||||
}
|
|
||||||
else {
|
|
||||||
classpath = sourceSet.output + sourceSet.compileClasspath
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSet.java.each { javaFile ->
|
if( classpath ) {
|
||||||
final String packageName = determinePackageName( sourceSet.java, javaFile );
|
classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath
|
||||||
if ( packageName.endsWith( ".internal" ) || packageName.contains( ".internal." ) ) {
|
}
|
||||||
internalPackages.add( packageName );
|
else {
|
||||||
}
|
classpath = subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath
|
||||||
else if ( packageName.endsWith( ".spi" ) || packageName.contains( ".spi." ) ) {
|
}
|
||||||
spiPackages.add( packageName );
|
|
||||||
}
|
subProject.sourceSets.main.java.each { javaFile ->
|
||||||
else if ( packageName.startsWith( "org.hibernate.testing" ) ) {
|
final String packageName = determinePackageName( subProject.sourceSets.main.java, javaFile );
|
||||||
// do nothing as testing support is already handled...
|
if ( packageName.endsWith( ".internal" ) || packageName.contains( ".internal." ) ) {
|
||||||
}
|
internalPackages.add( packageName );
|
||||||
else {
|
}
|
||||||
apiPackages.add( packageName );
|
else if ( packageName.endsWith( ".spi" ) || packageName.contains( ".spi." ) ) {
|
||||||
}
|
spiPackages.add( packageName );
|
||||||
}
|
}
|
||||||
}
|
else if ( packageName.startsWith( "org.hibernate.testing" ) ) {
|
||||||
}
|
// do nothing as testing support is already handled...
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
apiPackages.add( packageName );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply standard config
|
// apply standard config
|
||||||
|
|
|
@ -17,3 +17,7 @@ def pomName() {
|
||||||
def pomDescription() {
|
def pomDescription() {
|
||||||
return 'Integration for c3p0 Connection pooling into Hibernate O/RM'
|
return 'Integration for c3p0 Connection pooling into Hibernate O/RM'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def osgiDescription() {
|
||||||
|
return pomDescription()
|
||||||
|
}
|
|
@ -49,6 +49,10 @@ def pomDescription() {
|
||||||
return 'The core O/RM functionality as provided by Hibernate'
|
return 'The core O/RM functionality as provided by Hibernate'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def osgiDescription() {
|
||||||
|
return pomDescription()
|
||||||
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
mainAttributes( 'Main-Class': 'org.hibernate.Version' )
|
mainAttributes( 'Main-Class': 'org.hibernate.Version' )
|
||||||
|
@ -83,8 +87,11 @@ jar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" )
|
||||||
|
}
|
||||||
|
|
||||||
sourceSets.main {
|
sourceSets.main {
|
||||||
ext.jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" )
|
|
||||||
java.srcDir jaxbTargetDir
|
java.srcDir jaxbTargetDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,9 +108,6 @@ idea {
|
||||||
|
|
||||||
task jaxb {
|
task jaxb {
|
||||||
ext {
|
ext {
|
||||||
// output directory
|
|
||||||
jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" )
|
|
||||||
|
|
||||||
// input schemas
|
// input schemas
|
||||||
cfgXsd = file( 'src/main/resources/org/hibernate/hibernate-configuration-4.0.xsd')
|
cfgXsd = file( 'src/main/resources/org/hibernate/hibernate-configuration-4.0.xsd')
|
||||||
hbmXsd = file( 'src/main/resources/org/hibernate/hibernate-mapping-4.0.xsd' )
|
hbmXsd = file( 'src/main/resources/org/hibernate/hibernate-mapping-4.0.xsd' )
|
||||||
|
@ -156,12 +160,6 @@ task jaxb {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//generateMainLoggingClasses.dependsOn jaxb
|
runSourceGenerators.dependsOn jaxb
|
||||||
//generateMainLoggingClasses.dependsOn generateGrammarSource
|
runSourceGenerators.dependsOn generateGrammarSource
|
||||||
|
|
||||||
generateSources.dependsOn jaxb
|
|
||||||
generateSources.dependsOn generateGrammarSource
|
|
||||||
|
|
||||||
compileJava.dependsOn jaxb
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ import java.util.Properties;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.JDBCException;
|
import org.hibernate.JDBCException;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
|
import org.hibernate.exception.JDBCConnectionException;
|
||||||
import org.hibernate.exception.internal.SQLStateConversionDelegate;
|
import org.hibernate.exception.internal.SQLStateConversionDelegate;
|
||||||
import org.hibernate.exception.spi.ConversionContext;
|
import org.hibernate.exception.spi.ConversionContext;
|
||||||
import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
|
import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
|
||||||
|
@ -101,15 +102,28 @@ public abstract class BasicConnectionCreator implements ConnectionCreator {
|
||||||
new ValueHolder.DeferredInitializer<SQLExceptionConversionDelegate>() {
|
new ValueHolder.DeferredInitializer<SQLExceptionConversionDelegate>() {
|
||||||
@Override
|
@Override
|
||||||
public SQLExceptionConversionDelegate initialize() {
|
public SQLExceptionConversionDelegate initialize() {
|
||||||
return new SQLStateConversionDelegate(
|
return new SQLExceptionConversionDelegate() {
|
||||||
new ConversionContext() {
|
private final SQLStateConversionDelegate sqlStateDelegate = new SQLStateConversionDelegate(
|
||||||
@Override
|
new ConversionContext() {
|
||||||
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() {
|
@Override
|
||||||
// this should never happen...
|
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() {
|
||||||
throw new HibernateException( "Unexpected call to org.hibernate.exception.spi.ConversionContext.getViolatedConstraintNameExtracter" );
|
// this should never happen...
|
||||||
|
throw new HibernateException( "Unexpected call to org.hibernate.exception.spi.ConversionContext.getViolatedConstraintNameExtracter" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JDBCException convert(SQLException sqlException, String message, String sql) {
|
||||||
|
JDBCException exception = sqlStateDelegate.convert( sqlException, message, sql );
|
||||||
|
if ( exception == null ) {
|
||||||
|
// assume this is either a set-up problem or a problem connecting, which we will
|
||||||
|
// categorize the same here.
|
||||||
|
exception = new JDBCConnectionException( message, sqlException, sql );
|
||||||
}
|
}
|
||||||
);
|
return exception;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class ConnectionCreatorTest extends BaseUnitTestCase {
|
||||||
return super.getService( serviceRole );
|
return super.getService( serviceRole );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jdbc:h2:???:bad-url",
|
"jdbc:h2:mem:test-bad-urls;nosuchparam=saywhat",
|
||||||
new Properties(),
|
new Properties(),
|
||||||
false,
|
false,
|
||||||
null
|
null
|
||||||
|
|
|
@ -12,3 +12,7 @@ def pomName() {
|
||||||
def pomDescription() {
|
def pomDescription() {
|
||||||
return 'Integration for Ehcache into Hibernate as a second-level caching service'
|
return 'Integration for Ehcache into Hibernate as a second-level caching service'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def osgiDescription() {
|
||||||
|
return pomDescription()
|
||||||
|
}
|
||||||
|
|
|
@ -43,6 +43,14 @@ def pomDescription() {
|
||||||
return 'Hibernate O/RM implementation of the JPA specification'
|
return 'Hibernate O/RM implementation of the JPA specification'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def osgiDescription() {
|
||||||
|
return pomDescription()
|
||||||
|
}
|
||||||
|
|
||||||
|
def getMetaGenTargetSourceSet() {
|
||||||
|
return sourceSets.test;
|
||||||
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
// A cdi-api OSGi bundle does not currently exist. For now, explicitly
|
// A cdi-api OSGi bundle does not currently exist. For now, explicitly
|
||||||
|
@ -67,23 +75,6 @@ jar {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// alter the compileTestJava (src/test/java javac task) to add AP hooks
|
|
||||||
compileTestJava {
|
|
||||||
classpath += configurations.hibernateJpaModelGenTool
|
|
||||||
|
|
||||||
options.compilerArgs += [
|
|
||||||
"-processor", "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor",
|
|
||||||
"-s", "$sourceSets.test.aptGeneratedSourceDir.absolutePath"
|
|
||||||
]
|
|
||||||
|
|
||||||
doFirst {
|
|
||||||
if ( !sourceSets.test.aptGeneratedSourceDir.exists() ) {
|
|
||||||
sourceSets.test.aptGeneratedSourceDir.mkdirs()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Process 'bundle resources' for the packaging tests
|
// Process 'bundle resources' for the packaging tests
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -29,6 +29,13 @@ def pomDescription() {
|
||||||
return 'Entity versioning support'
|
return 'Entity versioning support'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def osgiDescription() {
|
||||||
|
return pomDescription()
|
||||||
|
}
|
||||||
|
|
||||||
|
def getMetaGenTargetSourceSet() {
|
||||||
|
return sourceSets.main;
|
||||||
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
test {
|
test {
|
||||||
|
@ -45,14 +52,6 @@ sourceSets {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
|
||||||
classpath += configurations.hibernateJpaModelGenTool
|
|
||||||
|
|
||||||
|
|
||||||
options.compilerArgs += [
|
|
||||||
"-processor", "$jbossLoggingToolClass,org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
|
|
|
@ -24,6 +24,10 @@ def pomDescription() {
|
||||||
return 'Integration for Infinispan into Hibernate as a second-level caching service'
|
return 'Integration for Infinispan into Hibernate as a second-level caching service'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def osgiDescription() {
|
||||||
|
return pomDescription()
|
||||||
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
systemProperties['java.net.preferIPv4Stack'] = true
|
systemProperties['java.net.preferIPv4Stack'] = true
|
||||||
systemProperties['jgroups.ping.timeout'] = 500
|
systemProperties['jgroups.ping.timeout'] = 500
|
||||||
|
|
|
@ -69,6 +69,14 @@ def pomDescription() {
|
||||||
return 'Support for running Hibernate O/RM in OSGi environments'
|
return 'Support for running Hibernate O/RM in OSGi environments'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def osgiDescription() {
|
||||||
|
return pomDescription()
|
||||||
|
}
|
||||||
|
|
||||||
|
def boolean needsLoggingGeneration() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
instruction 'Bundle-Activator', 'org.hibernate.osgi.HibernateBundleActivator'
|
instruction 'Bundle-Activator', 'org.hibernate.osgi.HibernateBundleActivator'
|
||||||
|
|
|
@ -11,3 +11,7 @@ def pomName() {
|
||||||
def pomDescription() {
|
def pomDescription() {
|
||||||
return 'Integration for Proxool Connection pooling into Hibernate O/RM'
|
return 'Integration for Proxool Connection pooling into Hibernate O/RM'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def osgiDescription() {
|
||||||
|
return pomDescription()
|
||||||
|
}
|
||||||
|
|
|
@ -26,3 +26,7 @@ def pomDescription() {
|
||||||
def osgiDescription() {
|
def osgiDescription() {
|
||||||
return pomDescription()
|
return pomDescription()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def boolean needsLoggingGeneration() {
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -0,0 +1,385 @@
|
||||||
|
import java.nio.charset.Charset
|
||||||
|
import java.util.concurrent.Callable
|
||||||
|
import javax.tools.Diagnostic
|
||||||
|
import javax.tools.DiagnosticListener
|
||||||
|
import javax.tools.JavaCompiler
|
||||||
|
import javax.tools.JavaFileObject
|
||||||
|
import javax.tools.StandardJavaFileManager
|
||||||
|
import javax.tools.ToolProvider
|
||||||
|
|
||||||
|
import org.gradle.api.internal.project.ProjectInternal
|
||||||
|
import org.gradle.api.internal.tasks.SimpleWorkResult
|
||||||
|
import org.gradle.api.internal.tasks.compile.CompilationFailedException
|
||||||
|
import org.gradle.api.internal.tasks.compile.Compiler
|
||||||
|
import org.gradle.api.internal.tasks.compile.DefaultJavaCompileSpec
|
||||||
|
import org.gradle.api.internal.tasks.compile.DefaultJavaCompilerFactory
|
||||||
|
import org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler
|
||||||
|
import org.gradle.api.internal.tasks.compile.JavaCompileSpec
|
||||||
|
import org.gradle.api.internal.tasks.compile.JavaCompilerArgumentsBuilder
|
||||||
|
import org.gradle.api.internal.tasks.compile.JavaCompilerFactory
|
||||||
|
import org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonManager
|
||||||
|
import org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler
|
||||||
|
import org.gradle.internal.jvm.Jvm
|
||||||
|
|
||||||
|
apply plugin: SourceGenerationPlugin
|
||||||
|
|
||||||
|
class SourceGenerationPlugin implements Plugin<Project> {
|
||||||
|
public static final String GROUP = "sourceGeneration";
|
||||||
|
|
||||||
|
public static final String GENERATE_SOURCES_TASK_NAME = "generateSources";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(Project project) {
|
||||||
|
final JavaPluginConvention javaPluginConvention = project.getConvention().findPlugin( JavaPluginConvention.class );
|
||||||
|
if ( javaPluginConvention == null ) {
|
||||||
|
// something seriously awry
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
project.convention.plugins[GROUP] = new SourceGenerationPluginConvention( project );
|
||||||
|
|
||||||
|
// first set up the overall generateSources task
|
||||||
|
Task generateSourcesTask = project.getTasks().findByName( GENERATE_SOURCES_TASK_NAME );
|
||||||
|
if ( generateSourcesTask == null ) {
|
||||||
|
generateSourcesTask = project.getTasks().create( GENERATE_SOURCES_TASK_NAME );
|
||||||
|
generateSourcesTask.setGroup( GROUP );
|
||||||
|
generateSourcesTask.setDescription( "Grouping task for all source generation tasks" );
|
||||||
|
}
|
||||||
|
|
||||||
|
// for each source set, define the specific grouping tasks (and associate with the generateSources as a
|
||||||
|
// task dependency)
|
||||||
|
for ( SourceSet sourceSet : javaPluginConvention.getSourceSets() ) {
|
||||||
|
final ExtraPropertiesExtension extProps = ( (ExtensionAware) sourceSet ).getExtensions().getExtraProperties();
|
||||||
|
|
||||||
|
// find the main javac task for this sourceSet (so we can add dependsOn to it)
|
||||||
|
final JavaCompile javaCompileTask = (JavaCompile) project.getTasks().getByName( sourceSet.getCompileJavaTaskName() );
|
||||||
|
|
||||||
|
// create the pre-apt generation grouping task
|
||||||
|
final String sourceGeneratorsTaskName = sourceSet.getTaskName( "run", "sourceGenerators" );
|
||||||
|
final Task sourceGeneratorsTask = project.getTasks().create( sourceGeneratorsTaskName );
|
||||||
|
sourceGeneratorsTask.setGroup( GROUP );
|
||||||
|
sourceGeneratorsTask.setDescription(
|
||||||
|
String.format(
|
||||||
|
"Grouping task for running all source generation tasks for the %s source-set of the %s project",
|
||||||
|
sourceSet.getName(),
|
||||||
|
project.getName()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
generateSourcesTask.dependsOn( sourceGeneratorsTask );
|
||||||
|
javaCompileTask.dependsOn( sourceGeneratorsTask );
|
||||||
|
|
||||||
|
extProps.set( "sourceGeneratorsTask", sourceGeneratorsTask );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SourceGenerationPluginConvention {
|
||||||
|
public static final String LOGGING_DEPENDENCY_CONFIG_NAME = "jbossLoggingTool";
|
||||||
|
public static final String LOGGING_PROCESSOR_NAME = "org.jboss.logging.processor.apt.LoggingToolsProcessor";
|
||||||
|
|
||||||
|
public static final String METAGEN_DEPENDENCY_CONFIG_NAME = "hibernateJpaModelGenTool";
|
||||||
|
public static final String METAGEN_PROCESSOR_NAME = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor";
|
||||||
|
|
||||||
|
private final Project project;
|
||||||
|
|
||||||
|
// practicality says we only ever deal with 2 source-sets:
|
||||||
|
private AnnotationProcessorOnlyTask mainProcOnlyTask;
|
||||||
|
private AnnotationProcessorOnlyTask testProcOnlyTask;
|
||||||
|
|
||||||
|
SourceGenerationPluginConvention(Project project) {
|
||||||
|
this.project = project
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addLoggingProcessor(SourceSet sourceSet) {
|
||||||
|
AnnotationProcessorOnlyTask task = getLocateProcessorOnlyTask( sourceSet )
|
||||||
|
task.processors += LOGGING_PROCESSOR_NAME
|
||||||
|
task.classpath += project.configurations[LOGGING_DEPENDENCY_CONFIG_NAME];
|
||||||
|
}
|
||||||
|
|
||||||
|
private AnnotationProcessorOnlyTask getLocateProcessorOnlyTask(SourceSet sourceSet) {
|
||||||
|
if ( sourceSet.name.equals( "main" ) ) {
|
||||||
|
if ( mainProcOnlyTask == null ) {
|
||||||
|
mainProcOnlyTask = generateProcessorOnlyTask( sourceSet )
|
||||||
|
}
|
||||||
|
return mainProcOnlyTask;
|
||||||
|
}
|
||||||
|
else if ( sourceSet.name.equals( "test" ) ) {
|
||||||
|
if ( testProcOnlyTask == null ) {
|
||||||
|
testProcOnlyTask = generateProcessorOnlyTask( sourceSet )
|
||||||
|
}
|
||||||
|
return testProcOnlyTask;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new IllegalArgumentException( "SourceSet (" + sourceSet.name + ") not valid for source generation" )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private AnnotationProcessorOnlyTask generateProcessorOnlyTask(SourceSet sourceSet) {
|
||||||
|
// find the main javac task for this sourceSet (we will alter it a bit later on)
|
||||||
|
final JavaCompile javaCompileTask = (JavaCompile) project.getTasks().getByName( sourceSet.getCompileJavaTaskName() );
|
||||||
|
|
||||||
|
final ExtraPropertiesExtension extProps = ( (ExtensionAware) sourceSet ).getExtensions().getExtraProperties();
|
||||||
|
|
||||||
|
// Obtain the output dir reference: generated-src/apt/{sourceSet.name}
|
||||||
|
final File outputDir = new File(
|
||||||
|
new File( project.getBuildDir(), "generated-src/apt/" ),
|
||||||
|
sourceSet.getName()
|
||||||
|
);
|
||||||
|
|
||||||
|
final String aptTaskName = sourceSet.getTaskName( "run", "annotationProcessors" );
|
||||||
|
final AnnotationProcessorOnlyTask aptTask = project.getTasks().create( aptTaskName, AnnotationProcessorOnlyTask.class );
|
||||||
|
aptTask.setGroup( SourceGenerationPlugin.GROUP );
|
||||||
|
aptTask.setDescription(
|
||||||
|
String.format(
|
||||||
|
"Grouping task for running all AnnotationProcessors (javac -proc:only) for the %s sourceSet of the %s project",
|
||||||
|
sourceSet.getName(),
|
||||||
|
project.getName()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// sourceSet.getAllJava() returns a SourceDirectorySet which is a "live view" meaning it keeps expanding
|
||||||
|
// even as we add to it. The problem is that later on here we will add the output directory of this task
|
||||||
|
// to this SourceDirectorySet; we need to make sure that we use the view of the SourceDirectorySet *before* that
|
||||||
|
// happens as the source for this task. getSrcDirs() does that
|
||||||
|
aptTask.source( sourceSet.getAllJava().getSrcDirs() )
|
||||||
|
aptTask.destinationDir = outputDir
|
||||||
|
// again for JBoss Logging...
|
||||||
|
aptTask.classesDir = outputDir
|
||||||
|
|
||||||
|
aptTask.setSourceCompatibility( javaCompileTask.getSourceCompatibility() );
|
||||||
|
aptTask.setTargetCompatibility( javaCompileTask.getTargetCompatibility() );
|
||||||
|
aptTask.setDependencyCacheDir( javaCompileTask.getDependencyCacheDir() );
|
||||||
|
|
||||||
|
aptTask.getConventionMapping().map(
|
||||||
|
"classpath",
|
||||||
|
new Callable<FileCollection>() {
|
||||||
|
public FileCollection call() throws Exception {
|
||||||
|
return javaCompileTask.getClasspath()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
aptTask.mustRunAfter( extProps.get( "sourceGeneratorsTask" ) );
|
||||||
|
javaCompileTask.dependsOn( aptTask );
|
||||||
|
project.tasks.findByName( SourceGenerationPlugin.GENERATE_SOURCES_TASK_NAME ).dependsOn( aptTask )
|
||||||
|
|
||||||
|
|
||||||
|
// create a FileTree representation of the APT output dir and add it to the JavaCompile task (so they get compiled)
|
||||||
|
final ConfigurableFileTree outputDirFileTree = project.fileTree( outputDir );
|
||||||
|
outputDirFileTree.builtBy( aptTask );
|
||||||
|
javaCompileTask.getSource().plus( outputDirFileTree );
|
||||||
|
|
||||||
|
// Add the APT output dir to the source set
|
||||||
|
sourceSet.getJava().srcDir( outputDir );
|
||||||
|
return aptTask
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMetaGenProcessor(SourceSet sourceSet) {
|
||||||
|
AnnotationProcessorOnlyTask task = getLocateProcessorOnlyTask( sourceSet )
|
||||||
|
task.processors += METAGEN_PROCESSOR_NAME
|
||||||
|
task.classpath += project.configurations[METAGEN_DEPENDENCY_CONFIG_NAME]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AnnotationProcessorOnlyTask extends AbstractCompile {
|
||||||
|
@Input
|
||||||
|
def List<String> processors = new ArrayList<String>();
|
||||||
|
// todo : support for this? really only "used" for logging and its use is questionable
|
||||||
|
//private Map<String,String> processorSettings = new HashMap<String, String>();
|
||||||
|
|
||||||
|
def File dependencyCacheDir;
|
||||||
|
def File classesDir;
|
||||||
|
|
||||||
|
private Compiler<JavaCompileSpec> javaCompiler;
|
||||||
|
|
||||||
|
AnnotationProcessorOnlyTask() {
|
||||||
|
// Stolen from Gradle's Compile/JavaCompile
|
||||||
|
org.gradle.internal.Factory<org.gradle.api.AntBuilder> antBuilderFactory = getServices().getFactory( org.gradle.api.AntBuilder.class );
|
||||||
|
JavaCompilerFactory inProcessCompilerFactory = new ExpandedJavaCompilerFactory( getLogger() );
|
||||||
|
ProjectInternal projectInternal = (ProjectInternal) getProject();
|
||||||
|
CompilerDaemonManager compilerDaemonManager = getServices().get( CompilerDaemonManager.class );
|
||||||
|
JavaCompilerFactory defaultCompilerFactory = new DefaultJavaCompilerFactory(
|
||||||
|
projectInternal,
|
||||||
|
antBuilderFactory,
|
||||||
|
inProcessCompilerFactory,
|
||||||
|
compilerDaemonManager
|
||||||
|
);
|
||||||
|
|
||||||
|
// The Gradle IncrementalJavaCompiler cant be used here for various reasons
|
||||||
|
javaCompiler = new DelegatingJavaCompiler( defaultCompilerFactory );
|
||||||
|
}
|
||||||
|
|
||||||
|
@OutputDirectory
|
||||||
|
public File getDependencyCacheDir() {
|
||||||
|
return dependencyCacheDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDependencyCacheDir(File dependencyCacheDir) {
|
||||||
|
this.dependencyCacheDir = dependencyCacheDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void compile() {
|
||||||
|
// see if the output dir exists
|
||||||
|
if ( !getDestinationDir().exists() ) {
|
||||||
|
// its does not - create it (javac will complain if its not there)
|
||||||
|
makeDirectory( getDestinationDir() );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// it does - clean it
|
||||||
|
project.delete( getDestinationDir() )
|
||||||
|
makeDirectory( getDestinationDir() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !getClassesDir().exists() ) {
|
||||||
|
// create classes dir if not there (again, javac will complain if its not there)
|
||||||
|
makeDirectory( getClassesDir() );
|
||||||
|
}
|
||||||
|
|
||||||
|
CompileOptions compileOptions = new CompileOptions();
|
||||||
|
|
||||||
|
Collections.addAll(
|
||||||
|
compileOptions.getCompilerArgs(),
|
||||||
|
"-nowarn",
|
||||||
|
"-proc:only",
|
||||||
|
"-encoding", "UTF-8",
|
||||||
|
"-s", getDestinationDir().getAbsolutePath(),
|
||||||
|
"-processor", processors.join( "," )
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
DefaultJavaCompileSpec spec = new DefaultJavaCompileSpec();
|
||||||
|
spec.setSource( getSource() );
|
||||||
|
// jboss logging needs this :(
|
||||||
|
spec.setDestinationDir( getClassesDir() );
|
||||||
|
spec.setClasspath( getClasspath() );
|
||||||
|
spec.setDependencyCacheDir( dependencyCacheDir );
|
||||||
|
spec.setSourceCompatibility( getSourceCompatibility() );
|
||||||
|
spec.setTargetCompatibility( getTargetCompatibility() );
|
||||||
|
spec.setCompileOptions( compileOptions );
|
||||||
|
|
||||||
|
WorkResult result = javaCompiler.execute( spec );
|
||||||
|
setDidWork( result.getDidWork() );
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
|
private static void makeDirectory(File directory) {
|
||||||
|
directory.mkdirs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of the Gradle JavaCompilerFactory contract generating {@link ExpandedJdk6JavaCompiler} instances
|
||||||
|
*/
|
||||||
|
class ExpandedJavaCompilerFactory implements JavaCompilerFactory {
|
||||||
|
private final Logger logger;
|
||||||
|
|
||||||
|
public ExpandedJavaCompilerFactory(Logger logger) {
|
||||||
|
//To change body of created methods use File | Settings | File Templates.
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Compiler<JavaCompileSpec> create(CompileOptions options) {
|
||||||
|
return new ExpandedJdk6JavaCompiler( logger );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension of Gradle's Jdk6JavaCompiler to add DiagnosticListener for diagnostic message mapping and APT support
|
||||||
|
*/
|
||||||
|
public class ExpandedJdk6JavaCompiler extends Jdk6JavaCompiler {
|
||||||
|
private final Logger logger;
|
||||||
|
|
||||||
|
public ExpandedJdk6JavaCompiler(Logger logger) {
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorkResult execute(JavaCompileSpec spec) {
|
||||||
|
logger.info( "Compiling with JDK Java compiler API." );
|
||||||
|
|
||||||
|
final DiagnosticListenerImpl diagnosticListener = new DiagnosticListenerImpl( logger );
|
||||||
|
final JavaCompiler.CompilationTask task = createCompileTask( spec, diagnosticListener );
|
||||||
|
boolean success = task.call();
|
||||||
|
if ( !success || diagnosticListener.sawError() ) {
|
||||||
|
throw new CompilationFailedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SimpleWorkResult( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JavaCompiler.CompilationTask createCompileTask(
|
||||||
|
JavaCompileSpec spec,
|
||||||
|
DiagnosticListenerImpl diagnosticListener) {
|
||||||
|
List<String> options = new JavaCompilerArgumentsBuilder(spec).build();
|
||||||
|
JavaCompiler compiler = findCompiler();
|
||||||
|
if ( compiler == null ) {
|
||||||
|
throw new RuntimeException("Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.");
|
||||||
|
}
|
||||||
|
CompileOptions compileOptions = spec.getCompileOptions();
|
||||||
|
StandardJavaFileManager fileManager = compiler.getStandardFileManager(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
compileOptions.getEncoding() != null
|
||||||
|
? Charset.forName( compileOptions.getEncoding() )
|
||||||
|
: null
|
||||||
|
);
|
||||||
|
Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(spec.getSource());
|
||||||
|
return compiler.getTask(null, null, diagnosticListener, options, null, compilationUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static class DiagnosticListenerImpl implements DiagnosticListener<JavaFileObject> {
|
||||||
|
private final Logger logger;
|
||||||
|
|
||||||
|
public DiagnosticListenerImpl(Logger logger) {
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
|
||||||
|
switch ( diagnostic.getKind() ) {
|
||||||
|
case Diagnostic.Kind.ERROR:
|
||||||
|
logger.debug( "[ERROR] : " + diagnostic.toString() );
|
||||||
|
break;
|
||||||
|
case Diagnostic.Kind.WARNING:
|
||||||
|
logger.debug( "[WARNING] : " + diagnostic.toString() );
|
||||||
|
break;
|
||||||
|
case Diagnostic.Kind.MANDATORY_WARNING:
|
||||||
|
logger.debug( "[MANDATORY_WARNING] : " + diagnostic.toString() );
|
||||||
|
break;
|
||||||
|
case Diagnostic.Kind.NOTE:
|
||||||
|
logger.debug( "[NOTE] : " + diagnostic.toString() );
|
||||||
|
break;
|
||||||
|
case Diagnostic.Kind.OTHER:
|
||||||
|
logger.debug( "[OTHER] : " + diagnostic.toString() );
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
logger.debug( "[UNKNOWN] : " + diagnostic.toString() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean sawError() {
|
||||||
|
// technically ERROR diagnostics should end the compile cycle, but since we are just generating
|
||||||
|
// sources here we ignore errors for now (expecting the later compilation task to report them
|
||||||
|
// if still valid)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JavaCompiler findCompiler() {
|
||||||
|
File realJavaHome = Jvm.current().getJavaHome();
|
||||||
|
File javaHomeFromToolProvidersPointOfView = new File(System.getProperty("java.home"));
|
||||||
|
if (realJavaHome.equals(javaHomeFromToolProvidersPointOfView)) {
|
||||||
|
return ToolProvider.getSystemJavaCompiler();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.setProperty("java.home", realJavaHome.getAbsolutePath());
|
||||||
|
try {
|
||||||
|
return ToolProvider.getSystemJavaCompiler();
|
||||||
|
} finally {
|
||||||
|
System.setProperty("java.home", javaHomeFromToolProvidersPointOfView.getAbsolutePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,3 +9,7 @@ dependencies {
|
||||||
compile gradleApi()
|
compile gradleApi()
|
||||||
compile localGroovy()
|
compile localGroovy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def boolean needsLoggingGeneration() {
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -12,3 +12,7 @@ dependencies {
|
||||||
compile( libraries.jpa )
|
compile( libraries.jpa )
|
||||||
compile( libraries.javassist )
|
compile( libraries.javassist )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def boolean needsLoggingGeneration() {
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -64,10 +64,11 @@ task jaxb {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileJava.dependsOn jaxb
|
runSourceGenerators.dependsOn jaxb
|
||||||
|
|
||||||
checkstyleMain.exclude '**/jaxb/**'
|
checkstyleMain.exclude '**/jaxb/**'
|
||||||
|
|
||||||
|
|
||||||
|
def boolean needsLoggingGeneration() {
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -1,32 +1,8 @@
|
||||||
|
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
|
||||||
* indicated by the @author tags or express copyright attribution
|
|
||||||
* statements applied by the authors. All third-party contributions are
|
|
||||||
* distributed under license by Red Hat Inc.
|
|
||||||
*
|
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
|
||||||
* Lesser General Public License, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this distribution; if not, write to:
|
|
||||||
* Free Software Foundation, Inc.
|
|
||||||
* 51 Franklin Street, Fifth Floor
|
|
||||||
* Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
apply plugin: UtilitiesPlugin
|
apply plugin: UtilitiesPlugin
|
||||||
|
|
||||||
class UtilitiesPlugin implements Plugin {
|
class UtilitiesPlugin implements Plugin<Project> {
|
||||||
def void apply(Object project) {
|
def void apply(Project project) {
|
||||||
project.convention.plugins.utilities = new UtilitiesPluginDef()
|
project.convention.plugins.utilities = new UtilitiesPluginDef()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue