From d806eff91282007e06df53cbb6f3f72dee721294 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 10 Jan 2018 15:06:58 -0600 Subject: [PATCH] HHH-12190 - General tidying of Gradle scripts --- build.gradle | 576 ++---------------- documentation/documentation.gradle | 73 +-- gradle/base-information.gradle | 35 ++ databases.gradle => gradle/databases.gradle | 0 gradle/java-module.gradle | 454 ++++++++++++++ libraries.gradle => gradle/libraries.gradle | 0 gradle/published-java-module.gradle | 117 ++++ gradle/publishing-repos.gradle | 25 + hibernate-c3p0/hibernate-c3p0.gradle | 46 +- hibernate-core/hibernate-core.gradle | 58 +- hibernate-ehcache/hibernate-ehcache.gradle | 40 +- .../hibernate-entitymanager.gradle | 23 +- hibernate-envers/hibernate-envers.gradle | 38 +- hibernate-hikaricp/hibernate-hikaricp.gradle | 39 +- .../hibernate-infinispan.gradle | 36 +- hibernate-java8/hibernate-java8.gradle | 27 +- hibernate-jcache/hibernate-jcache.gradle | 38 +- .../hibernate-orm-modules.gradle | 40 +- hibernate-osgi/hibernate-osgi.gradle | 40 +- hibernate-proxool/hibernate-proxool.gradle | 39 +- hibernate-spatial/hibernate-spatial.gradle | 35 +- hibernate-testing/hibernate-testing.gradle | 13 +- release/release.gradle | 143 +---- .../hibernate-enhance-maven-plugin.gradle | 11 +- .../hibernate-gradle-plugin.gradle | 10 +- .../hibernate-jpamodelgen.gradle | 48 +- 26 files changed, 841 insertions(+), 1163 deletions(-) create mode 100644 gradle/base-information.gradle rename databases.gradle => gradle/databases.gradle (100%) create mode 100644 gradle/java-module.gradle rename libraries.gradle => gradle/libraries.gradle (100%) create mode 100644 gradle/published-java-module.gradle create mode 100644 gradle/publishing-repos.gradle diff --git a/build.gradle b/build.gradle index d757729b0d..56fbff1768 100644 --- a/build.gradle +++ b/build.gradle @@ -10,13 +10,7 @@ import org.apache.tools.ant.filters.ReplaceTokens 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/" @@ -28,6 +22,7 @@ buildscript { classpath 'org.hibernate.build.gradle:version-injection-plugin:1.0.0' classpath 'org.hibernate.build.gradle:gradle-xjc-plugin:1.0.2.Final' classpath 'com.github.lburgazzoli:lb-karaf-features-gen:1.0.0-SNAPSHOT' + classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2' } } @@ -36,521 +31,50 @@ plugins { id 'me.champeau.buildscan-recipes' version '0.1.7' } -apply plugin: 'eclipse' -apply plugin: 'idea' -apply from: "./libraries.gradle" -apply from: "./databases.gradle" - allprojects { - repositories { - mavenCentral() - mavenLocal() - - maven { - name 'jboss-nexus' - url "http://repository.jboss.org/nexus/content/groups/public/" - } - maven { - name "jboss-snapshots" - url "http://snapshots.jboss.org/maven2/" - } - } + repositories { + mavenCentral() + maven { + name "jboss-snapshots" + url "http://snapshots.jboss.org/maven2/" + } + } // minimize changes, at least for now (gradle uses 'build' by default).. buildDir = "target" + + apply from: rootProject.file( 'gradle/base-information.gradle' ) } -ext { - hibernateTargetVersion = '5.3.0-SNAPSHOT' - expectedGradleVersion = '4.4' - baselineJavaVersion = '1.8' - osgiExportVersion = hibernateTargetVersion.replaceAll( '-SNAPSHOT', '.SNAPSHOT' ) +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Link together all release tasks - final String[] versionComponents = hibernateTargetVersion.split( '\\.' ); - hibernateFullVersion = hibernateTargetVersion - hibernateMajorMinorVersion = versionComponents[0] + '.' + versionComponents[1] - hibernateMajorVersion = versionComponents[0] +// relies on the fact that subprojects will appropriately define a release task +// themselves if they have any release-related activities to perform +task release { + doFirst { + println "Starting version $project.hibernateVersion release" + } } -idea { - project { - jdkName = baselineJavaVersion - languageLevel = baselineJavaVersion - - vcs = 'Git' - } - module { - name = "hibernate-orm" - } -} - -// Used in MANIFEST.MF for OSGi Bundles -def osgiDescription() { - return "A module of the Hibernate O/RM project" -} - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -subprojects { subProject -> - apply plugin: 'idea' - apply plugin: 'eclipse' - - defaultTasks 'build' - - if ( subProject.name.startsWith( 'hibernate-gradle-plugin' ) ) { - apply plugin: 'groovy' - } - - group = 'org.hibernate' - version = rootProject.hibernateTargetVersion - - ext.exportPackageVersion = rootProject.osgiExportVersion - - if ( subProject.name.startsWith( 'release' ) ) { - return - } - - if ( subProject.name.startsWith( 'hibernate-orm-modules' ) ) { - return - } - - // everything below here in the closure applies to modules with Java code - 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' - - apply from: "${rootProject.projectDir}/utilities.gradle" - - apply plugin: org.hibernate.build.HibernateBuildPlugin - - sourceCompatibility = rootProject.baselineJavaVersion - targetCompatibility = rootProject.baselineJavaVersion - - configurations { - provided { - // todo : need to make sure these are non-exported - description = 'Non-exported compile-time dependencies.' - } - jbossLoggingTool { - description = 'Dependencies for running the jboss-logging tooling.' - } - configurations { - all*.exclude group: 'xml-apis', module: 'xml-apis' - } - asciidoclet { - description = "Dependencies for Asciidoctor Javadoc taglet" - } - } - - // appropriately inject the common dependencies into each sub-project - dependencies { - compile libraries.logging - - provided libraries.logging_annotations - - jbossLoggingTool( libraries.logging_processor ) - - testCompile( libraries.junit ) - testCompile( libraries.byteman ) - testCompile( libraries.byteman_install ) - testCompile( libraries.byteman_bmunit ) - - testRuntime( libraries.log4j ) - testRuntime( libraries.javassist ) - testRuntime( libraries.byteBuddy ) - testRuntime( libraries.woodstox ) - - //Databases - testRuntime( libraries.h2 ) - testRuntime( libraries.hsqldb ) - testRuntime( libraries.postgresql ) - testRuntime( libraries.mysql ) - testRuntime( libraries.mariadb ) - testRuntime( libraries.mssql ) - testRuntime( libraries.informix ) - - asciidoclet 'org.asciidoctor:asciidoclet:1.+' - - if (db.equalsIgnoreCase("oracle")) { - dependencies { - testRuntime( libraries.oracle ) { - exclude group: 'com.oracle.jdbc', module: 'xmlparserv2' - } - } - } - if (db.equalsIgnoreCase("db2")) { - dependencies { - testRuntime( libraries.db2 ) - } - } - if (db.equalsIgnoreCase("hana")) { - dependencies { - testRuntime( libraries.hana ) - } - } - // 6.6 gave me some NPE problems from within checkstyle... - checkstyle 'com.puppycrawl.tools:checkstyle:6.5' - } - - // mac-specific stuff ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // should really use Jvm.current().toolsJar - ext.toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar") - if ( ext.toolsJar.exists() ) { - dependencies{ - testCompile files( toolsJar ) - } - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // compilation - compileJava.options.encoding = 'UTF-8' - - tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' - } - - task compile - compile.dependsOn compileJava, processResources, compileTestJava, processTestResources - - sourceSets.main { - compileClasspath += configurations.provided - compileClasspath += configurations.jbossLoggingTool - } - - 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 -> - if ( JavaVersion.current().isJava9Compatible() ) { - // Byteman needs this property to be set, https://developer.jboss.org/thread/274997 - task.jvmArgs += ["-Djdk.attach.allowAttachSelf=true"] - } - 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 +//gradle.projectsEvaluated { g -> +// g.rootProject.subprojects { subproject -> +// Task releaseTask = subproject.tasks.findByName( 'release' ) +// if ( releaseTask ) { +// releaseTask.dependsOn tasks.release +// tasks.release.dependsOn releaseTask // } -// task.afterTest { descriptor -> -// println "Completed test: " + descriptor -// } - } +// } +//} - /* - 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' - } - - processTestResources.doLast( { - copy { - from( sourceSets.test.java.srcDirs ) { - include '**/*.properties' - include '**/*.xml' - } - into sourceSets.test.output.classesDir - } - copy { - from file('src/test/resources') - into file( "${buildDir}/resources/test" ) - exclude 'src/test/resources/arquillian.xml' - exclude 'src/test/resources/hibernate.properties' - } - copy { - from file('src/test/resources/hibernate.properties') - into file( "${buildDir}/resources/test" ) - filter( ReplaceTokens, tokens: dbBundle[db] ) - } - } ) - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // artifact - - jar { - manifest = osgiManifest { - // GRADLE-1411: Even if we override Imports and Exports - // auto-generation with instructions, classesDir and classpath - // need to be here (temporarily). - - if ( subProject.name.startsWith( 'hibernate-gradle-plugin' ) ) { - classesDir = sourceSets.main.groovy.outputDir - } - else { - classesDir = sourceSets.main.output.classesDir - } - classpath = configurations.runtime - - - 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}" - - instruction 'Import-Package', - // 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 - instruction 'Specification-Title', name - instruction 'Specification-Version', version - instruction 'Specification-Vendor', 'Hibernate.org' - 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' - - } - } - - task sourcesJar(type: Jar, dependsOn: compileJava) { - from sourceSets.main.allSource - manifest = jar.manifest - classifier = 'sources' - } - - javadoc { - exclude( "**/internal/*" ) - exclude( "**/generated-src/**" ) - - final int currentYear = new GregorianCalendar().get( Calendar.YEAR ) - - configure( options ) { - docletpath = configurations.asciidoclet.files.asType(List) - doclet = 'org.asciidoctor.Asciidoclet' - - windowTitle = "$subProject.name JavaDocs" - docTitle = "$subProject.name JavaDocs ($project.version)" - bottom = "Copyright © 2001-$currentYear Red Hat, Inc. All Rights Reserved." - use = true - encoding = 'UTF-8' - links += [ - 'https://docs.oracle.com/javase/8/docs/api/', - 'http://docs.jboss.org/hibernate/beanvalidation/spec/2.0/api/', - 'http://docs.jboss.org/cdi/api/2.0/', - 'https://docs.oracle.com/javaee/7/api/' - ] - - if ( JavaVersion.current().isJava8Compatible() ) { - options.addStringOption( 'Xdoclint:none', '-quiet' ) - } - - doFirst { - // ordering problems if we try to do this during config phase :( - classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath + subProject.configurations.provided - } - } - } - - task javadocJar(type: Jar, dependsOn: javadoc) { - from tasks.javadoc.outputs - classifier = 'javadoc' - } - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // IDE options - idea { - module { - jdkName = subProject.sourceCompatibility - - 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" ) - - downloadSources = true - scopes.PROVIDED.plus += [configurations.provided] - } - } - - eclipse { - jdt { - sourceCompatibility = subProject.sourceCompatibility - targetCompatibility = subProject.targetCompatibility - } - 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 compile - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Report configs - checkstyle { - sourceSets = [ subProject.sourceSets.main ] - configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' ) - showViolations = false - } - // exclude generated java sources - by explicitly setting the base source dir - checkstyleMain.source = 'src/main/java' - - // define a second checkstyle task for checking non-fatal violations - task nonFatalCheckstyle(type:Checkstyle) { - source = subProject.sourceSets.main.java - classpath = subProject.configurations.checkstyle - showViolations = false - configFile = rootProject.file( 'shared/config/checkstyle/checkstyle-non-fatal.xml' ) - } - - if ( JavaVersion.current().isJava9Compatible() ) { - logger.warn( '[WARN] Disabling findbugs, it does not support JDK 9' ) - findbugs { - sourceSets = [] - } - } - 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' ) ) - } - - // 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' ) - } - } - } - // because cfg package is a mess mainly from annotation stuff - checkstyleMain.exclude '**/org/hibernate/cfg/**' - checkstyleMain.exclude '**/org/hibernate/cfg/*' - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Publishing - if ( !subProject.name.equals( 'documentation' ) && !subProject.name.equals( 'hibernate-infinispan' ) ) { - // do not configure publishing for the documentation module - publishing { - publications { - mavenJava(MavenPublication) { - from components.java - - artifact( sourcesJar ) { - classifier 'sources' - } - - artifact(javadocJar) { - classifier "javadoc" - } - } - // 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 - } - } - - model { - tasks.generatePomFileForMavenJavaPublication { - destination = file( "$subProject.buildDir/generated-pom.xml" ) - } - } - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -} - -task release(type: Task, dependsOn: 'release:release') task wrapper(type: Wrapper) { - gradleVersion = expectedGradleVersion + gradleVersion = '4.4' + distributionType = 'ALL' } + buildScan { licenseAgreementUrl = 'https://gradle.com/terms-of-service' licenseAgree = 'yes' @@ -560,18 +84,30 @@ buildScan { -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( ) -} + + + + + +//idea { +// project { +// jdkName = baselineJavaVersion +// languageLevel = baselineJavaVersion +// +// vcs = 'Git' +// } +// module { +// name = "hibernate-orm" +// } +//} + + + + +//allprojects { +// apply plugin: 'idea' +// apply plugin: 'eclipse' +//} + + + diff --git a/documentation/documentation.gradle b/documentation/documentation.gradle index 6c23cff9a0..0d8cd202cc 100644 --- a/documentation/documentation.gradle +++ b/documentation/documentation.gradle @@ -7,16 +7,25 @@ import org.asciidoctor.gradle.AsciidoctorTask * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2' - } + +ext { + projectsToSkipWhenAggregatingJavadocs = [ + 'documentation', + 'hibernate-entitymanager', + 'hibernate-infinispan', + 'hibernate-java8', + 'hibernate-orm-modules', + 'release' + ] +} +rootProject.subprojects { subproject -> + if ( !this.projectsToSkipWhenAggregatingJavadocs.contains( subproject.name ) ) { + this.evaluationDependsOn( subproject.path ) + } } -apply plugin: "java" +apply from: rootProject.file( 'gradle/java-module.gradle' ) + apply plugin: 'org.asciidoctor.convert' apply plugin: 'hibernate-matrix-testing' @@ -50,31 +59,6 @@ dependencies { testRuntime( libraries.mssql ) testCompile "org.osgi:org.osgi.core:4.3.1" - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - // The JDK used to run Gradle is Java 9+, and we assume that that is the same - // JDK for executing tasks - compile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - compile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - compile( 'javax:javaee-api:7.0' ) - - testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testCompile( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } @@ -103,8 +87,6 @@ final File javadocDir = mkdir( new File( (File) project.buildDir, 'javadocs' ) ) * Builds the JavaDocs aggregated (unified) across all the sub-projects */ task aggregateJavadocs(type: Javadoc) { - String[] projectsToSkip = ['release','documentation', 'hibernate-orm-modules'] - description = 'Builds the aggregated (unified) JavaDocs across all sub-projects' final int currentYear = new GregorianCalendar().get( Calendar.YEAR ) @@ -142,14 +124,12 @@ task aggregateJavadocs(type: Javadoc) { // 2) classpath parent.subprojects.each { Project subProject-> // skip certain sub-projects - if ( projectsToSkip.contains( subProject.name ) ) { - return + if ( ! projectsToSkipWhenAggregatingJavadocs.contains( subProject.name ) ) { + // we only care about the main SourceSet... + source subProject.sourceSets.main.java + + classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath + subProject.configurations.provided } - - // we only care about the main SourceSet... - source subProject.sourceSets.main.java - - classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath + subProject.configurations.provided } } @@ -167,7 +147,7 @@ task renderTopicalGuides(type: AsciidoctorTask, group: 'Documentation') { backends "html5" separateOutputDirs false options logDocuments: true - attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', majorMinorVersion: rootProject.hibernateMajorMinorVersion, fullVersion: rootProject.hibernateFullVersion + attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', majorMinorVersion: rootProject.hibernateMajorMinorVersion, fullVersion: rootProject.hibernateVersion } @@ -191,8 +171,8 @@ task buildTutorialZip(type: Zip) { expand( version: project.version, slf4j: "1.7.5", - junit: parent.junitVersion, - h2: parent.h2Version + junit: project.junitVersion, + h2: project.h2Version ) } @@ -233,7 +213,7 @@ task renderUserGuide(type: AsciidoctorTask, group: 'Documentation') { linkcss: true, stylesheet: "css/hibernate.css", majorMinorVersion: rootProject.hibernateMajorMinorVersion, - fullVersion: rootProject.hibernateFullVersion, + fullVersion: rootProject.hibernateVersion, docinfo: true resources { @@ -292,3 +272,4 @@ buildDocsForPublishing.dependsOn renderUserGuide buildDocsForPublishing.dependsOn renderIntegrationGuide checkstyleMain.exclude '**/org/hibernate/userguide/model/*' + diff --git a/gradle/base-information.gradle b/gradle/base-information.gradle new file mode 100644 index 0000000000..ea9f2e9ca2 --- /dev/null +++ b/gradle/base-information.gradle @@ -0,0 +1,35 @@ +/* + * 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 + */ +/* + * 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 + */ +/* + * 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 + */ + +apply plugin: 'base' + +ext { + hibernateVersion = '5.3.0-SNAPSHOT' + baselineJavaVersion = '1.8' + jpaVersion = '2.2' + + final String[] hibernateVersionComponents = project.hibernateVersion.split( '\\.' ) + hibernateMajorMinorVersion = hibernateVersionComponents[0] + '.' + hibernateVersionComponents[1] + hibernateMajorVersion = hibernateVersionComponents[0] + + isSnapshot = project.hibernateVersion.endsWith( "-SNAPSHOT" ) +} + +group = 'org.hibernate' +version = project.hibernateVersion \ No newline at end of file diff --git a/databases.gradle b/gradle/databases.gradle similarity index 100% rename from databases.gradle rename to gradle/databases.gradle diff --git a/gradle/java-module.gradle b/gradle/java-module.gradle new file mode 100644 index 0000000000..e2fe82de3a --- /dev/null +++ b/gradle/java-module.gradle @@ -0,0 +1,454 @@ +/* + * 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 + */ +/* + * 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 + */ +import org.apache.tools.ant.filters.ReplaceTokens + +/** + * Support for modules that contain Java code + */ + +apply from: rootProject.file( 'gradle/base-information.gradle' ) +apply from: rootProject.file( 'gradle/libraries.gradle' ) +apply from: rootProject.file( 'gradle/databases.gradle' ) + +apply plugin: 'java' +apply plugin: 'osgi' + +apply plugin: 'findbugs' +apply plugin: 'checkstyle' +apply plugin: 'build-dashboard' +apply plugin: 'project-report' + +ext { + java9ModuleNameBase = project.name.startsWith( 'hibernate-' ) ? name.drop( 'hibernate-'.length() ): name + java9ModuleName = "org.hibernate.orm.$project.java9ModuleNameBase" +} + + +sourceCompatibility = project.baselineJavaVersion +targetCompatibility = project.baselineJavaVersion + +afterEvaluate { + if ( !project.description ) { + project.description = "The Hibernate ORM $project.name module" + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Configurations and Dependencies + +configurations { + provided { + description = 'Non-exported compile-time dependencies.' + } + jbossLoggingTool { + description = 'Dependencies for running the jboss-logging tooling.' + } + asciidoclet { + description = "Dependencies for Asciidoctor Javadoc taglet" + } +} + +configurations.all*.exclude group: 'xml-apis', module: 'xml-apis' + + +dependencies { + compile libraries.logging + + provided libraries.logging_annotations + + jbossLoggingTool( libraries.logging_processor ) + + testCompile( libraries.junit ) + testCompile( libraries.byteman ) + testCompile( libraries.byteman_install ) + testCompile( libraries.byteman_bmunit ) + + testRuntime( libraries.log4j ) + testRuntime( libraries.javassist ) + testRuntime( libraries.byteBuddy ) + testRuntime( libraries.woodstox ) + + //Databases + testRuntime( libraries.h2 ) + testRuntime( libraries.hsqldb ) + testRuntime( libraries.postgresql ) + testRuntime( libraries.mysql ) + testRuntime( libraries.mariadb ) + testRuntime( libraries.mssql ) + testRuntime( libraries.informix ) + + asciidoclet 'org.asciidoctor:asciidoclet:1.+' + + if ( db.equalsIgnoreCase( 'oracle' ) ) { + testRuntime( libraries.oracle ) { + exclude group: 'com.oracle.jdbc', module: 'xmlparserv2' + } + } + else if ( db.equalsIgnoreCase( 'db2' ) ) { + testRuntime( libraries.db2 ) + } + else if ( db.equalsIgnoreCase( 'hana' ) ) { + testRuntime( libraries.hana ) + } + + + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Java 9 ftw! + if ( JavaVersion.current().isJava9Compatible() ) { + // The JDK used to run Gradle is Java 9+, and we assume that that is the same + // JDK for executing tasks + compile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) + compile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) + compile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) + compile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) + compile( 'javax:javaee-api:7.0' ) + + testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) + testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) + testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) + testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) + testCompile( 'javax:javaee-api:7.0' ) + + testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) + testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) + testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) + testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) + testRuntime( 'javax:javaee-api:7.0' ) + } + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + + // Mac-specific + project.ext.toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar") + if ( project.toolsJar.exists() ) { + testCompile files( project.toolsJar ) + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Compilation + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + +task compile(dependsOn: [compileJava, processResources, compileTestJava, processTestResources] ) + +sourceSets.main { + compileClasspath += configurations.provided + compileClasspath += configurations.jbossLoggingTool +} + +convention.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 = file( "${buildDir}/generated-src/apt/${sourceSet.name}" ) + sourceSet.allJava.srcDir( aptDir ) + + javaCompileTask.options.compilerArgs += [ + "-nowarn", + "-encoding", "UTF-8", + "-s", "${aptDir.absolutePath}" + ] + + javaCompileTask.doFirst { + aptDir.mkdirs() + } +} + + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// mac-specific stuff +final File toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar") +if ( ext.toolsJar.exists() ) { + dependencies{ + testCompile files( toolsJar ) + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Testing + +tasks.withType( Test.class ).all { task -> + if ( JavaVersion.current().isJava9Compatible() ) { + // Byteman needs this property to be set, https://developer.jboss.org/thread/274997 + task.jvmArgs += ["-Djdk.attach.allowAttachSelf=true"] + } + task.jvmArgs += [ + '-XX:+HeapDumpOnOutOfMemoryError', + "-XX:HeapDumpPath=${file( "${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." ) } +} + +processTestResources { + doLast { + copy { + from( sourceSets.test.java.srcDirs ) { + include '**/*.properties' + include '**/*.xml' + } + into sourceSets.test.output.classesDir + } + copy { + from file( 'src/test/resources' ) + into file( "${buildDir}/resources/test" ) + exclude 'src/test/resources/arquillian.xml' + exclude 'src/test/resources/hibernate.properties' + } + copy { + from file( 'src/test/resources/hibernate.properties' ) + into file( "${buildDir}/resources/test" ) + filter( ReplaceTokens, tokens: dbBundle[db] ) + } + } +} + + + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Packaging + +jar { + manifest = osgiManifest { + // GRADLE-1411: Even if we override Imports and Exports + // auto-generation with instructions, classesDir and classpath + // need to be here (temporarily). + + if ( project.pluginManager.hasPlugin( 'groovy' ) ) { + classesDir = sourceSets.main.groovy.outputDir + } + else { + classesDir = sourceSets.main.output.classesDir + } + classpath = configurations.runtime + + + // Java 9 module name + instruction 'Automatic-Module-Name', project.java9ModuleName + + // the OSGi metadata + symbolicName project.java9ModuleName + vendor 'Hibernate.org' + description project.description + docURL "http://www.hibernate.org/orm/${project.hibernateMajorMinorVersion}" + + instruction 'Import-Package', + // 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 + instruction 'Specification-Title', project.name + instruction 'Specification-Version', project.version + instruction 'Specification-Vendor', 'Hibernate.org' + instruction 'Implementation-Title', project.name + instruction 'Implementation-Version', project.version + instruction 'Implementation-Vendor', 'Hibernate.org' + instruction 'Implementation-Vendor-Id', 'org.hibernate' + instruction 'Implementation-Url', 'http://hibernate.org/orm' + + instruction 'Hibernate-VersionFamily', project.hibernateMajorMinorVersion + instruction 'Hibernate-JpaVersion', project.jpaVersion + } +} + + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Javadoc + +javadoc { + exclude( "**/internal/*" ) + exclude( "**/generated-src/**" ) + + final int currentYear = new GregorianCalendar().get( Calendar.YEAR ) + + configure( options ) { + docletpath = configurations.asciidoclet.files.asType(List) + doclet = 'org.asciidoctor.Asciidoclet' + + windowTitle = "$project.name JavaDocs" + docTitle = "$project.name JavaDocs ($project.version)" + bottom = "Copyright © 2001-$currentYear Red Hat, Inc. All Rights Reserved." + use = true + encoding = 'UTF-8' + links += [ + 'https://docs.oracle.com/javase/8/docs/api/', + 'http://docs.jboss.org/hibernate/beanvalidation/spec/2.0/api/', + 'http://docs.jboss.org/cdi/api/2.0/', + 'https://docs.oracle.com/javaee/7/api/' + ] + + if ( JavaVersion.current().isJava8Compatible() ) { + options.addStringOption( 'Xdoclint:none', '-quiet' ) + } + + doFirst { + // ordering problems if we try to do this during config phase :( + classpath += project.sourceSets.main.output + project.sourceSets.main.compileClasspath + project.configurations.provided + } + } +} + + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// IDE + + +//idea { +// module { +// jdkName = project.sourceCompatibility +// +// 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" ) +// +// downloadSources = true +// scopes.PROVIDED.plus += [configurations.provided] +// } +//} +// +/* + 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 { + doLast { + copy { + from "$buildDir/resources/test" + into 'out/test/resources' + } + } +} +// +// +// +//eclipse { +// jdt { +// sourceCompatibility = project.sourceCompatibility +// targetCompatibility = project.targetCompatibility +// } +// 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 compile + + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Report configs + +checkstyle { + sourceSets = [ project.sourceSets.main ] + configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' ) + showViolations = false +} +// exclude generated java sources - by explicitly setting the base source dir +checkstyleMain.source = 'src/main/java' + +// define a second checkstyle task for checking non-fatal violations +task nonFatalCheckstyle(type:Checkstyle) { + source = project.sourceSets.main.java + classpath = project.configurations.checkstyle + showViolations = false + configFile = rootProject.file( 'shared/config/checkstyle/checkstyle-non-fatal.xml' ) +} + +if ( JavaVersion.current().isJava9Compatible() ) { + logger.warn( '[WARN] Disabling findbugs, it does not support JDK 9' ) + findbugs { + sourceSets = [] + } +} +else { + findbugs { + sourceSets = [project.sourceSets.main, project.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' ) ) + } + + // 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' ) + } + } +} +// because cfg package is a mess mainly from annotation stuff +checkstyleMain.exclude '**/org/hibernate/cfg/**' +checkstyleMain.exclude '**/org/hibernate/cfg/*' + +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( ) +} diff --git a/libraries.gradle b/gradle/libraries.gradle similarity index 100% rename from libraries.gradle rename to gradle/libraries.gradle diff --git a/gradle/published-java-module.gradle b/gradle/published-java-module.gradle new file mode 100644 index 0000000000..d3c0ae85ce --- /dev/null +++ b/gradle/published-java-module.gradle @@ -0,0 +1,117 @@ +/* + * 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 + */ + +apply from: rootProject.file( 'gradle/java-module.gradle' ) +apply plugin: 'maven-publish' +apply plugin: 'maven-publish-auth' +apply from: rootProject.file( 'gradle/publishing-repos.gradle' ) + + +task sourcesJar(type: Jar) { + from project.sourceSets.main.allSource + manifest = project.tasks.jar.manifest + classifier = 'sources' +} + +task javadocJar(type: Jar) { + from project.tasks.javadoc.outputs + manifest = project.tasks.jar.manifest + classifier = 'javadoc' +} + +publishing { + publications { + publishedArtifacts( MavenPublication ) { + from components.java + + artifact( sourcesJar ) { + // todo : do these really need to be specified twice? + classifier 'sources' + } + + artifact( javadocJar ) { + // todo : do these really need to be specified twice? + classifier "javadoc" + } + } + } +} + +model { + tasks.generatePomFileForPublishedArtifactsPublication { + destination = file( "${buildDir}/generated-pom.xml" ) + } +} + +task generatePomFile( dependsOn: 'generatePomFileForPublishedArtifactsPublication' ) + +task release( dependsOn: publish ) { + doFirst { + println "Starting release for $project.name:$project.version" + } +} + +afterEvaluate { + + // delay pom customization until project evaluation is complete + + PublishingExtension gradlePublishingExtension = project.extensions.getByType( PublishingExtension ) + + Set mavenPublications = gradlePublishingExtension.publications.withType( MavenPublication ) + if ( mavenPublications.size() <= 0 || mavenPublications.size() > 1 ) { + throw new GradleException( "Expecting just a single MavenPublication [$project.path], but found " + mavenPublications.size() + " : " + mavenPublications*.name ) + } + + project.configure( mavenPublications.first() ) { + pom.withXml { + asNode().appendNode( 'name', "Hibernate ORM - $project.name" ) + asNode().appendNode( 'description', project.description ) + + Node lgplLicenseNode = asNode().appendNode( "licenses" ).appendNode( "license" ) + lgplLicenseNode.appendNode( 'name', 'GNU Lesser General Public License' ) + lgplLicenseNode.appendNode( 'url', 'http://www.gnu.org/licenses/lgpl-2.1.html' ) + lgplLicenseNode.appendNode( + 'comments', + 'See discussion at http://hibernate.org/license for more details.' + ) + lgplLicenseNode.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.size() > 0 ) { + asNode().dependencies[0].dependency.each { + it.scope[0].value = 'compile' + } + } + } + } +} \ No newline at end of file diff --git a/gradle/publishing-repos.gradle b/gradle/publishing-repos.gradle new file mode 100644 index 0000000000..86f29643ed --- /dev/null +++ b/gradle/publishing-repos.gradle @@ -0,0 +1,25 @@ +/* + * 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 + */ + +project.afterEvaluate { + publishing { + repositories { + if ( project.isSnapshot ) { + maven { + name 'jboss-snapshots-repository' + url 'https://repository.jboss.org/nexus/content/repositories/snapshots' + } + } + else { + maven { + name 'jboss-releases-repository' + url 'https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/' + } + } + } + } +} \ No newline at end of file diff --git a/hibernate-c3p0/hibernate-c3p0.gradle b/hibernate-c3p0/hibernate-c3p0.gradle index d3d9dac52e..557d2a290e 100644 --- a/hibernate-c3p0/hibernate-c3p0.gradle +++ b/hibernate-c3p0/hibernate-c3p0.gradle @@ -4,6 +4,11 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) + +description = 'Integration for c3p0 Connection pooling into Hibernate ORM' + dependencies { compile project( ':hibernate-core' ) compile( libraries.c3p0 ) @@ -17,45 +22,10 @@ dependencies { // EL libraries are provided scope in Validator testRuntime( libraries.expression_language ) - if (db.equalsIgnoreCase("oracle")) { - dependencies { - testRuntime( libraries.oracle ) { - exclude group: 'com.oracle.jdbc', module: 'xmlparserv2' - } + if ( db.equalsIgnoreCase( 'oracle' ) ) { + testRuntime( libraries.oracle ) { + exclude group: 'com.oracle.jdbc', module: 'xmlparserv2' } } - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - // The JDK used to run Gradle is Java 9+, and we assume that that is the same - // JDK for executing tasks - compile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - compile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - compile( 'javax:javaee-api:7.0' ) - - testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testCompile( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } -mavenPom { - name = 'Hibernate/c3p0 Integration' - description = 'Integration for c3p0 Connection pooling into Hibernate O/RM' -} - -def osgiDescription() { - return mavenPom.description -} diff --git a/hibernate-core/hibernate-core.gradle b/hibernate-core/hibernate-core.gradle index b10ceeb19d..6ce22457c6 100644 --- a/hibernate-core/hibernate-core.gradle +++ b/hibernate-core/hibernate-core.gradle @@ -1,16 +1,18 @@ -import org.apache.tools.ant.filters.ReplaceTokens - /* * 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 . */ +import org.apache.tools.ant.filters.ReplaceTokens + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) apply plugin: 'antlr' apply plugin: 'hibernate-matrix-testing' - apply plugin: 'org.hibernate.build.gradle.xjc' +description = 'Hibernate\'s core ORM functionality' + configurations { hibernateJpaModelGenTool { description = "Dependencies for running the Hibernate JPA Metamodel Generator AnnotationProcessor tool" @@ -37,31 +39,6 @@ dependencies { compile( libraries.dom4j ) compile( libraries.commons_annotations ) - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - // The JDK used to run Gradle is Java 9+, and we assume that that is the same - // JDK for executing tasks - xjc( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - xjc( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - xjc( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - xjc( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - xjc( 'javax:javaee-api:7.0' ) - - testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testCompile( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - antlr( libraries.antlr ) provided( libraries.jacc ) @@ -112,15 +89,6 @@ dependencies { testCompile libraries.jboss_annotation_spec_jar } -mavenPom { - name = 'Core Hibernate O/RM functionality' - description = 'The core O/RM functionality as provided by Hibernate' -} - -def osgiDescription() { - return mavenPom.description -} - jar { manifest { mainAttributes( 'Main-Class': 'org.hibernate.Version' ) @@ -173,11 +141,11 @@ sourceSets.test.resources { setSrcDirs( ['src/test/java','src/test/resources'] ) } -idea { - module { - sourceDirs += file( "${buildDir}/generated-src/antlr/main" ) - } -} +//idea { +// module { +// sourceDirs += file( "${buildDir}/generated-src/antlr/main" ) +// } +//} xjc { outputDir = jaxbTargetDir @@ -205,7 +173,7 @@ task copyBundleResources (type: Copy) { from file('src/test/bundles') into bundlesTargetDir ext.bundleTokens = dbBundle[db] - ext.bundleTokens["buildDirName"] = buildDir.absolutePath + ext.bundleTokens['buildDirName'] = buildDir.absolutePath filter( ReplaceTokens, tokens: bundleTokens); doFirst { bundlesTargetDir.mkdirs() @@ -236,10 +204,10 @@ processTestResources { } } -test.dependsOn ":hibernate-orm-modules:prepareWildFlyForTests" +test.dependsOn ':hibernate-orm-modules:prepareWildFlyForTests' test { - systemProperty "file.encoding", "utf-8" + systemProperty 'file.encoding', 'utf-8' beforeTest { descriptor -> //println "Starting test: " + descriptor } diff --git a/hibernate-ehcache/hibernate-ehcache.gradle b/hibernate-ehcache/hibernate-ehcache.gradle index f0a4a1e293..fc5325e8ae 100644 --- a/hibernate-ehcache/hibernate-ehcache.gradle +++ b/hibernate-ehcache/hibernate-ehcache.gradle @@ -4,46 +4,16 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) + +description = 'Integration for Ehcache into Hibernate as a second-level caching service' + dependencies { compile project( ':hibernate-core' ) compile( libraries.ehcache ) testCompile project( ':hibernate-testing' ) - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - // The JDK used to run Gradle is Java 9+, and we assume that that is the same - // JDK for executing tasks - provided( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - provided( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - provided( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - provided( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - provided( 'javax:javaee-api:7.0' ) - - testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testCompile( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -} - -mavenPom { - name = 'Hibernate/Ehcache Integration' - description = 'Integration for Ehcache into Hibernate as a second-level caching service' -} - -def osgiDescription() { - return mavenPom.description } test { diff --git a/hibernate-entitymanager/hibernate-entitymanager.gradle b/hibernate-entitymanager/hibernate-entitymanager.gradle index 4493fc9a44..689e6c320f 100644 --- a/hibernate-entitymanager/hibernate-entitymanager.gradle +++ b/hibernate-entitymanager/hibernate-entitymanager.gradle @@ -1,4 +1,8 @@ -// keep dependencies for transitivity to consumers + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) + +description = '(deprecated - use hibernate-core instead) Hibernate O/RM implementation of the JPA specification' + dependencies { compile( project( ':hibernate-core' ) ) compile( libraries.dom4j ) @@ -9,24 +13,19 @@ dependencies { compile( libraries.jta ) } -mavenPom { - name = '(deprecated - use hibernate-core instead) Hibernate JPA Support' - description = '(deprecated - use hibernate-core instead) Hibernate O/RM implementation of the JPA specification' -} -public String osgiDescription() { - return mavenPom.description -} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// The OSGi JAR manifest support does not like a non-existent classes dir, +// so make sure we dont use the OSGi one :) jar { - // The OSGi JAR manifest support does not like a non-existent classes dir, - // so make sure we dont use the OSGi one :) manifest = null } sourcesJar { - // The OSGi JAR manifest support does not like a non-existent classes dir, - // so make sure we dont use the OSGi one :) manifest = null } +javadocJar { + manifest = null +} diff --git a/hibernate-envers/hibernate-envers.gradle b/hibernate-envers/hibernate-envers.gradle index 85b9f48cb2..e29b0aa90b 100644 --- a/hibernate-envers/hibernate-envers.gradle +++ b/hibernate-envers/hibernate-envers.gradle @@ -4,8 +4,12 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) apply plugin: 'hibernate-matrix-testing' +description = 'Hibernate\'s entity version (audit/history) support' + dependencies { compile( project( ':hibernate-core' ) ) @@ -17,40 +21,6 @@ dependencies { testCompile( project( path: ':hibernate-core', configuration: 'tests' ) ) testRuntime( libraries.javassist ) testRuntime( libraries.byteBuddy ) - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - // The JDK used to run Gradle is Java 9+, and we assume that that is the same - // JDK for executing tasks - provided( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - provided( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - provided( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - provided( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - provided( 'javax:javaee-api:7.0' ) - - testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testCompile( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -} - -mavenPom { - name = 'ENtity VERSioning support' - description = 'ENtity VERSioning support' -} - -def osgiDescription() { - return mavenPom.description } sourceSets { diff --git a/hibernate-hikaricp/hibernate-hikaricp.gradle b/hibernate-hikaricp/hibernate-hikaricp.gradle index 2cb26c7503..2e50358860 100644 --- a/hibernate-hikaricp/hibernate-hikaricp.gradle +++ b/hibernate-hikaricp/hibernate-hikaricp.gradle @@ -4,43 +4,14 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) + +description = 'Integration for HikariCP into Hibernate O/RM' + dependencies { compile project( ':hibernate-core' ) compile( libraries.hikaricp ) testCompile project( ':hibernate-testing' ) testCompile(libraries.mockito) - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - // The JDK used to run Gradle is Java 9+, and we assume that that is the same - // JDK for executing tasks - compile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - compile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - compile( 'javax:javaee-api:7.0' ) - - testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testCompile( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -} - -mavenPom { - name = 'Hibernate/HikariCP Integration' - description = 'Integration for HikariCP into Hibernate O/RM' -} - -def osgiDescription() { - return mavenPom.description } diff --git a/hibernate-infinispan/hibernate-infinispan.gradle b/hibernate-infinispan/hibernate-infinispan.gradle index 6c3345c244..3ca47b2f9e 100644 --- a/hibernate-infinispan/hibernate-infinispan.gradle +++ b/hibernate-infinispan/hibernate-infinispan.gradle @@ -5,33 +5,33 @@ * See the lgpl.txt file in the root directory or . */ -mavenPom { - name = '(deprecated - use org.infinispan:infinispan-hibernate-cache instead)' - description = '(deprecated - use org.infinispan:infinispan-hibernate-cache instead)' +apply from: rootProject.file( 'gradle/base-information.gradle' ) +apply from: rootProject.file( 'gradle/publishing-repos.gradle' ) +apply plugin: 'maven-publish' +apply plugin: 'maven-publish-auth' + +description = '(deprecated - use org.infinispan:infinispan-hibernate-cache instead)' + +ext { + relocatedGroupId = 'org.infinispan' + relocatedArtifactId = 'infinispan-hibernate-cache' + relocatedVersion = '9.1.3.Final' } -jar.enabled = false -sourcesJar.enabled = false -javadoc.enabled = false -javadocJar.enabled = false - -def relocatedGroupId = 'org.infinispan' -def relocatedArtifactId = 'infinispan-hibernate-cache' -def relocatedVersion = '9.1.3.Final' - publishing { publications { relocationPom( MavenPublication ) { - groupId 'org.hibernate' - artifactId 'hibernate-infinispan' - +// groupId 'org.hibernate' +// artifactId 'hibernate-infinispan' +// pom.withXml { def relocation = asNode().appendNode( 'distributionManagement' ).appendNode( 'relocation' ) - relocation.appendNode( 'groupId', relocatedGroupId) - relocation.appendNode( 'artifactId', relocatedArtifactId ) - relocation.appendNode( 'version', relocatedVersion ) + relocation.appendNode( 'groupId', project.relocatedGroupId) + relocation.appendNode( 'artifactId', project.relocatedArtifactId ) + relocation.appendNode( 'version', project.relocatedVersion ) } } } } +task release( dependsOn: publish ) \ No newline at end of file diff --git a/hibernate-java8/hibernate-java8.gradle b/hibernate-java8/hibernate-java8.gradle index 5eb18227bf..784184e95a 100644 --- a/hibernate-java8/hibernate-java8.gradle +++ b/hibernate-java8/hibernate-java8.gradle @@ -1,24 +1,23 @@ + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) + +description = '(deprecated - use hibernate-core instead) Support for Java8-specific features - mainly Java8 Date/Time (JSR 310)' + dependencies { compile( project( ':hibernate-core' ) ) } - -mavenPom { - name = '(deprecated - use hibernate-core instead) Java8-specific Hibernate O/RM functionality' - description = '(deprecated - use hibernate-core instead) Support for Java8-specific features - mainly Java8 Date/Time (JSR 310)' -} - -public String osgiDescription() { - return mavenPom.description -} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// The OSGi JAR manifest support does not like a non-existent classes dir, +// so make sure we dont use the OSGi one :) jar { - // The OSGi JAR manifest support does not like a non-existent classes dir, - // so make sure we dont use the OSGi one :) manifest = null } sourcesJar { - // The OSGi JAR manifest support does not like a non-existent classes dir, - // so make sure we dont use the OSGi one :) manifest = null -} \ No newline at end of file +} + +javadocJar { + manifest = null +} diff --git a/hibernate-jcache/hibernate-jcache.gradle b/hibernate-jcache/hibernate-jcache.gradle index c6bfc9bd6b..61f3101d4c 100644 --- a/hibernate-jcache/hibernate-jcache.gradle +++ b/hibernate-jcache/hibernate-jcache.gradle @@ -1,3 +1,7 @@ +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) + +description = 'Integration for javax.cache into Hibernate as a second-level caching service' + dependencies { compile project( ':hibernate-core' ) compile( libraries.jcache ) @@ -6,38 +10,4 @@ dependencies { testCompile( libraries.mockito ) testCompile( libraries.mockito_inline ) testRuntime( libraries.ehcache3 ) - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - // The JDK used to run Gradle is Java 9+, and we assume that that is the same - // JDK for executing tasks - compile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - compile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - compile( 'javax:javaee-api:7.0' ) - - testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testCompile( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -} - -mavenPom { - name = 'Hibernate/JCache Integration' - description = 'Integration for javax.cache into Hibernate as a second-level caching service' -} - -def osgiDescription() { - return pomDescription() } diff --git a/hibernate-orm-modules/hibernate-orm-modules.gradle b/hibernate-orm-modules/hibernate-orm-modules.gradle index 478bfddc5e..b642aa911a 100644 --- a/hibernate-orm-modules/hibernate-orm-modules.gradle +++ b/hibernate-orm-modules/hibernate-orm-modules.gradle @@ -4,6 +4,9 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ + +apply from: rootProject.file( 'gradle/java-module.gradle' ) + apply plugin: 'java' apply plugin: 'maven-publish' apply plugin: 'maven-publish-auth' @@ -12,16 +15,17 @@ apply plugin: 'project-report' apply plugin: org.hibernate.build.HibernateBuildPlugin apply plugin: 'idea' + ext { // NOTE : `wildflyVersion` comes from libraries.gradle... // Exact ORM version, e.g. "5.1.1.Final" - slot = rootProject.hibernateFullVersion + slot = rootProject.hibernateVersion // Just the minor ORM version, e.g. "5.1"; Is used as an alias for the exact version minorSlot = rootProject.hibernateMajorMinorVersion // "10" for WildFly 10.x, "11" for 11.x, etc - wildFlyMajorVersion = wildflyVersion.split( '\\.' )[0] + wildFlyMajorVersion = project.wildflyVersion.split( '\\.' )[0] wildFlyJPA22PatchVersion = '1.0.0.Beta1' artifactClassifier = "wildfly-${wildFlyMajorVersion}-dist" @@ -36,16 +40,13 @@ ext { expandedModuleProperties = [ slot: slot, minorSlot: minorSlot, - version: rootProject.hibernateTargetVersion, + version: project.hibernateVersion, wildflyVersion: wildflyVersion, byteBuddyVersion: byteBuddyVersion ] } -mavenPom { - name = "Hibernate ORM modules for WildFly ${wildFlyMajorVersion}" - description = "Hibernate ORM modules for WildFly ${wildFlyMajorVersion}" -} +description = "Hibernate ORM modules for WildFly ${wildFlyMajorVersion}" configurations { jipijapa { @@ -71,29 +72,6 @@ dependencies { testCompile libraries.shrinkwrap_descriptors_api_javaee testCompile libraries.shrinkwrap_descriptors_impl_javaee testCompile libraries.wildfly_arquillian_container_managed - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - compile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - compile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - compile( 'javax:javaee-api:7.0' ) - - testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testCompile( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } @@ -166,7 +144,7 @@ publishing { } } -build.dependsOn createModulesZip +task release( dependsOn: createModulesZip ) diff --git a/hibernate-osgi/hibernate-osgi.gradle b/hibernate-osgi/hibernate-osgi.gradle index 7b20afc8b1..d38d56de36 100644 --- a/hibernate-osgi/hibernate-osgi.gradle +++ b/hibernate-osgi/hibernate-osgi.gradle @@ -4,8 +4,12 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) apply plugin: 'karaf-featuresgen' +description = 'Support for running Hibernate O/RM in OSGi environments' + sourceSets { test { // send javac output and resource copying to the same output directory for test @@ -70,40 +74,6 @@ dependencies { } karafDistro "org.apache.karaf:apache-karaf:${karafVersion}@tar.gz" - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - // The JDK used to run Gradle is Java 9+, and we assume that that is the same - // JDK for executing tasks - compile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - compile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - compile( 'javax:javaee-api:7.0' ) - - testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testCompile( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -} - -mavenPom { - name = 'Hibernate OSGi Support' - description = 'Support for running Hibernate O/RM in OSGi environments' -} - -def osgiDescription() { - return mavenPom.description } jar { @@ -408,7 +378,7 @@ tasks.test.dependsOn tasks.publishToMavenLocal publishing { publications { - mavenJava( MavenPublication ) { + publishedArtifacts( MavenPublication ) { artifact( project.extensions.karafFeatures.featuresXmlFile ) { classifier 'karaf' builtBy generateKarafFeatures diff --git a/hibernate-proxool/hibernate-proxool.gradle b/hibernate-proxool/hibernate-proxool.gradle index 0d99fe30b5..b97137ea69 100644 --- a/hibernate-proxool/hibernate-proxool.gradle +++ b/hibernate-proxool/hibernate-proxool.gradle @@ -4,42 +4,13 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) + +description = 'Integration for Proxool Connection pooling into Hibernate O/RM' + dependencies { compile project( ':hibernate-core' ) compile( libraries.proxool ) testCompile project( ':hibernate-testing' ) - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - // The JDK used to run Gradle is Java 9+, and we assume that that is the same - // JDK for executing tasks - compile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - compile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - compile( 'javax:javaee-api:7.0' ) - - testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testCompile( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -} - -mavenPom { - name = 'Hibernate/Proxool Integration' - description = 'Integration for Proxool Connection pooling into Hibernate O/RM' -} - -def osgiDescription() { - return mavenPom.description } diff --git a/hibernate-spatial/hibernate-spatial.gradle b/hibernate-spatial/hibernate-spatial.gradle index f786a366e7..3b5cb4eefd 100644 --- a/hibernate-spatial/hibernate-spatial.gradle +++ b/hibernate-spatial/hibernate-spatial.gradle @@ -4,13 +4,11 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -apply plugin: 'java' + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) apply plugin: 'hibernate-matrix-testing' -mavenPom { - name = 'Integrate support for Spatial/GIS data into Hibernate O/RM' - description = 'Integrate support for Spatial/GIS data into Hibernate O/RM' -} +description = 'Integrate support for Spatial/GIS data into Hibernate O/RM' dependencies { compile(project(':hibernate-core')) @@ -23,7 +21,6 @@ dependencies { } - testCompile(libraries.junit) testCompile(project(':hibernate-testing')) testCompile([group: 'commons-dbcp', name: 'commons-dbcp', version: '1.4']) @@ -40,32 +37,6 @@ dependencies { testRuntime('jaxen:jaxen:1.1') testRuntime(libraries.javassist) testRuntime(libraries.byteBuddy) - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - // The JDK used to run Gradle is Java 9+, and we assume that that is the same - // JDK for executing tasks - compile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - compile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - compile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - compile( 'javax:javaee-api:7.0' ) - - testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testCompile( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } sourceSets.test.resources { diff --git a/hibernate-testing/hibernate-testing.gradle b/hibernate-testing/hibernate-testing.gradle index 9496237a71..ed371b88fd 100644 --- a/hibernate-testing/hibernate-testing.gradle +++ b/hibernate-testing/hibernate-testing.gradle @@ -4,6 +4,11 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) + +description = 'Support for testing Hibernate ORM functionality' + dependencies { compile project( ':hibernate-core' ) compile( libraries.jta ) @@ -28,11 +33,3 @@ sourceSets.test.resources { // that will allow us to keep the same artifactId and publish the pom // with proper dependencies -mavenPom { - name = 'Hibernate ORM Testing' - description = 'Support for testing Hibernate ORM functionality' -} - -def osgiDescription() { - return mavenPom.description -} diff --git a/release/release.gradle b/release/release.gradle index 112c92c75f..706f611a7a 100644 --- a/release/release.gradle +++ b/release/release.gradle @@ -4,16 +4,11 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -plugins { - id "com.jfrog.bintray" version "1.7" -} +apply from: rootProject.file( 'gradle/base-information.gradle' ) -apply plugin: 'base' apply plugin: 'idea' apply plugin: 'distribution' -buildDir = "target" - idea.module { } @@ -150,8 +145,8 @@ distributions { // todo : this closure is problematic as it does not write into the hibernate-release-$project.version directory // due to http://issues.gradle.org/browse/GRADLE-1450 - [ 'hibernate-c3p0', 'hibernate-proxool', 'hibernate-ehcache', 'hibernate-infinispan' ].each { feature -> - final String shortName = feature.substring( 'hibernate-'.length() ); + [ 'hibernate-c3p0', 'hibernate-proxool', 'hibernate-ehcache' ].each { feature -> + final String shortName = feature.substring( 'hibernate-'.length() ) // WORKAROUND http://issues.gradle.org/browse/GRADLE-1450 // into('lib/optional/' + shortName) { owner.into('lib/optional/' + shortName) { @@ -244,135 +239,5 @@ artifacts { bundles distZip } -String binTrayUser = null -String binTrayApiKey = null +task release( dependsOn: uploadBundlesSourceForge ) -if ( project.hasProperty( "BINTRAY_USER" ) ) { - binTrayUser = project.property( "BINTRAY_USER" ) as String; -} -if ( binTrayUser == null ) { - binTrayUser = System.getProperty( "BINTRAY_USER" ); -} -if ( binTrayUser == null ) { - binTrayUser = System.getenv( "BINTRAY_USER" ); -} -if ( binTrayUser == null ) { - binTrayUser = 'UNDEFINED' -} - -if ( project.hasProperty( "BINTRAY_APIKEY" ) ) { - binTrayApiKey = project.property( "BINTRAY_APIKEY" ) as String; -} -if ( binTrayApiKey == null ) { - binTrayApiKey = System.getProperty( "BINTRAY_APIKEY" ); -} -if ( binTrayApiKey == null ) { - binTrayApiKey = System.getenv( "BINTRAY_APIKEY" ); -} -if ( binTrayApiKey == null ) { - binTrayApiKey = 'UNDEFINED' -} - -bintray { - user = binTrayUser - key = binTrayApiKey - - publish = true - - configurations = ['bundles'] - - pkg { - userOrg = 'hibernate' - repo = 'bundles' - name = 'hibernate-orm' - - version { - name = project.version - desc = "The ${project.version} release of the Hibernate ORM project" - - gpg { - sign = true - passphrase = 'hibernate' - } - } - } -} - -bintrayUpload.dependsOn buildBundles - -bintrayUpload { - doFirst { - if ( version.endsWith( "SNAPSHOT" ) ) { - logger.error( "Cannot perform upload of SNAPSHOT bundles to BinTray" ); - throw new RuntimeException( "Cannot perform upload of SNAPSHOT bundles to BinTray" ) - } - else { - logger.lifecycle( "Uploading release bundles to BinTray..." ) - } - } -} - -task uploadBundles(dependsOn: [bintrayUpload, uploadBundlesSourceForge]) { - description = 'Performs all release bundle uploads' -} - - -// Full release related tasks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -task cleanAllSubProjects(type: Task) { - description = 'Performs clean on all sub-projects' -} - -task testAllSubProjects(type: Task) { - description = 'Performs test on all sub-projects' -} - -task publishAllSubProjects(type: Task) { - description = 'Performs publish on all sub-projects' -} - -task buildAllSubProjects(type: Task, dependsOn: [testAllSubProjects,publishAllSubProjects]) - -task uploadReleaseArtifacts(type: Task, dependsOn: [uploadDocumentation, uploadBundles]) - -task announce(type: Task) { doFirst { println 'Hear ye, hear ye...' } } - -task release(type: Task, dependsOn: [buildAllSubProjects, uploadReleaseArtifacts, announce]) { - description = "Coordinates all release tasks; does not perform a clean first (see cleanAndRelease task)" -} - -task cleanAndRelease(type: Task, dependsOn: [cleanAllSubProjects, release]) { - description = "Coordinates all release tasks *including clean*" -} - - -// must-run-afters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -buildAllSubProjects.mustRunAfter cleanAllSubProjects - -publishAllSubProjects.mustRunAfter testAllSubProjects -publishAllSubProjects.mustRunAfter cleanAllSubProjects - -uploadReleaseArtifacts.mustRunAfter buildAllSubProjects - -announce.mustRunAfter uploadReleaseArtifacts - - -// sub-project task dependencies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -rootProject.subprojects { Project subproject -> - final Task subprojectCleanTask = subproject.tasks.findByPath( 'clean' ); - if ( subprojectCleanTask != null ) { - cleanAllSubProjects.dependsOn subprojectCleanTask - } - - final Task subprojectTestTask = subproject.tasks.findByPath( 'test' ); - if ( subprojectTestTask != null ) { - testAllSubProjects.dependsOn subprojectTestTask - } - - final Task subprojectPublishTask = subproject.tasks.findByPath( 'publish' ); - if ( subprojectPublishTask != null ) { - publishAllSubProjects.dependsOn subprojectPublishTask - } -} diff --git a/tooling/hibernate-enhance-maven-plugin/hibernate-enhance-maven-plugin.gradle b/tooling/hibernate-enhance-maven-plugin/hibernate-enhance-maven-plugin.gradle index 98e6896743..a033c167b7 100644 --- a/tooling/hibernate-enhance-maven-plugin/hibernate-enhance-maven-plugin.gradle +++ b/tooling/hibernate-enhance-maven-plugin/hibernate-enhance-maven-plugin.gradle @@ -4,16 +4,13 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -apply plugin: 'java' +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) apply plugin: 'maven' import org.apache.tools.ant.filters.ReplaceTokens group = 'org.hibernate.orm.tooling' - -repositories { - mavenCentral() -} +description = 'Enhance Plugin of the Hibernate project for use with Maven build system.' processResources { include "**/lifecycle-mapping-metadata.xml" @@ -117,7 +114,3 @@ processResources.doLast { processResources.dependsOn processPluginXml -mavenPom { - name = 'Enhance Plugin of the Hibernate project for use with Maven build system.' - description = 'Enhance Plugin of the Hibernate project for use with Maven build system.' -} diff --git a/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle b/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle index efecfc843b..76c2dceb9a 100644 --- a/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle +++ b/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle @@ -4,10 +4,13 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) +apply plugin: 'groovy' apply plugin: 'java-gradle-plugin' - apply plugin: 'maven' +description = "Gradle plugin for integrating Hibernate functionality into your build" + dependencies { compile( project( ':hibernate-core' ) ) compile( libraries.jpa ) @@ -16,8 +19,3 @@ dependencies { compile gradleApi() compile localGroovy() } - -mavenPom { - name = 'Hibernate Gradle plugin' - description = "Gradle plugin for integrating Hibernate functionality into your build" -} \ No newline at end of file diff --git a/tooling/metamodel-generator/hibernate-jpamodelgen.gradle b/tooling/metamodel-generator/hibernate-jpamodelgen.gradle index 0556ea10ed..e1cf99a035 100644 --- a/tooling/metamodel-generator/hibernate-jpamodelgen.gradle +++ b/tooling/metamodel-generator/hibernate-jpamodelgen.gradle @@ -4,46 +4,24 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ + +apply from: rootProject.file( 'gradle/published-java-module.gradle' ) apply plugin: 'version-injection' apply plugin: 'org.hibernate.build.gradle.xjc' +description = 'Annotation Processor to generate JPA 2 static metamodel classes' + +ext { + xjcTargetDir = file( "${buildDir}/generated-src/xjc/main" ) + xsdDir = file( "${projectDir}/src/main/xsd" ) +} + dependencies { testCompile libraries.junit testCompile libraries.jpa testCompile project( ':hibernate-core' ) } -mavenPom { - name = 'Hibernate JPA 2 Metamodel Generator' - description = 'Annotation Processor to generate JPA 2 static metamodel classes' -} - -dependencies { - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Java 9 ftw! - if ( JavaVersion.current().isJava9Compatible() ) { - // The JDK used to run Gradle is Java 9+, and we assume that that is the same - // JDK for executing tasks - xjc( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - xjc( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - xjc( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - xjc( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - xjc( 'javax:javaee-api:7.0' ) - - testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' ) - testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' ) - testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' ) - testRuntime( 'javax:javaee-api:7.0' ) - } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -} - -ext { - xjcTargetDir = file( "${buildDir}/generated-src/xjc/main" ) - xsdDir = file( "${projectDir}/src/main/xsd" ) -} - sourceSets.main { java.srcDir xjcTargetDir resources.srcDir xsdDir @@ -55,14 +33,6 @@ compileTestJava { ] } -jar { - manifest { - attributes 'Implementation-Title' : name, - 'Implementation-Version' : version, - 'Specification-Title' : name, - 'Specification-Version' : version - } -} task jaxb { // configure Gradle up-to-date checking