2016-03-15 12:23:53 -04:00
|
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
|
2016-01-25 11:08:54 -05:00
|
|
|
/*
|
|
|
|
* Hibernate, Relational Persistence for Idiomatic Java
|
|
|
|
*
|
|
|
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
|
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
|
|
*/
|
|
|
|
|
2015-04-09 12:36:04 -04:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
mavenLocal()
|
|
|
|
jcenter()
|
|
|
|
|
|
|
|
maven {
|
|
|
|
name 'jboss-nexus'
|
|
|
|
url "http://repository.jboss.org/nexus/content/groups/public/"
|
|
|
|
}
|
|
|
|
maven {
|
|
|
|
name "jboss-snapshots"
|
|
|
|
url "http://snapshots.jboss.org/maven2/"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
classpath 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1'
|
2015-07-21 13:01:39 -04:00
|
|
|
classpath 'org.hibernate.build.gradle:hibernate-matrix-testing:2.0.0-SNAPSHOT'
|
2015-04-09 12:36:04 -04:00
|
|
|
classpath 'org.hibernate.build.gradle:version-injection-plugin:1.0.0'
|
2015-04-09 22:42:42 -04:00
|
|
|
classpath 'org.hibernate.build.gradle:gradle-xjc-plugin:1.0.2.Final'
|
2015-05-12 14:57:40 -04:00
|
|
|
classpath 'com.github.lburgazzoli:lb-karaf-features-gen:1.0.0-SNAPSHOT'
|
2015-04-09 12:36:04 -04:00
|
|
|
}
|
2010-10-08 21:20:10 -04:00
|
|
|
}
|
|
|
|
|
2016-09-26 18:33:20 -04:00
|
|
|
plugins {
|
2017-08-17 07:04:39 -04:00
|
|
|
id 'com.gradle.build-scan' version '1.9'
|
2016-12-16 10:55:32 -05:00
|
|
|
id 'me.champeau.buildscan-recipes' version '0.1.7'
|
2016-09-26 18:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
apply plugin: 'eclipse'
|
|
|
|
apply plugin: 'idea'
|
|
|
|
apply from: "./libraries.gradle"
|
|
|
|
apply from: "./databases.gradle"
|
|
|
|
|
2015-04-09 12:36:04 -04:00
|
|
|
allprojects {
|
2011-03-22 09:29:49 -04:00
|
|
|
repositories {
|
2013-04-05 15:30:56 -04:00
|
|
|
mavenCentral()
|
|
|
|
mavenLocal()
|
|
|
|
|
2013-11-21 14:46:03 -05:00
|
|
|
maven {
|
|
|
|
name 'jboss-nexus'
|
|
|
|
url "http://repository.jboss.org/nexus/content/groups/public/"
|
|
|
|
}
|
|
|
|
maven {
|
|
|
|
name "jboss-snapshots"
|
|
|
|
url "http://snapshots.jboss.org/maven2/"
|
|
|
|
}
|
2011-03-22 09:29:49 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-21 14:46:03 -05:00
|
|
|
ext {
|
2017-11-16 11:57:11 -05:00
|
|
|
hibernateTargetVersion = '5.3.0-SNAPSHOT'
|
2017-12-18 11:56:30 -05:00
|
|
|
expectedGradleVersion = '4.4'
|
2016-03-31 13:04:10 -04:00
|
|
|
baselineJavaVersion = '1.8'
|
2013-11-21 14:46:03 -05:00
|
|
|
|
2015-04-09 12:36:04 -04:00
|
|
|
osgiExportVersion = hibernateTargetVersion.replaceAll( '-SNAPSHOT', '.SNAPSHOT' )
|
2016-08-05 11:08:35 -04:00
|
|
|
|
|
|
|
final String[] versionComponents = hibernateTargetVersion.split( '\\.' );
|
|
|
|
hibernateFullVersion = hibernateTargetVersion
|
|
|
|
hibernateMajorMinorVersion = versionComponents[0] + '.' + versionComponents[1]
|
|
|
|
hibernateMajorVersion = versionComponents[0]
|
2013-11-21 14:46:03 -05:00
|
|
|
}
|
2012-07-19 09:56:31 -04:00
|
|
|
|
2012-02-15 17:31:29 -05:00
|
|
|
idea {
|
2012-02-16 21:52:26 -05:00
|
|
|
project {
|
2016-03-31 13:04:10 -04:00
|
|
|
jdkName = baselineJavaVersion
|
|
|
|
languageLevel = baselineJavaVersion
|
2015-03-31 14:01:57 -04:00
|
|
|
|
|
|
|
vcs = 'Git'
|
2012-02-16 21:52:26 -05:00
|
|
|
}
|
|
|
|
module {
|
|
|
|
name = "hibernate-orm"
|
|
|
|
}
|
2010-10-11 10:30:26 -04:00
|
|
|
}
|
|
|
|
|
2013-11-26 11:43:50 -05:00
|
|
|
// Used in MANIFEST.MF for OSGi Bundles
|
|
|
|
def osgiDescription() {
|
2015-04-10 12:58:22 -04:00
|
|
|
return "A module of the Hibernate O/RM project"
|
2013-11-26 11:43:50 -05:00
|
|
|
}
|
2013-12-02 21:53:19 -05:00
|
|
|
|
2017-03-17 05:07:24 -04:00
|
|
|
buildDir = "target"
|
|
|
|
|
2013-04-16 19:25:20 -04:00
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2010-10-08 21:20:10 -04:00
|
|
|
|
|
|
|
subprojects { subProject ->
|
2010-10-10 16:06:06 -04:00
|
|
|
apply plugin: 'idea'
|
2012-02-16 21:52:26 -05:00
|
|
|
apply plugin: 'eclipse'
|
2010-10-12 16:39:33 -04:00
|
|
|
|
|
|
|
defaultTasks 'build'
|
2010-10-10 16:06:06 -04:00
|
|
|
|
2017-08-17 07:04:39 -04:00
|
|
|
if ( subProject.name.startsWith( 'hibernate-gradle-plugin' ) ) {
|
|
|
|
apply plugin: 'groovy'
|
|
|
|
}
|
|
|
|
|
2010-10-08 21:20:10 -04:00
|
|
|
group = 'org.hibernate'
|
2012-07-19 09:56:31 -04:00
|
|
|
version = rootProject.hibernateTargetVersion
|
2015-04-10 12:58:22 -04:00
|
|
|
|
2013-11-21 14:46:03 -05:00
|
|
|
ext.exportPackageVersion = rootProject.osgiExportVersion
|
2010-10-08 21:20:10 -04:00
|
|
|
|
|
|
|
// minimize changes, at least for now (gradle uses 'build' by default)..
|
2010-10-10 16:06:06 -04:00
|
|
|
buildDir = "target"
|
2010-10-10 09:17:52 -04:00
|
|
|
|
2017-12-13 10:15:22 -05:00
|
|
|
if ( subProject.name.startsWith( 'release' ) ) {
|
|
|
|
return
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
|
|
|
|
2016-06-29 16:48:20 -04:00
|
|
|
if ( subProject.name.startsWith( 'hibernate-orm-modules' ) ) {
|
2017-12-13 10:15:22 -05:00
|
|
|
return
|
2016-06-29 16:48:20 -04:00
|
|
|
}
|
|
|
|
|
2017-12-13 10:15:22 -05:00
|
|
|
// everything below here in the closure applies to modules with Java code
|
2013-12-02 21:53:19 -05:00
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'maven-publish'
|
|
|
|
apply plugin: 'maven-publish-auth'
|
|
|
|
apply plugin: 'osgi'
|
|
|
|
|
|
|
|
apply plugin: 'findbugs'
|
|
|
|
apply plugin: 'checkstyle'
|
|
|
|
apply plugin: 'build-dashboard'
|
|
|
|
apply plugin: 'project-report'
|
|
|
|
|
2017-12-22 12:49:07 -05:00
|
|
|
apply from: "${rootProject.projectDir}/utilities.gradle"
|
|
|
|
|
2015-04-10 12:58:22 -04:00
|
|
|
apply plugin: org.hibernate.build.HibernateBuildPlugin
|
2015-04-09 12:36:04 -04:00
|
|
|
|
2016-03-31 13:04:10 -04:00
|
|
|
sourceCompatibility = rootProject.baselineJavaVersion
|
|
|
|
targetCompatibility = rootProject.baselineJavaVersion
|
|
|
|
|
2013-12-02 21:53:19 -05:00
|
|
|
configurations {
|
|
|
|
provided {
|
|
|
|
// todo : need to make sure these are non-exported
|
|
|
|
description = 'Non-exported compile-time dependencies.'
|
|
|
|
}
|
2015-05-28 17:46:15 -04:00
|
|
|
jbossLoggingTool {
|
|
|
|
description = 'Dependencies for running the jboss-logging tooling.'
|
|
|
|
}
|
2013-12-02 21:53:19 -05:00
|
|
|
configurations {
|
|
|
|
all*.exclude group: 'xml-apis', module: 'xml-apis'
|
|
|
|
}
|
2017-12-22 12:49:07 -05:00
|
|
|
asciidoclet {
|
|
|
|
description = "Dependencies for Asciidoctor Javadoc taglet"
|
|
|
|
}
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// appropriately inject the common dependencies into each sub-project
|
|
|
|
dependencies {
|
2015-06-04 15:11:36 -04:00
|
|
|
compile libraries.logging
|
|
|
|
|
|
|
|
provided libraries.logging_annotations
|
2015-05-28 17:46:15 -04:00
|
|
|
|
|
|
|
jbossLoggingTool( libraries.logging_processor )
|
2013-12-02 21:53:19 -05:00
|
|
|
|
|
|
|
testCompile( libraries.junit )
|
|
|
|
testCompile( libraries.byteman )
|
|
|
|
testCompile( libraries.byteman_install )
|
|
|
|
testCompile( libraries.byteman_bmunit )
|
|
|
|
|
|
|
|
testRuntime( libraries.log4j )
|
|
|
|
testRuntime( libraries.javassist )
|
2016-10-04 16:43:27 -04:00
|
|
|
testRuntime( libraries.byteBuddy )
|
2016-04-14 06:04:32 -04:00
|
|
|
testRuntime( libraries.woodstox )
|
|
|
|
|
|
|
|
//Databases
|
2013-12-02 21:53:19 -05:00
|
|
|
testRuntime( libraries.h2 )
|
2016-03-15 12:23:53 -04:00
|
|
|
testRuntime( libraries.hsqldb )
|
|
|
|
testRuntime( libraries.postgresql )
|
2016-03-16 10:01:11 -04:00
|
|
|
testRuntime( libraries.mysql )
|
2016-03-29 12:04:48 -04:00
|
|
|
testRuntime( libraries.mariadb )
|
2016-11-18 10:39:14 -05:00
|
|
|
testRuntime( libraries.mssql )
|
2016-06-14 03:29:27 -04:00
|
|
|
testRuntime( libraries.informix )
|
2016-11-18 10:39:14 -05:00
|
|
|
|
2017-12-22 12:49:07 -05:00
|
|
|
asciidoclet 'org.asciidoctor:asciidoclet:1.+'
|
|
|
|
|
2016-04-26 05:55:05 -04:00
|
|
|
if (db.equalsIgnoreCase("oracle")) {
|
|
|
|
dependencies {
|
2017-04-12 03:31:56 -04:00
|
|
|
testRuntime( libraries.oracle ) {
|
|
|
|
exclude group: 'com.oracle.jdbc', module: 'xmlparserv2'
|
|
|
|
}
|
2016-04-26 05:55:05 -04:00
|
|
|
}
|
|
|
|
}
|
2017-05-08 04:56:35 -04:00
|
|
|
if (db.equalsIgnoreCase("db2")) {
|
|
|
|
dependencies {
|
|
|
|
testRuntime( libraries.db2 )
|
|
|
|
}
|
|
|
|
}
|
2017-09-14 06:03:41 -04:00
|
|
|
if (db.equalsIgnoreCase("hana")) {
|
|
|
|
dependencies {
|
|
|
|
testRuntime( libraries.hana )
|
|
|
|
}
|
|
|
|
}
|
2015-05-16 15:23:34 -04:00
|
|
|
// 6.6 gave me some NPE problems from within checkstyle...
|
|
|
|
checkstyle 'com.puppycrawl.tools:checkstyle:6.5'
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// mac-specific stuff ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-04-07 15:31:41 -04:00
|
|
|
// should really use Jvm.current().toolsJar
|
2013-12-02 21:53:19 -05:00
|
|
|
ext.toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar")
|
|
|
|
if ( ext.toolsJar.exists() ) {
|
|
|
|
dependencies{
|
|
|
|
testCompile files( toolsJar )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2016-03-31 13:04:10 -04:00
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// compilation
|
2017-01-10 06:51:32 -05:00
|
|
|
compileJava.options.encoding = 'UTF-8'
|
|
|
|
|
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
options.encoding = 'UTF-8'
|
|
|
|
}
|
|
|
|
|
2013-12-02 21:53:19 -05:00
|
|
|
task compile
|
|
|
|
compile.dependsOn compileJava, processResources, compileTestJava, processTestResources
|
|
|
|
|
|
|
|
sourceSets.main {
|
|
|
|
compileClasspath += configurations.provided
|
2015-05-28 17:46:15 -04:00
|
|
|
compileClasspath += configurations.jbossLoggingTool
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
|
|
|
|
2016-03-31 13:04:10 -04:00
|
|
|
subProject.getConvention().findPlugin( JavaPluginConvention.class ).sourceSets.each { sourceSet ->
|
|
|
|
JavaCompile javaCompileTask = project.tasks.findByName( sourceSet.compileJavaTaskName ) as JavaCompile
|
|
|
|
|
|
|
|
// NOTE : this aptDir stuff is needed until we can have IntelliJ run annotation processors for us
|
|
|
|
// which cannot happen until we can fold hibernate-testing back into hibernate-core/src/test
|
|
|
|
// which cannot happen until... ugh
|
|
|
|
File aptDir = subProject.file( "${subProject.buildDir}/generated-src/apt/${sourceSet.name}" )
|
|
|
|
sourceSet.allJava.srcDir( aptDir )
|
|
|
|
|
|
|
|
javaCompileTask.options.compilerArgs += [
|
|
|
|
"-nowarn",
|
|
|
|
"-encoding", "UTF-8",
|
|
|
|
"-s", "${aptDir.absolutePath}"
|
|
|
|
]
|
|
|
|
javaCompileTask.doFirst {
|
|
|
|
aptDir.mkdirs()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// testing
|
|
|
|
subProject.tasks.withType( Test.class ).all { task ->
|
2017-09-21 06:54:35 -04:00
|
|
|
if ( JavaVersion.current().isJava9Compatible() ) {
|
|
|
|
// Byteman needs this property to be set, https://developer.jboss.org/thread/274997
|
|
|
|
task.jvmArgs += ["-Djdk.attach.allowAttachSelf=true"]
|
|
|
|
}
|
2016-03-31 13:04:10 -04:00
|
|
|
task.jvmArgs += [
|
|
|
|
'-XX:+HeapDumpOnOutOfMemoryError',
|
|
|
|
"-XX:HeapDumpPath=${project.file( "${project.buildDir}/OOM-dump.hprof" ).absolutePath}",
|
|
|
|
'-XX:MetaspaceSize=512M'
|
|
|
|
]
|
|
|
|
|
|
|
|
task.maxHeapSize = '2G'
|
|
|
|
|
|
|
|
task.systemProperties['hibernate.test.validatefailureexpected'] = true
|
|
|
|
task.systemProperties += System.properties.findAll { it.key.startsWith( "hibernate.") }
|
|
|
|
|
|
|
|
// uncomment to help identify pauses in test executions : where they occur
|
|
|
|
// task.beforeTest { descriptor ->
|
|
|
|
// println "Starting test: " + descriptor
|
|
|
|
// }
|
|
|
|
// task.afterTest { descriptor ->
|
|
|
|
// println "Completed test: " + descriptor
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
2017-10-23 06:40:23 -04:00
|
|
|
/*
|
|
|
|
The latest versions of IntelliJ copy and use the test resources into out/test/resources
|
|
|
|
this occurs before the placeholder in the test config file are substituted
|
|
|
|
with the testing values.
|
|
|
|
|
|
|
|
This behaviour prevents the execution of the hibernate tests from inside the IDE.
|
|
|
|
|
|
|
|
A solution is to enable the 'After Build' Execution of the copyResourcesToIntelliJOutFolder task
|
|
|
|
from the 'Gradle project' IntelliJ tool window ( The task can be found under hibernate-orm > Task > other)
|
|
|
|
*/
|
|
|
|
task copyResourcesToIntelliJOutFolder(type: Copy) {
|
|
|
|
from "$subProject.buildDir/resources/test"
|
|
|
|
into 'out/test/resources'
|
|
|
|
}
|
|
|
|
|
2016-03-31 13:04:10 -04:00
|
|
|
processTestResources.doLast( {
|
|
|
|
copy {
|
|
|
|
from( sourceSets.test.java.srcDirs ) {
|
|
|
|
include '**/*.properties'
|
|
|
|
include '**/*.xml'
|
|
|
|
}
|
|
|
|
into sourceSets.test.output.classesDir
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from file('src/test/resources')
|
2016-08-06 15:05:03 -04:00
|
|
|
into file( "${buildDir}/resources/test" )
|
|
|
|
exclude 'src/test/resources/arquillian.xml'
|
2016-09-15 09:39:00 -04:00
|
|
|
exclude 'src/test/resources/hibernate.properties'
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from file('src/test/resources/hibernate.properties')
|
|
|
|
into file( "${buildDir}/resources/test" )
|
2016-08-06 15:05:03 -04:00
|
|
|
filter( ReplaceTokens, tokens: dbBundle[db] )
|
2016-03-31 13:04:10 -04:00
|
|
|
}
|
|
|
|
} )
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// artifact
|
2017-08-17 07:04:39 -04:00
|
|
|
|
2013-12-02 21:53:19 -05:00
|
|
|
jar {
|
|
|
|
manifest = osgiManifest {
|
|
|
|
// GRADLE-1411: Even if we override Imports and Exports
|
|
|
|
// auto-generation with instructions, classesDir and classpath
|
|
|
|
// need to be here (temporarily).
|
2017-08-17 07:04:39 -04:00
|
|
|
|
|
|
|
if ( subProject.name.startsWith( 'hibernate-gradle-plugin' ) ) {
|
|
|
|
classesDir = sourceSets.main.groovy.outputDir
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
classesDir = sourceSets.main.output.classesDir
|
|
|
|
}
|
2013-12-02 21:53:19 -05:00
|
|
|
classpath = configurations.runtime
|
|
|
|
|
2017-12-22 22:08:14 -05:00
|
|
|
|
|
|
|
String moduleSimpleName = java9ModuleName( subProject )
|
|
|
|
String moduleName = "org.hibernate.orm.$moduleSimpleName"
|
|
|
|
|
|
|
|
// Java 9 module name
|
|
|
|
instruction 'Automatic-Module-Name', moduleName
|
|
|
|
|
|
|
|
// the OSGi metadata
|
|
|
|
symbolicName moduleName
|
|
|
|
vendor 'Hibernate.org'
|
|
|
|
description subProject.osgiDescription()
|
|
|
|
docURL "http://www.hibernate.org/orm/${hibernateMajorMinorVersion}"
|
|
|
|
|
2013-12-02 21:53:19 -05:00
|
|
|
instruction 'Import-Package',
|
2017-12-22 22:08:14 -05:00
|
|
|
// Temporarily support JTA 1.1 -- Karaf and other frameworks still
|
|
|
|
// 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 *.
|
|
|
|
'*'
|
|
|
|
|
|
|
|
// Basic JAR manifest metadata
|
2016-03-02 21:07:16 -05:00
|
|
|
instruction 'Specification-Title', name
|
|
|
|
instruction 'Specification-Version', version
|
|
|
|
instruction 'Specification-Vendor', 'Hibernate.org'
|
2017-12-22 22:08:14 -05:00
|
|
|
instruction 'Implementation-Title', name
|
|
|
|
instruction 'Implementation-Version', version
|
|
|
|
instruction 'Implementation-VersionFamily', hibernateMajorMinorVersion
|
|
|
|
instruction 'Implementation-Vendor', 'Hibernate.org'
|
|
|
|
instruction 'Implementation-Vendor-Id', 'org.hibernate'
|
|
|
|
instruction 'Implementation-Url', 'http://hibernate.org/orm'
|
|
|
|
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-31 13:04:10 -04:00
|
|
|
task sourcesJar(type: Jar, dependsOn: compileJava) {
|
|
|
|
from sourceSets.main.allSource
|
2017-12-22 12:49:07 -05:00
|
|
|
manifest = jar.manifest
|
2016-03-31 13:04:10 -04:00
|
|
|
classifier = 'sources'
|
|
|
|
}
|
2015-04-10 12:58:22 -04:00
|
|
|
|
2017-12-22 12:49:07 -05:00
|
|
|
javadoc {
|
2017-12-26 12:27:58 -05:00
|
|
|
exclude( "**/internal/*" )
|
|
|
|
exclude( "**/generated-src/**" )
|
2017-12-22 12:49:07 -05:00
|
|
|
|
2017-12-26 12:27:58 -05:00
|
|
|
final int currentYear = new GregorianCalendar().get( Calendar.YEAR )
|
2017-12-22 12:49:07 -05:00
|
|
|
|
|
|
|
configure( options ) {
|
|
|
|
docletpath = configurations.asciidoclet.files.asType(List)
|
|
|
|
doclet = 'org.asciidoctor.Asciidoclet'
|
|
|
|
|
|
|
|
windowTitle = "$subProject.name JavaDocs"
|
|
|
|
docTitle = "$subProject.name JavaDocs ($project.version)"
|
2017-12-26 12:27:58 -05:00
|
|
|
bottom = "Copyright © 2001-$currentYear <a href=\"http://redhat.com\">Red Hat, Inc.</a> All Rights Reserved."
|
2017-12-22 12:49:07 -05:00
|
|
|
use = true
|
|
|
|
encoding = 'UTF-8'
|
|
|
|
links += [
|
2017-12-26 12:27:58 -05:00
|
|
|
'http://docs.oracle.com/javase/8/docs/api/',
|
|
|
|
'http://docs.jboss.org/hibernate/beanvalidation/spec/2.0/api/',
|
2017-12-22 12:49:07 -05:00
|
|
|
'http://docs.jboss.org/cdi/api/2.0/',
|
2017-12-26 12:27:58 -05:00
|
|
|
'http://docs.oracle.com/javaee/7/api/'
|
2017-12-22 12:49:07 -05:00
|
|
|
]
|
|
|
|
|
|
|
|
if ( JavaVersion.current().isJava8Compatible() ) {
|
|
|
|
options.addStringOption( 'Xdoclint:none', '-quiet' )
|
|
|
|
}
|
2017-12-26 12:27:58 -05:00
|
|
|
|
|
|
|
doFirst {
|
|
|
|
// calculation of these groups is expensive - so push
|
|
|
|
// that process from init/configuration phase to execution
|
|
|
|
// phase.
|
|
|
|
//
|
|
|
|
// Note : this does not affect UP-TO-DATE checking because
|
|
|
|
// the groups are based on packages of the classes, and
|
|
|
|
// if the classes change that would already trigger
|
|
|
|
// re-execution of this task...
|
|
|
|
|
|
|
|
Set<String> apiPackages = new HashSet<>()
|
|
|
|
Set<String> spiPackages = new HashSet<>()
|
|
|
|
Set<String> testingPackages = new HashSet<String>()
|
|
|
|
|
|
|
|
subProject.sourceSets.main.java.each { javaFile ->
|
|
|
|
final String packageName = determinePackageName( subProject.sourceSets.main.java, javaFile );
|
|
|
|
if ( packageName.endsWith( ".internal" ) || packageName.contains( ".internal." ) ) {
|
|
|
|
// nothing to do - we exclude internal packages
|
|
|
|
}
|
|
|
|
else if ( packageName.endsWith( ".spi" ) || packageName.contains( ".spi." ) ) {
|
|
|
|
spiPackages.add( packageName )
|
|
|
|
}
|
|
|
|
else if ( packageName.startsWith( "org.hibernate.testing" ) ) {
|
|
|
|
testingPackages += packageName
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
apiPackages.add( packageName )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
options.group( 'API', apiPackages.asList() )
|
|
|
|
options.group( 'SPI', spiPackages.asList() )
|
|
|
|
options.group( 'Testing Support', testingPackages.asList() )
|
|
|
|
|
|
|
|
}
|
2017-12-22 12:49:07 -05:00
|
|
|
}
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
2017-12-22 12:49:07 -05:00
|
|
|
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
|
|
from tasks.javadoc.outputs
|
|
|
|
classifier = 'javadoc'
|
|
|
|
}
|
|
|
|
|
2016-03-31 13:04:10 -04:00
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2013-12-02 21:53:19 -05:00
|
|
|
|
|
|
|
|
2016-03-31 13:04:10 -04:00
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// IDE options
|
2013-12-02 21:53:19 -05:00
|
|
|
idea {
|
|
|
|
module {
|
2016-03-31 13:04:10 -04:00
|
|
|
jdkName = subProject.sourceCompatibility
|
2015-03-31 14:01:57 -04:00
|
|
|
|
|
|
|
excludeDirs = [file( ".gradle" )]
|
|
|
|
excludeDirs += file( "$buildDir/classes" )
|
|
|
|
excludeDirs += file( "$buildDir/bundles" )
|
|
|
|
excludeDirs += file( "$buildDir/packages" )
|
|
|
|
excludeDirs += file( "$buildDir/dependency-cache" )
|
|
|
|
excludeDirs += file( "$buildDir/libs" )
|
|
|
|
excludeDirs += file( "$buildDir/reports" )
|
|
|
|
excludeDirs += file( "$buildDir/test-results" )
|
|
|
|
excludeDirs += file( "$buildDir/tmp" )
|
|
|
|
excludeDirs += file( "$buildDir/matrix" )
|
|
|
|
excludeDirs += file( "$buildDir/resources" )
|
|
|
|
|
2013-12-02 21:53:19 -05:00
|
|
|
downloadSources = true
|
2015-03-31 14:01:57 -04:00
|
|
|
scopes.PROVIDED.plus += [configurations.provided]
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
eclipse {
|
2015-04-10 12:58:22 -04:00
|
|
|
jdt {
|
2016-03-31 13:04:10 -04:00
|
|
|
sourceCompatibility = subProject.sourceCompatibility
|
|
|
|
targetCompatibility = subProject.targetCompatibility
|
2015-03-31 14:01:57 -04:00
|
|
|
}
|
2013-12-02 21:53:19 -05:00
|
|
|
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.
|
2015-04-10 12:58:22 -04:00
|
|
|
eclipseClasspath.dependsOn compile
|
2016-03-31 13:04:10 -04:00
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2013-12-02 21:53:19 -05:00
|
|
|
|
|
|
|
|
2016-03-31 13:04:10 -04:00
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// Report configs
|
2013-12-02 21:53:19 -05:00
|
|
|
checkstyle {
|
|
|
|
sourceSets = [ subProject.sourceSets.main ]
|
|
|
|
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
|
|
|
|
showViolations = false
|
|
|
|
}
|
2015-04-17 14:03:10 -04:00
|
|
|
// exclude generated java sources - by explicitly setting the base source dir
|
|
|
|
checkstyleMain.source = 'src/main/java'
|
2017-09-21 15:59:05 -04:00
|
|
|
|
2016-11-09 12:34:51 -05:00
|
|
|
// define a second checkstyle task for checking non-fatal violations
|
2017-01-04 08:01:00 -05:00
|
|
|
task nonFatalCheckstyle(type:Checkstyle) {
|
|
|
|
source = subProject.sourceSets.main.java
|
|
|
|
classpath = subProject.configurations.checkstyle
|
2016-11-09 12:34:51 -05:00
|
|
|
showViolations = false
|
|
|
|
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle-non-fatal.xml' )
|
|
|
|
}
|
2013-12-02 21:53:19 -05:00
|
|
|
|
2017-09-21 15:59:05 -04:00
|
|
|
if ( JavaVersion.current().isJava9Compatible() ) {
|
|
|
|
logger.warn( '[WARN] Disabling findbugs, it does not support JDK 9' )
|
|
|
|
findbugs {
|
|
|
|
sourceSets = []
|
|
|
|
}
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
2017-09-21 15:59:05 -04:00
|
|
|
else {
|
|
|
|
findbugs {
|
|
|
|
sourceSets = [subProject.sourceSets.main, subProject.sourceSets.test]
|
|
|
|
ignoreFailures = true
|
|
|
|
toolVersion = '3.0.1'
|
|
|
|
// for now we need to set this to low so that FindBugs will actually report the DM_CONVERT_CASE warning we care about
|
|
|
|
reportLevel = 'low'
|
|
|
|
// remove all low level bug warnings except DM_CONVERT_CASE
|
|
|
|
excludeFilterConfig = resources.text.fromString( excludeAllLowLevelBugsExcept( 'DM_CONVERT_CASE' ) )
|
|
|
|
}
|
2015-04-20 13:00:12 -04:00
|
|
|
|
2017-09-21 15:59:05 -04:00
|
|
|
// exclude generated java sources and cfg package is a mess mainly from annotation stuff
|
|
|
|
findbugsMain.doFirst {
|
|
|
|
classes = classes.filter {
|
|
|
|
!it.path.contains( 'org/hibernate/hql/internal/antlr' ) &&
|
|
|
|
!it.path.contains( 'org/hibernate/boot/jaxb/cfg/spi' ) &&
|
|
|
|
!it.path.contains( 'org/hibernate/sql/ordering/antlr/Generated' ) &&
|
|
|
|
!it.path.contains( 'org/hibernate/sql/ordering/antlr/OrderByTemplateTokenTypes' ) &&
|
|
|
|
!it.path.contains( 'org/hibernate/boot/jaxb/hbm/spi/Jaxb' ) &&
|
|
|
|
!it.path.contains( 'org/hibernate/boot/jaxb/hbm/spi/Adapter' ) &&
|
|
|
|
!it.path.contains( 'org/hibernate/boot/jaxb/hbm/spi/ObjectFactory' ) &&
|
|
|
|
!it.path.contains( 'org/hibernate/cfg' ) &&
|
|
|
|
!it.path.contains( '_\$logger' )
|
|
|
|
}
|
2015-05-18 11:48:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// because cfg package is a mess mainly from annotation stuff
|
2015-04-20 13:00:12 -04:00
|
|
|
checkstyleMain.exclude '**/org/hibernate/cfg/**'
|
|
|
|
checkstyleMain.exclude '**/org/hibernate/cfg/*'
|
2013-12-02 21:53:19 -05:00
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
2016-03-31 13:04:10 -04:00
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// Publishing
|
2017-12-18 14:23:25 -05:00
|
|
|
if ( !subProject.name.equals( 'documentation' ) && !subProject.name.equals( 'hibernate-infinispan' ) ) {
|
2017-12-13 10:15:22 -05:00
|
|
|
// do not configure publishing for the documentation module
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
from components.java
|
|
|
|
|
|
|
|
artifact( sourcesJar ) {
|
|
|
|
classifier 'sources'
|
|
|
|
}
|
2017-12-22 12:49:07 -05:00
|
|
|
|
|
|
|
artifact(javadocJar) {
|
|
|
|
classifier "javadoc"
|
|
|
|
}
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
2017-12-13 10:15:22 -05:00
|
|
|
// http://issues.gradle.org/browse/GRADLE-2966
|
|
|
|
// Once ^^ is resolved:
|
|
|
|
// 1) Move hibernate-testing module into hibernate-core tests
|
|
|
|
// 2) Define a second publication on hibernate-core for publishing the testing jar
|
|
|
|
// We could kind of do this now, but it would just be the jar. Every module would still need
|
|
|
|
// to duplicate the testing dependencies. Well, on second thought, we could centralize the
|
|
|
|
// testing dependencies here within the subprojects block
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-13 10:15:22 -05:00
|
|
|
model {
|
|
|
|
tasks.generatePomFileForMavenJavaPublication {
|
|
|
|
destination = file( "$subProject.buildDir/generated-pom.xml" )
|
|
|
|
}
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
|
|
|
}
|
2016-03-31 13:04:10 -04:00
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2013-12-02 21:53:19 -05:00
|
|
|
|
2010-10-08 21:20:10 -04:00
|
|
|
}
|
2013-05-16 19:51:53 -04:00
|
|
|
|
|
|
|
task release(type: Task, dependsOn: 'release:release')
|
2013-11-21 14:46:03 -05:00
|
|
|
|
|
|
|
task wrapper(type: Wrapper) {
|
|
|
|
gradleVersion = expectedGradleVersion
|
|
|
|
}
|
2015-05-18 11:48:10 -04:00
|
|
|
|
2016-09-26 18:33:20 -04:00
|
|
|
buildScan {
|
|
|
|
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
|
|
|
|
licenseAgree = 'yes'
|
2016-12-16 10:55:32 -05:00
|
|
|
|
|
|
|
recipe 'git-commit', baseUrl: 'https://github.com/hibernate/hibernate-orm/tree'
|
2016-09-26 18:33:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-18 11:48:10 -04:00
|
|
|
def excludeAllLowLevelBugsExcept(String[] bugTypes){
|
|
|
|
def writer = new StringWriter()
|
|
|
|
def xml = new groovy.xml.MarkupBuilder(writer);
|
|
|
|
xml.FindBugsFilter {
|
|
|
|
Match {
|
|
|
|
Confidence( value: '3' )
|
|
|
|
bugTypes.each { bug ->
|
|
|
|
Not {
|
|
|
|
Bug( pattern: "${bug}" )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return writer.toString( )
|
|
|
|
}
|