HHH-9717 - Build script improvements - applied new standalone XJC and AnimalSniffer plugins
This commit is contained in:
parent
da06b22dee
commit
650267077d
206
build.gradle
206
build.gradle
|
@ -24,7 +24,6 @@ buildscript {
|
|||
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:version-injection-plugin:1.0.0'
|
||||
classpath 'org.hibernate.build.gradle:gradle-animalSniffer-plugin:1.0.1.Final'
|
||||
classpath 'org.hibernate.build.gradle:gradle-xjc-plugin:1.0.2.Final'
|
||||
}
|
||||
}
|
||||
|
@ -48,39 +47,10 @@ allprojects {
|
|||
ext {
|
||||
expectedGradleVersion = '2.2'
|
||||
hibernateTargetVersion = '5.0.0-SNAPSHOT'
|
||||
javaLanguageLevel = '1.6'
|
||||
|
||||
osgiExportVersion = hibernateTargetVersion.replaceAll( '-SNAPSHOT', '.SNAPSHOT' )
|
||||
}
|
||||
|
||||
if ( !JavaVersion.current().java8Compatible ) {
|
||||
throw new GradleException( "Gradle must be run with Java 8" )
|
||||
}
|
||||
|
||||
final Jvm java6Home;
|
||||
|
||||
String java6HomeDirSetting = null;
|
||||
if ( rootProject.hasProperty( "JDK6_HOME" ) ) {
|
||||
java6HomeDirSetting = rootProject.property( "JDK6_HOME" ) as String;
|
||||
}
|
||||
if ( java6HomeDirSetting == null ) {
|
||||
java6HomeDirSetting = System.getProperty( "JDK6_HOME" );
|
||||
}
|
||||
|
||||
if ( java6HomeDirSetting != null ) {
|
||||
logger.info( "Using JDK6_HOME setting [${java6HomeDirSetting}]" )
|
||||
final File java6HomeDir = new File( java6HomeDirSetting );
|
||||
java6Home = Jvm.forHome( java6HomeDir ) as Jvm;
|
||||
|
||||
if ( java6Home == null ) {
|
||||
throw new GradleException( "Could not resolve JDK6_HOME [${java6HomeDirSetting}] to proper JAVA_HOME" );
|
||||
}
|
||||
}
|
||||
else {
|
||||
logger.warn( "JDK6_HOME setting not specified, some build features will be disabled" )
|
||||
java6Home = null;
|
||||
}
|
||||
|
||||
idea {
|
||||
project {
|
||||
jdkName = '1.6'
|
||||
|
@ -93,20 +63,11 @@ idea {
|
|||
}
|
||||
}
|
||||
|
||||
// Used in POM customization. Each sub-project overrides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
def pomName() {
|
||||
return "A Hibernate O/RM module"
|
||||
}
|
||||
def pomDescription() {
|
||||
return "A module of the Hibernate O/RM project"
|
||||
}
|
||||
// Used in MANIFEST.MF for OSGi Bundles
|
||||
def osgiDescription() {
|
||||
// by default just reuse the pomDescription
|
||||
return pomDescription()
|
||||
return "A module of the Hibernate O/RM project"
|
||||
}
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
subprojects { subProject ->
|
||||
|
@ -117,6 +78,7 @@ subprojects { subProject ->
|
|||
|
||||
group = 'org.hibernate'
|
||||
version = rootProject.hibernateTargetVersion
|
||||
|
||||
ext.exportPackageVersion = rootProject.osgiExportVersion
|
||||
|
||||
// minimize changes, at least for now (gradle uses 'build' by default)..
|
||||
|
@ -132,20 +94,12 @@ subprojects { subProject ->
|
|||
apply plugin: 'maven-publish-auth'
|
||||
apply plugin: 'osgi'
|
||||
|
||||
apply from: "${rootProject.projectDir}/source-generation.gradle"
|
||||
|
||||
apply plugin: 'findbugs'
|
||||
apply plugin: 'checkstyle'
|
||||
apply plugin: 'build-dashboard'
|
||||
apply plugin: 'project-report'
|
||||
|
||||
apply plugin: 'org.hibernate.build.gradle.animalSniffer'
|
||||
|
||||
if ( subProject.name == 'hibernate-java8' ) {
|
||||
animalSniffer {
|
||||
skip = true
|
||||
}
|
||||
}
|
||||
apply plugin: org.hibernate.build.HibernateBuildPlugin
|
||||
|
||||
configurations {
|
||||
provided {
|
||||
|
@ -172,9 +126,6 @@ subprojects { subProject ->
|
|||
testRuntime( libraries.javassist )
|
||||
testRuntime( libraries.h2 )
|
||||
testRuntime( libraries.woodstox )
|
||||
|
||||
// Configuration added by the AnimalSniffer plugin
|
||||
animalSnifferSignature libraries.java16_signature
|
||||
}
|
||||
|
||||
// mac-specific stuff ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -187,9 +138,6 @@ subprojects { subProject ->
|
|||
}
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
targetCompatibility = rootProject.javaLanguageLevel
|
||||
sourceCompatibility = rootProject.javaLanguageLevel
|
||||
|
||||
task compile
|
||||
compile.dependsOn compileJava, processResources, compileTestJava, processTestResources
|
||||
|
||||
|
@ -197,63 +145,6 @@ subprojects { subProject ->
|
|||
compileClasspath += configurations.provided
|
||||
}
|
||||
|
||||
tasks.withType( JavaCompile.class ).all { task->
|
||||
// basic compile options
|
||||
task.options.compilerArgs += [
|
||||
"-nowarn",
|
||||
"-encoding", "UTF-8"
|
||||
]
|
||||
|
||||
if ( subProject.name.equals( 'hibernate-java8' ) ) {
|
||||
// For hibernate-java8 module, simply compile using Java 8 JDK which is required to
|
||||
// launch Gradle (for now). This is verified in settings.gradle
|
||||
task.options.compilerArgs += [
|
||||
"-source", '1.8',
|
||||
"-target", '1.8'
|
||||
]
|
||||
}
|
||||
else {
|
||||
// For all other modules, use the 1.6 JDK (if available) as bootstrapclasspath
|
||||
task.options.compilerArgs += [
|
||||
"-source", '1.6',
|
||||
"-target", '1.6'
|
||||
]
|
||||
|
||||
// if ( java6Home != null ) {
|
||||
// task.options.bootClasspath = java6Home.runtimeJar.absolutePath
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType( Test.class ).all { task->
|
||||
task.jvmArgs += ['-XX:+HeapDumpOnOutOfMemoryError', "-XX:HeapDumpPath=${subProject.file('target/OOM-dump.hprof').absolutePath}"]
|
||||
|
||||
if ( subProject.name.equals( 'hibernate-osgi' ) ) {
|
||||
// hibernate-osgi *must* be run using Java 6 or 7. So disable its tests if
|
||||
// java6Home is not available
|
||||
if ( java6Home == null ) {
|
||||
task.enabled = false;
|
||||
}
|
||||
else {
|
||||
task.executable = java6Home.javaExecutable
|
||||
task.maxHeapSize = '2G'
|
||||
task.jvmArgs += ['-XX:MaxPermGen=512M']
|
||||
}
|
||||
}
|
||||
else {
|
||||
// for all other modules, just use the Java 8 used to launch Gradle (for now)
|
||||
task.maxHeapSize = '2G'
|
||||
task.jvmArgs += ['-XX:MetaspaceSize=512M']
|
||||
}
|
||||
|
||||
// task.beforeTest { descriptor ->
|
||||
// println "Starting test: " + descriptor
|
||||
// }
|
||||
// task.afterTest { descriptor ->
|
||||
// println "Completed test: " + descriptor
|
||||
// }
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest = osgiManifest {
|
||||
// GRADLE-1411: Even if we override Imports and Exports
|
||||
|
@ -283,7 +174,14 @@ subprojects { subProject ->
|
|||
test {
|
||||
systemProperties['hibernate.test.validatefailureexpected'] = true
|
||||
systemProperties += System.properties.findAll { it.key.startsWith( "hibernate.") }
|
||||
maxHeapSize = "1024m"
|
||||
|
||||
// beforeTest { descriptor ->
|
||||
// println "Starting test: " + descriptor
|
||||
// }
|
||||
|
||||
// afterTest { descriptor ->
|
||||
// println "Completed test: " + descriptor
|
||||
// }
|
||||
}
|
||||
|
||||
processTestResources.doLast( {
|
||||
|
@ -298,9 +196,7 @@ subprojects { subProject ->
|
|||
|
||||
idea {
|
||||
module {
|
||||
if ( subProject.name.equals( 'hibernate-java8' ) ) {
|
||||
jdkName = '1.8'
|
||||
}
|
||||
jdkName = javaTarget.version
|
||||
|
||||
excludeDirs = [file( ".gradle" )]
|
||||
excludeDirs += file( "$buildDir/classes" )
|
||||
|
@ -320,11 +216,9 @@ subprojects { subProject ->
|
|||
}
|
||||
|
||||
eclipse {
|
||||
if ( subProject.name != 'hibernate-java8' && java6Home != null ) {
|
||||
jdt {
|
||||
sourceCompatibility = '1.6'
|
||||
targetCompatibility = '1.6'
|
||||
}
|
||||
sourceCompatibility = javaTarget.version
|
||||
targetCompatibility = javaTarget.version
|
||||
}
|
||||
classpath {
|
||||
plusConfigurations.add( configurations.provided )
|
||||
|
@ -334,7 +228,7 @@ subprojects { subProject ->
|
|||
// 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 generateSources
|
||||
eclipseClasspath.dependsOn compile
|
||||
|
||||
// specialized API/SPI checkstyle tasks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
task checkstylePublicSources(type: Checkstyle) {
|
||||
|
@ -400,69 +294,17 @@ subprojects { subProject ->
|
|||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
|
||||
artifact sourcesJar {
|
||||
classifier "sources"
|
||||
}
|
||||
|
||||
pom.withXml {
|
||||
// append additional metadata
|
||||
asNode().children().last() + {
|
||||
resolveStrategy = Closure.DELEGATE_FIRST
|
||||
|
||||
name subProject.pomName()
|
||||
description subProject.pomDescription()
|
||||
url 'http://hibernate.org'
|
||||
organization {
|
||||
name 'Hibernate.org'
|
||||
url 'http://hibernate.org'
|
||||
}
|
||||
issueManagement {
|
||||
system 'jira'
|
||||
url 'https://hibernate.atlassian.net/browse/HHH'
|
||||
}
|
||||
scm {
|
||||
url 'http://github.com/hibernate/hibernate-orm'
|
||||
connection 'scm:git:http://github.com/hibernate/hibernate-orm.git'
|
||||
developerConnection 'scm:git:git@github.com:hibernate/hibernate-orm.git'
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name 'GNU Lesser General Public License'
|
||||
url 'http://www.gnu.org/licenses/lgpl-2.1.html'
|
||||
comments 'See discussion at http://hibernate.org/license for more details.'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id 'hibernate-team'
|
||||
name 'The Hibernate Development Team'
|
||||
organization 'Hibernate.org'
|
||||
organizationUrl 'http://hibernate.org'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TEMPORARY : currently Gradle Publishing feature is exporting dependencies as 'runtime' scope,
|
||||
// rather than 'compile'; fix that.
|
||||
asNode().dependencies[0].dependency.each {
|
||||
it.scope[0].value = 'compile'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
if ( subProject.version.endsWith( 'SNAPSHOT' ) ) {
|
||||
name 'jboss-snapshots-repository'
|
||||
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
|
||||
}
|
||||
else {
|
||||
name 'jboss-releases-repository'
|
||||
url 'https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/'
|
||||
artifact( sourcesJar ) {
|
||||
classifier 'sources'
|
||||
}
|
||||
}
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
|
||||
maven {
|
||||
name 'jboss-nexus'
|
||||
url "http://repository.jboss.org/nexus/content/groups/public/"
|
||||
}
|
||||
maven {
|
||||
name "jboss-snapshots"
|
||||
url "http://snapshots.jboss.org/maven2/"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "groovy"
|
||||
|
@ -7,4 +17,6 @@ apply plugin: "groovy"
|
|||
dependencies {
|
||||
compile gradleApi()
|
||||
compile localGroovy()
|
||||
|
||||
compile 'org.hibernate.build.gradle:gradle-animalSniffer-plugin:1.0.1.Final'
|
||||
}
|
|
@ -0,0 +1,259 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2015, 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
|
||||
*/
|
||||
package org.hibernate.build
|
||||
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.api.publish.PublishingExtension
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.tasks.SourceSet
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.internal.jvm.Jvm
|
||||
|
||||
import org.hibernate.build.gradle.animalsniffer.AnimalSnifferExtension
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
class HibernateBuildPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
if ( !JavaVersion.current().java8Compatible ) {
|
||||
throw new GradleException( "Gradle must be run with Java 8" )
|
||||
}
|
||||
|
||||
project.apply( plugin: 'org.hibernate.build.gradle.animalSniffer' )
|
||||
|
||||
final Jvm java6Home;
|
||||
if ( project.rootProject.extensions.extraProperties.has( 'java6Home' ) ) {
|
||||
java6Home = project.rootProject.extensions.extraProperties.get( 'java6Home' ) as Jvm
|
||||
}
|
||||
else {
|
||||
String java6HomeDirSetting = null;
|
||||
if ( project.hasProperty( "JAVA6_HOME" ) ) {
|
||||
java6HomeDirSetting = project.property( "JAVA6_HOME" ) as String;
|
||||
}
|
||||
if ( java6HomeDirSetting == null ) {
|
||||
java6HomeDirSetting = System.getProperty( "JAVA6_HOME" );
|
||||
}
|
||||
|
||||
if ( java6HomeDirSetting != null ) {
|
||||
project.logger.info( "Using JAVA6_HOME setting [${java6HomeDirSetting}]" )
|
||||
|
||||
final File specifiedJava6Home = project.file( java6HomeDirSetting );
|
||||
if ( specifiedJava6Home == null ) {
|
||||
throw new GradleException( "Could not resolve specified java home ${java6HomeDirSetting}" )
|
||||
}
|
||||
if ( !specifiedJava6Home.exists() ) {
|
||||
throw new GradleException( "Specified java home [${java6HomeDirSetting}] does not exist" )
|
||||
}
|
||||
if ( !specifiedJava6Home.isDirectory() ) {
|
||||
throw new GradleException( "Specified java home [${java6HomeDirSetting}] is not a directory" )
|
||||
}
|
||||
|
||||
java6Home = Jvm.forHome( specifiedJava6Home ) as Jvm;
|
||||
|
||||
if ( java6Home == null ) {
|
||||
throw new GradleException( "Could not resolve JAVA6_HOME [${java6HomeDirSetting}] to proper JAVA_HOME" );
|
||||
}
|
||||
|
||||
project.rootProject.extensions.extraProperties.set( 'java6Home', java6Home )
|
||||
}
|
||||
else {
|
||||
project.logger.warn( "JAVA6_HOME setting not specified, some build features will be disabled" )
|
||||
java6Home = null;
|
||||
}
|
||||
}
|
||||
|
||||
JavaTargetExtension javaTargetExtension = project.extensions.create( "javaTarget", JavaTargetExtension, project )
|
||||
MavenPublishingExtension publishingExtension = project.extensions.create( "mavenPom", MavenPublishingExtension )
|
||||
|
||||
project.afterEvaluate {
|
||||
applyJavaTarget( javaTargetExtension, project, java6Home )
|
||||
applyPublishing( publishingExtension, project )
|
||||
}
|
||||
}
|
||||
|
||||
def applyJavaTarget(JavaTargetExtension javaTargetExtension, Project project, Jvm java6Home) {
|
||||
|
||||
project.properties.put( 'sourceCompatibility', "${javaTargetExtension.version}" )
|
||||
project.properties.put( 'targetCompatibility', "${javaTargetExtension.version}" )
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// apply AnimalSniffer
|
||||
|
||||
if ( javaTargetExtension.version.java8Compatible ) {
|
||||
AnimalSnifferExtension animalSnifferExtension = project.extensions.findByType( AnimalSnifferExtension )
|
||||
if ( animalSnifferExtension == null ) {
|
||||
throw new GradleException( "Unable to locate AnimalSniffer extension" )
|
||||
}
|
||||
animalSnifferExtension.skip = true
|
||||
}
|
||||
else {
|
||||
// todo : we could really disable this if we set executable/bootClasspath below
|
||||
def sigConfig = project.configurations.animalSnifferSignature
|
||||
sigConfig.incoming.beforeResolve {
|
||||
sigConfig.dependencies.add( project.dependencies.create( 'org.codehaus.mojo.signature:java16:1.0@signature' ) )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Apply to compile task (just for main sourceSet)
|
||||
|
||||
SourceSet mainSourceSet = project.getConvention().findPlugin( JavaPluginConvention.class ).sourceSets.findByName( "main" )
|
||||
JavaCompile compileTask = project.tasks.findByName( mainSourceSet.compileJavaTaskName ) as JavaCompile
|
||||
|
||||
compileTask.options.compilerArgs += [
|
||||
"-nowarn",
|
||||
"-encoding", "UTF-8"
|
||||
]
|
||||
|
||||
if ( javaTargetExtension.version.java8Compatible ) {
|
||||
compileTask.options.compilerArgs += [
|
||||
"-source", '1.8',
|
||||
"-target", '1.8'
|
||||
]
|
||||
}
|
||||
else {
|
||||
compileTask.options.compilerArgs += [
|
||||
"-source", '1.6',
|
||||
"-target", '1.6'
|
||||
]
|
||||
|
||||
if ( java6Home != null ) {
|
||||
if ( javaTargetExtension.shouldApplyTargetToCompile ) {
|
||||
// Technically we need only one here between:
|
||||
// 1) setting the javac executable
|
||||
// 2) setting the bootClasspath
|
||||
// However, (1) requires fork=true whereas (2) does not.
|
||||
// compileTask.options.fork = true
|
||||
// compileTask.options.forkOptions.executable = java6Home.javacExecutable
|
||||
compileTask.options.bootClasspath = java6Home.runtimeJar.absolutePath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Apply to test tasks
|
||||
|
||||
project.tasks.withType( Test.class ).all { task->
|
||||
task.jvmArgs += ['-XX:+HeapDumpOnOutOfMemoryError', "-XX:HeapDumpPath=${project.file("${project.buildDir}/OOM-dump.hprof").absolutePath}"]
|
||||
|
||||
// if ( !javaTargetExtension.version.java8Compatible && javaTargetExtension.shouldApplyTargetToTest ) {
|
||||
// // use Java 6 settings
|
||||
// task.executable = java6Home.javaExecutable
|
||||
// task.maxHeapSize = '2G'
|
||||
// task.jvmArgs += ['-XX:MaxPermGen=512M']
|
||||
// }
|
||||
// else {
|
||||
// use Java 8 settings
|
||||
task.maxHeapSize = '2G'
|
||||
task.jvmArgs += ['-XX:MetaspaceSize=512M']
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
def applyPublishing(MavenPublishingExtension publishingExtension, Project project) {
|
||||
PublishingExtension gradlePublishingExtension = project.extensions.getByType( PublishingExtension )
|
||||
|
||||
// repos
|
||||
if ( gradlePublishingExtension.repositories.empty ) {
|
||||
if ( project.version.endsWith( 'SNAPSHOT' ) ) {
|
||||
gradlePublishingExtension.repositories.maven {
|
||||
name 'jboss-snapshots-repository'
|
||||
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
|
||||
}
|
||||
}
|
||||
else {
|
||||
gradlePublishingExtension.repositories.maven {
|
||||
name 'jboss-releases-repository'
|
||||
url 'https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pom
|
||||
gradlePublishingExtension.publications.withType( MavenPublication ).all { pub->
|
||||
final boolean applyExtensionValues = publishingExtension.publications == null || publishingExtension.publications.length == 0 || pub in publishingExtension.publications;
|
||||
|
||||
pom.withXml {
|
||||
if ( applyExtensionValues ) {
|
||||
asNode().appendNode( 'name', publishingExtension.name )
|
||||
asNode().appendNode( 'description', publishingExtension.description )
|
||||
Node licenseNode = asNode().appendNode( "license" )
|
||||
if ( publishingExtension.license == MavenPublishingExtension.License.APACHE2 ) {
|
||||
licenseNode.appendNode( 'name', 'Apache License, Version 2.0' )
|
||||
licenseNode.appendNode( 'url', 'http://www.apache.org/licenses/LICENSE-2.0.txt' )
|
||||
}
|
||||
else {
|
||||
licenseNode.appendNode( 'name', 'GNU Lesser General Public License' )
|
||||
licenseNode.appendNode( 'url', 'http://www.gnu.org/licenses/lgpl-2.1.html' )
|
||||
licenseNode.appendNode( 'comments', 'See discussion at http://hibernate.org/license for more details.' )
|
||||
}
|
||||
licenseNode.appendNode( 'distribution', 'repo' )
|
||||
}
|
||||
|
||||
asNode().children().last() + {
|
||||
url 'http://hibernate.org'
|
||||
organization {
|
||||
name 'Hibernate.org'
|
||||
url 'http://hibernate.org'
|
||||
}
|
||||
issueManagement {
|
||||
system 'jira'
|
||||
url 'https://hibernate.atlassian.net/browse/HHH'
|
||||
}
|
||||
scm {
|
||||
url 'http://github.com/hibernate/hibernate-orm'
|
||||
connection 'scm:git:http://github.com/hibernate/hibernate-orm.git'
|
||||
developerConnection 'scm:git:git@github.com:hibernate/hibernate-orm.git'
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id 'hibernate-team'
|
||||
name 'The Hibernate Development Team'
|
||||
organization 'Hibernate.org'
|
||||
organizationUrl 'http://hibernate.org'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TEMPORARY : currently Gradle Publishing feature is exporting dependencies as 'runtime' scope,
|
||||
// rather than 'compile'; fix that.
|
||||
if ( asNode().dependencies != null ) {
|
||||
asNode().dependencies[0].dependency.each {
|
||||
it.scope[0].value = 'compile'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2015, 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
|
||||
*/
|
||||
package org.hibernate.build
|
||||
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.internal.jvm.Jvm
|
||||
|
||||
/**
|
||||
* Defines a Gradle Project extension to hold information pertaining to the targeted Java version
|
||||
* for the project. This information can then be used to configure tasks (JavaCompile, etc).
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
class JavaTargetExtension {
|
||||
private final Project project
|
||||
|
||||
JavaVersion version = JavaVersion.VERSION_1_6
|
||||
|
||||
boolean shouldApplyTargetToCompile = true
|
||||
boolean shouldApplyTargetToTest = true
|
||||
|
||||
JavaTargetExtension(Project project) {
|
||||
this.project = project
|
||||
}
|
||||
|
||||
JavaVersion getVersion() {
|
||||
return version
|
||||
}
|
||||
|
||||
void setVersion(Object version) {
|
||||
this.version = JavaVersion.toVersion( version );
|
||||
if ( this.version == null ) {
|
||||
this.version = JavaVersion.VERSION_1_6
|
||||
}
|
||||
}
|
||||
|
||||
Jvm getJavaHome() {
|
||||
return javaHome
|
||||
}
|
||||
|
||||
void setJavaHome(Object javaHome) {
|
||||
if ( javaHome == null ) {
|
||||
this.javaHome = null
|
||||
}
|
||||
else if ( javaHome instanceof Jvm ) {
|
||||
this.javaHome = javaHome as Jvm
|
||||
}
|
||||
else {
|
||||
final File specifiedJavaHome = project.file( javaHome );
|
||||
if ( specifiedJavaHome == null ) {
|
||||
throw new GradleException( "Could not resolve specified java home ${javaHome}" )
|
||||
}
|
||||
if ( !specifiedJavaHome.exists() ) {
|
||||
throw new GradleException( "Specified java home [${javaHome}] does not exist" )
|
||||
}
|
||||
if ( !specifiedJavaHome.isDirectory() ) {
|
||||
throw new GradleException( "Specified java home [${javaHome}] is not a directory" )
|
||||
}
|
||||
this.javaHome = Jvm.forHome( specifiedJavaHome ) as Jvm
|
||||
}
|
||||
}
|
||||
|
||||
boolean getShouldApplyTargetToCompile() {
|
||||
return shouldApplyTargetToCompile
|
||||
}
|
||||
|
||||
void setShouldApplyTargetToCompile(boolean shouldApplyTargetToCompile) {
|
||||
this.shouldApplyTargetToCompile = shouldApplyTargetToCompile
|
||||
}
|
||||
|
||||
boolean getShouldApplyTargetToTest() {
|
||||
return shouldApplyTargetToTest
|
||||
}
|
||||
|
||||
void setShouldApplyTargetToTest(boolean shouldApplyTargetToTest) {
|
||||
this.shouldApplyTargetToTest = shouldApplyTargetToTest
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2015, 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
|
||||
*/
|
||||
package org.hibernate.build
|
||||
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
|
||||
/**
|
||||
* Defines the information we wish to put into the generated POM for publishing
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
class MavenPublishingExtension {
|
||||
public static enum License {
|
||||
APACHE2,
|
||||
LGPL
|
||||
}
|
||||
|
||||
// The Publications to which the pom information contained here should be supplied.
|
||||
// By default will apply to all. This is used to limit them.
|
||||
def MavenPublication[] publications = []
|
||||
|
||||
// information for the generated pom
|
||||
def String name;
|
||||
def String description;
|
||||
def License license;
|
||||
|
||||
MavenPublication[] getPublications() {
|
||||
return publications
|
||||
}
|
||||
|
||||
void setPublications(MavenPublication[] publications) {
|
||||
this.publications = publications
|
||||
}
|
||||
|
||||
def publication(MavenPublication publication) {
|
||||
publications << publication
|
||||
}
|
||||
|
||||
String getName() {
|
||||
return name
|
||||
}
|
||||
|
||||
void setName(String name) {
|
||||
this.name = name
|
||||
}
|
||||
|
||||
String getDescription() {
|
||||
return description
|
||||
}
|
||||
|
||||
void setDescription(String description) {
|
||||
this.description = description
|
||||
}
|
||||
|
||||
License getLicense() {
|
||||
return license
|
||||
}
|
||||
|
||||
void setLicense(License license) {
|
||||
this.license = license
|
||||
}
|
||||
|
||||
void license(Object license) {
|
||||
if ( license == null ) {
|
||||
setLicense( License.LGPL )
|
||||
}
|
||||
else if ( license instanceof License ) {
|
||||
setLicense( license as License )
|
||||
}
|
||||
else {
|
||||
setLicense( License.valueOf( license.toString().toUpperCase( Locale.ENGLISH ) ) )
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,14 +9,11 @@ dependencies {
|
|||
testCompile project( ':hibernate-testing' )
|
||||
}
|
||||
|
||||
def pomName() {
|
||||
return 'Hibernate/c3p0 Integration'
|
||||
}
|
||||
|
||||
def pomDescription() {
|
||||
return 'Integration for c3p0 Connection pooling into Hibernate O/RM'
|
||||
mavenPom {
|
||||
name = 'Hibernate/c3p0 Integration'
|
||||
description = 'Integration for c3p0 Connection pooling into Hibernate O/RM'
|
||||
}
|
||||
|
||||
def osgiDescription() {
|
||||
return pomDescription()
|
||||
return mavenPom.description
|
||||
}
|
|
@ -4,10 +4,6 @@ apply plugin: 'hibernate-matrix-testing'
|
|||
apply plugin: 'version-injection'
|
||||
apply plugin: 'org.hibernate.build.gradle.xjc'
|
||||
|
||||
versionInjection {
|
||||
into( 'org.hibernate.Version', 'getVersionString' )
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile( libraries.jta )
|
||||
compile( libraries.jpa )
|
||||
|
@ -46,16 +42,17 @@ dependencies {
|
|||
testRuntime( libraries.unified_el )
|
||||
}
|
||||
|
||||
def pomName() {
|
||||
return 'Core Hibernate O/RM functionality'
|
||||
}
|
||||
|
||||
def pomDescription() {
|
||||
return 'The core O/RM functionality as provided by Hibernate'
|
||||
mavenPom {
|
||||
name = 'Core Hibernate O/RM functionality'
|
||||
description = 'The core O/RM functionality as provided by Hibernate'
|
||||
}
|
||||
|
||||
def osgiDescription() {
|
||||
return pomDescription()
|
||||
return mavenPom.description
|
||||
}
|
||||
|
||||
versionInjection {
|
||||
into( 'org.hibernate.Version', 'getVersionString' )
|
||||
}
|
||||
|
||||
jar {
|
||||
|
@ -129,4 +126,5 @@ xjc {
|
|||
|
||||
|
||||
//sourceSets.main.sourceGeneratorsTask.dependsOn xjc
|
||||
sourceSets.main.sourceGeneratorsTask.dependsOn generateGrammarSource
|
||||
//sourceSets.main.sourceGeneratorsTask.dependsOn generateGrammarSource
|
||||
tasks.compile.dependsOn generateGrammarSource
|
||||
|
|
|
@ -5,14 +5,11 @@ dependencies {
|
|||
testCompile project( ':hibernate-testing' )
|
||||
}
|
||||
|
||||
def pomName() {
|
||||
return 'Hibernate/Ehcache Integration'
|
||||
}
|
||||
|
||||
def pomDescription() {
|
||||
return 'Integration for Ehcache into Hibernate as a second-level caching service'
|
||||
mavenPom {
|
||||
name = 'Hibernate/Ehcache Integration'
|
||||
description = 'Integration for Ehcache into Hibernate as a second-level caching service'
|
||||
}
|
||||
|
||||
def osgiDescription() {
|
||||
return pomDescription()
|
||||
return mavenPom.description
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@ configurations {
|
|||
hibernateJpaModelGenTool {
|
||||
description = "Dependencies for running the Hibernate JPA Metamodel Generator AnnotationProcessor tool"
|
||||
}
|
||||
tests {
|
||||
description = 'Configuration for the produced test jar'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -35,19 +38,16 @@ dependencies {
|
|||
|
||||
testCompile( 'joda-time:joda-time:2.3' )
|
||||
|
||||
hibernateJpaModelGenTool( project( ':hibernate-jpamodelgen' ) )
|
||||
testCompile( project( ':hibernate-jpamodelgen' ) )
|
||||
}
|
||||
|
||||
public String pomName() {
|
||||
return 'Hibernate JPA Support'
|
||||
}
|
||||
|
||||
public String pomDescription() {
|
||||
return 'Hibernate O/RM implementation of the JPA specification'
|
||||
mavenPom {
|
||||
name = 'Hibernate JPA Support'
|
||||
description = 'Hibernate O/RM implementation of the JPA specification'
|
||||
}
|
||||
|
||||
public String osgiDescription() {
|
||||
return pomDescription()
|
||||
return mavenPom.description
|
||||
}
|
||||
|
||||
jar {
|
||||
|
@ -73,7 +73,7 @@ jar {
|
|||
}
|
||||
}
|
||||
|
||||
addMetaGenProcessor( sourceSets.test )
|
||||
//addMetaGenProcessor( sourceSets.test )
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -103,10 +103,6 @@ task testJar(type: Jar, dependsOn: testClasses) {
|
|||
from sourceSets.test.output
|
||||
}
|
||||
|
||||
configurations {
|
||||
tests
|
||||
}
|
||||
|
||||
artifacts {
|
||||
tests testJar
|
||||
}
|
||||
|
|
|
@ -13,16 +13,14 @@ dependencies {
|
|||
testRuntime( libraries.javassist )
|
||||
}
|
||||
|
||||
def pomName() {
|
||||
return 'Entity versioning support'
|
||||
}
|
||||
mavenPom {
|
||||
name = 'ENtity VERSioning support'
|
||||
description = 'ENtity VERSioning support'
|
||||
|
||||
def pomDescription() {
|
||||
return 'Entity versioning support'
|
||||
}
|
||||
|
||||
def osgiDescription() {
|
||||
return pomDescription()
|
||||
return mavenPom.description
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
|
|
@ -4,14 +4,11 @@ dependencies {
|
|||
testCompile project( ':hibernate-testing' )
|
||||
}
|
||||
|
||||
def pomName() {
|
||||
return 'Hibernate/HikariCP Integration'
|
||||
}
|
||||
|
||||
def pomDescription() {
|
||||
return 'Integration for HikariCP into Hibernate O/RM'
|
||||
mavenPom {
|
||||
name = 'Hibernate/HikariCP Integration'
|
||||
description = 'Integration for HikariCP into Hibernate O/RM'
|
||||
}
|
||||
|
||||
def osgiDescription() {
|
||||
return pomDescription()
|
||||
return mavenPom.description
|
||||
}
|
||||
|
|
|
@ -16,16 +16,13 @@ dependencies {
|
|||
testCompile ('mysql:mysql-connector-java:5.1.17')
|
||||
}
|
||||
|
||||
def pomName() {
|
||||
return 'Hibernate/Infinispan Integration'
|
||||
}
|
||||
|
||||
def pomDescription() {
|
||||
return 'Integration for Infinispan into Hibernate as a second-level caching service'
|
||||
mavenPom {
|
||||
name = 'Hibernate/Infinispan Integration'
|
||||
description = 'Integration for Infinispan into Hibernate as a second-level caching service'
|
||||
}
|
||||
|
||||
def osgiDescription() {
|
||||
return pomDescription()
|
||||
return mavenPom.description
|
||||
}
|
||||
|
||||
test {
|
||||
|
|
|
@ -3,15 +3,15 @@ dependencies {
|
|||
testCompile( project(':hibernate-testing') )
|
||||
}
|
||||
|
||||
|
||||
def pomName() {
|
||||
return 'Java8-specific Hibernate O/RM functionality'
|
||||
javaTarget {
|
||||
version = '1.8'
|
||||
}
|
||||
|
||||
def pomDescription() {
|
||||
return 'Mainly support for Java8 Date/Time (JSR 310)'
|
||||
mavenPom {
|
||||
name = 'Java8-specific Hibernate O/RM functionality'
|
||||
description = 'Support for Java8-specific features - mainly Java8 Date/Time (JSR 310)'
|
||||
}
|
||||
|
||||
def osgiDescription() {
|
||||
return pomDescription()
|
||||
return mavenPom.description
|
||||
}
|
||||
|
|
|
@ -9,10 +9,6 @@ configurations {
|
|||
}
|
||||
}
|
||||
|
||||
test {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
testClientBundle
|
||||
}
|
||||
|
@ -22,6 +18,36 @@ sourceSets.test {
|
|||
runtimeClasspath += sourceSets.testClientBundle.output
|
||||
}
|
||||
|
||||
test {
|
||||
// for now, always disable!!
|
||||
enabled = false
|
||||
|
||||
}
|
||||
|
||||
if ( project.properties.java6Home == null ) {
|
||||
// hibernate-osgi *must* be run using Java 6 or 7. So disable its tests if
|
||||
// java6Home is not available
|
||||
enabled = false
|
||||
}
|
||||
else {
|
||||
compileTestJava {
|
||||
options.fork = true
|
||||
options.forkOptions.executable = project.properties.java6Home.javacExecutable
|
||||
options.bootClasspath = project.properties.java6Home.runtimeJar.absolutePath
|
||||
}
|
||||
compileTestClientBundleJava {
|
||||
options.fork = true
|
||||
options.forkOptions.executable = project.properties.java6Home.javacExecutable
|
||||
options.bootClasspath = project.properties.java6Home.runtimeJar.absolutePath
|
||||
}
|
||||
|
||||
test {
|
||||
executable = project.properties.java6Home
|
||||
maxHeapSize = '2G'
|
||||
jvmArgs += ['-XX:MaxPermGen=512M']
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile( project( ':hibernate-core' ) )
|
||||
compile( project( ':hibernate-entitymanager' ) )
|
||||
|
@ -71,16 +97,13 @@ dependencies {
|
|||
testClientBundleCompile( "org.osgi:org.osgi.core:4.3.1" )
|
||||
}
|
||||
|
||||
def pomName() {
|
||||
return 'Hibernate OSGi Support'
|
||||
}
|
||||
|
||||
def pomDescription() {
|
||||
return 'Support for running Hibernate O/RM in OSGi environments'
|
||||
mavenPom {
|
||||
name = 'Hibernate OSGi Support'
|
||||
description = 'Support for running Hibernate O/RM in OSGi environments'
|
||||
}
|
||||
|
||||
def osgiDescription() {
|
||||
return pomDescription()
|
||||
return mavenPom.description
|
||||
}
|
||||
|
||||
jar {
|
||||
|
|
|
@ -4,14 +4,11 @@ dependencies {
|
|||
testCompile project( ':hibernate-testing' )
|
||||
}
|
||||
|
||||
def pomName() {
|
||||
return 'Hibernate/Proxool Integration'
|
||||
}
|
||||
|
||||
def pomDescription() {
|
||||
return 'Integration for Proxool Connection pooling into Hibernate O/RM'
|
||||
mavenPom {
|
||||
name = 'Hibernate/Proxool Integration'
|
||||
description = 'Integration for Proxool Connection pooling into Hibernate O/RM'
|
||||
}
|
||||
|
||||
def osgiDescription() {
|
||||
return pomDescription()
|
||||
return mavenPom.description
|
||||
}
|
||||
|
|
|
@ -21,14 +21,11 @@ sourceSets.test.resources {
|
|||
// that will allow us to keep the same artifactId and publish the pom
|
||||
// with proper dependencies
|
||||
|
||||
def pomName() {
|
||||
return 'Hibernate ORM Testing'
|
||||
}
|
||||
|
||||
def pomDescription() {
|
||||
return 'Support for testing Hibernate ORM functionality'
|
||||
mavenPom {
|
||||
name = 'Hibernate ORM Testing'
|
||||
description = 'Support for testing Hibernate ORM functionality'
|
||||
}
|
||||
|
||||
def osgiDescription() {
|
||||
return pomDescription()
|
||||
return mavenPom.description
|
||||
}
|
||||
|
|
|
@ -9,3 +9,8 @@ dependencies {
|
|||
compile gradleApi()
|
||||
compile localGroovy()
|
||||
}
|
||||
|
||||
mavenPom {
|
||||
name = 'Hibernate Gradle plugin'
|
||||
description = "Gradle plugin for integrating Hibernate functionality into your build"
|
||||
}
|
|
@ -9,12 +9,9 @@ dependencies {
|
|||
testCompile libraries.slf4j_log4j
|
||||
}
|
||||
|
||||
def pomName() {
|
||||
return 'Hibernate JPA 2 Metamodel Generator'
|
||||
}
|
||||
|
||||
def pomDescription() {
|
||||
return 'Annotation Processor to generate JPA 2 static metamodel classes'
|
||||
mavenPom {
|
||||
name = 'Hibernate JPA 2 Metamodel Generator'
|
||||
description = 'Annotation Processor to generate JPA 2 static metamodel classes'
|
||||
}
|
||||
|
||||
versionInjection {
|
||||
|
|
Loading…
Reference in New Issue