From 6cc9f6242a1c51141e2522b421c0c49b377cca30 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 29 Jun 2016 15:48:20 -0500 Subject: [PATCH] HHH-10899 - Provide module ZIP file for upgrading WildFly to latest Hibernate --- build.gradle | 4 + documentation/documentation.gradle | 2 +- .../hibernate-orm-modules.gradle | 112 +++++++----------- 3 files changed, 49 insertions(+), 69 deletions(-) diff --git a/build.gradle b/build.gradle index 396d5ae2b2..c7aac0544e 100644 --- a/build.gradle +++ b/build.gradle @@ -98,6 +98,10 @@ subprojects { subProject -> return; } + if ( subProject.name.startsWith( 'hibernate-orm-modules' ) ) { + return; + } + // everything below here in the closure applies to java projects apply plugin: 'java' apply plugin: 'maven-publish' diff --git a/documentation/documentation.gradle b/documentation/documentation.gradle index 69e3d20e69..538b32b384 100644 --- a/documentation/documentation.gradle +++ b/documentation/documentation.gradle @@ -169,7 +169,7 @@ task aggregateJavadocs(type: Javadoc) { Set internalPackages = new HashSet() parent.subprojects.each{ Project subProject-> // skip certain sub-projects - if ( ['release','documentation'].contains( subProject.name ) ) { + if ( ['release','documentation', 'hibernate-orm-modules'].contains( subProject.name ) ) { return; } diff --git a/hibernate-orm-modules/hibernate-orm-modules.gradle b/hibernate-orm-modules/hibernate-orm-modules.gradle index c972edd289..cd0b73e253 100644 --- a/hibernate-orm-modules/hibernate-orm-modules.gradle +++ b/hibernate-orm-modules/hibernate-orm-modules.gradle @@ -4,8 +4,15 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -apply plugin: 'base' -apply plugin: 'maven' +apply plugin: 'java' +apply plugin: 'maven-publish' +apply plugin: 'maven-publish-auth' +apply plugin: 'build-dashboard' +apply plugin: 'project-report' +apply plugin: org.hibernate.build.HibernateBuildPlugin +apply plugin: 'idea' + +buildDir = "target" ext { // Exact ORM version, e.g. "5.1.1.Final" @@ -13,15 +20,18 @@ ext { // Just the minor ORM version, e.g. "5.1"; Is used as an alias for the exact version minorSlot = slot.substring( 0, slot.indexOf( ".", slot.indexOf( "." ) + 1) ) - majorWildflyVersion = wildflyVersion.substring( 0, wildflyVersion.indexOf( "." ) ) + artifactClassifier = "wildfly-${majorWildflyVersion}-dist" + + modulesXmlDir = "$buildDir/tmp/modules" - // directory for building the ZIP file from - modulesDirectory = "$buildDir/hibernate-orm-modules" } configurations { - jipijapa + jipijapa { + transitive = false + } + wildflyDist } @@ -38,16 +48,12 @@ dependencies { testCompile libraries.wildfly_arquillian_container_managed } -/*************************/ -/* Main */ -/*************************/ +task copyModulesXml(type: Copy) { + // NOTE : we do a separate Copy task for the modules XML files to apply token-replacements -// Copies all the module.xml descriptors into the output directory -task copyModuleXmls(type: Copy) { - into( modulesDirectory ) + into modulesXmlDir expand( slot: slot, minorSlot: minorSlot, version: rootProject.hibernateTargetVersion, wildflyVersion: wildflyVersion ) - // Actual module.xml files into( 'org/hibernate/' + slot ) { from 'src/main/modules/org/hibernate/core' } @@ -60,7 +66,7 @@ task copyModuleXmls(type: Copy) { from 'src/main/modules/org/hibernate/jipijapa-hibernate5' } - // Aliases + // create alias for the short name into( 'org/hibernate/' + minorSlot ) { from 'src/main/aliases/org/hibernate/core' } @@ -74,15 +80,15 @@ task copyModuleXmls(type: Copy) { } } -// Copies all the ORM JARs and the JipiJapa JAR into the output directory -task copyJars(dependsOn: copyModuleXmls, type: Copy) { - into( modulesDirectory ) +task createModulesZip(type: Zip, dependsOn: [copyModulesXml]) { + baseName = 'hibernate-orm-modules' + classifier = artifactClassifier + + from modulesXmlDir into( 'org/hibernate/' + slot ) { from parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files from parent.project( 'hibernate-envers' ).configurations.archives.allArtifacts.files - from parent.project( 'hibernate-entitymanager' ).configurations.archives.allArtifacts.files - from parent.project( 'hibernate-java8' ).configurations.archives.allArtifacts.files } into( 'org/hibernate/infinispan/' + slot ) { @@ -90,16 +96,28 @@ task copyJars(dependsOn: copyModuleXmls, type: Copy) { } into( 'org/hibernate/jipijapa-hibernate5/' + slot ) { - from configurations.jipijapa.copy().setTransitive( false ) + from configurations.jipijapa } } -// Creates a ZIP from the output directory -task createModulesZip(dependsOn: copyJars, type: Zip) { - classifier = "wildfly-${majorWildflyVersion}-dist" - from modulesDirectory +mavenPom { + name = "Hibernate ORM modules for WildFly ${majorWildflyVersion}" + description = "Hibernate ORM modules for WildFly ${majorWildflyVersion}" } +publishing { + publications { + mavenZip( MavenPublication ) { + artifact( createModulesZip ) { + classifier artifactClassifier + } + } + } +} + +build.dependsOn createModulesZip + + /*************************/ /* Testing */ /*************************/ @@ -119,51 +137,9 @@ task extractModules(dependsOn: [extractWildFly, createModulesZip], type: Copy) { into "$buildDir/wildfly-${wildflyVersion}/modules" } -// Replace properties in arquillian.xml; Actually this should be done by means of configuring -// the processTestResourcesTask itself, but while that works for resources in src/main/resources, -// the same failed for src/test/resources; I reckon it's a bug in Gradle -task filterArquillianXml(dependsOn: processTestResources, type: Copy) { - into( buildDir.getName() + '/resources/test' ) - expand( buildDir: buildDir.getName(), wildflyVersion: wildflyVersion ) - from 'src/test/resources' -} - test.dependsOn extractModules -test.dependsOn filterArquillianXml -build.dependsOn createModulesZip - -// Exclude JAR creation/publication inherited from parent -afterEvaluate { - tasks.withType(PublishToMavenLocal) { task -> - if (task.publication.name.equals( 'mavenJava') ) { - task.enabled = false - task.group = null - } - } - - tasks.withType(PublishToMavenRepository) { task -> - if (task.publication.name.equals( 'mavenJava') ) { - task.enabled = false - task.group = null - } - } - - tasks.withType(Jar) { task -> - task.enabled = false - task.group = null - } +processTestResources { + expand( buildDir: buildDir.getName(), wildflyVersion: wildflyVersion ) } -mavenPom { - name = "Hibernate ORM modules for WildFly ${majorWildflyVersion}" - description = "Hibernate ORM modules for WildFly ${majorWildflyVersion}" -} - -publishing { - publications { - mavenZip( MavenPublication ) { - artifact createModulesZip - } - } -}