diff --git a/build.gradle b/build.gradle index a19764d643..99759d84d5 100644 --- a/build.gradle +++ b/build.gradle @@ -59,6 +59,11 @@ ext { baselineJavaVersion = '1.8' osgiExportVersion = hibernateTargetVersion.replaceAll( '-SNAPSHOT', '.SNAPSHOT' ) + + final String[] versionComponents = hibernateTargetVersion.split( '\\.' ); + hibernateFullVersion = hibernateTargetVersion + hibernateMajorMinorVersion = versionComponents[0] + '.' + versionComponents[1] + hibernateMajorVersion = versionComponents[0] } idea { diff --git a/documentation/documentation.gradle b/documentation/documentation.gradle index a90897c8e1..1c13394c5f 100644 --- a/documentation/documentation.gradle +++ b/documentation/documentation.gradle @@ -290,9 +290,6 @@ task renderMappingGuide(type: AsciidoctorTask, group: 'Documentation') { } } -final String[] versionComponents = version.split( '\\.' ); -final String majorMinorVersion = versionComponents[0] + '.' + versionComponents[1]; - // User Guide ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ task renderUserGuide(type: AsciidoctorTask, group: 'Documentation') { @@ -302,7 +299,7 @@ task renderUserGuide(type: AsciidoctorTask, group: 'Documentation') { backends "html5" separateOutputDirs false options logDocuments: true - attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css", majorMinorVersion: majorMinorVersion + attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css", majorMinorVersion: rootProject.hibernateMajorMinorVersion resources { from('src/main/asciidoc/userguide/') { include 'images/**' @@ -325,7 +322,7 @@ task renderIntegrationGuide(type: AsciidoctorTask, group: 'Documentation') { backends "html5" separateOutputDirs false options logDocuments: true - attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css", majorMinorVersion: majorMinorVersion + attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css", majorMinorVersion: rootProject.hibernateMajorMinorVersion resources { from('src/main/asciidoc/integrationguide/') { include 'images/**' diff --git a/hibernate-orm-modules/hibernate-orm-modules.gradle b/hibernate-orm-modules/hibernate-orm-modules.gradle index b26e3880af..a21b0043c6 100644 --- a/hibernate-orm-modules/hibernate-orm-modules.gradle +++ b/hibernate-orm-modules/hibernate-orm-modules.gradle @@ -16,15 +16,25 @@ buildDir = "target" ext { // Exact ORM version, e.g. "5.1.1.Final" - slot = rootProject.hibernateTargetVersion - + slot = rootProject.hibernateFullVersion // 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" + minorSlot = rootProject.hibernateMajorMinorVersion - modulesXmlDir = "$buildDir/tmp/modules" + final String[] wildFlyVersionComponents = wildflyVersion.split( '\\.' ); + // e.g. "10" for WildFly 10.x + wildFlyMajorVersion = wildFlyVersionComponents[0]; + + artifactClassifier = "wildfly-${wildFlyMajorVersion}-dist" + + moduleXmlStagingDir = file( "$buildDir/tmp/modules" ) + + wildFlyInstallDir = file( "${rootProject.buildDir}/" ) +} + +mavenPom { + name = "Hibernate ORM modules for WildFly ${wildFlyMajorVersion}" + description = "Hibernate ORM modules for WildFly ${wildFlyMajorVersion}" } configurations { @@ -48,10 +58,14 @@ dependencies { testCompile libraries.wildfly_arquillian_container_managed } -task copyModulesXml(type: Copy) { - // NOTE : we do a separate Copy task for the modules XML files to apply token-replacements - into modulesXmlDir +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// tasks related to creating and publishing the module zip + +task copyAndExpandModuleXml(type: Copy) { + description 'Performs a copy of the XML files defining the module into a staging directory for the purpose of performing token-replacement' + + into moduleXmlStagingDir expand( slot: slot, minorSlot: minorSlot, version: rootProject.hibernateTargetVersion, wildflyVersion: wildflyVersion ) into( 'org/hibernate/' + slot ) { @@ -80,11 +94,11 @@ task copyModulesXml(type: Copy) { } } -task createModulesZip(type: Zip, dependsOn: [copyModulesXml]) { - baseName = 'hibernate-orm-modules' - classifier = artifactClassifier +task createModulesZip(type: Zip, dependsOn: [copyAndExpandModuleXml]) { + baseName 'hibernate-orm-modules' + classifier artifactClassifier - from modulesXmlDir + from moduleXmlStagingDir into( 'org/hibernate/' + slot ) { from parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files @@ -100,11 +114,6 @@ task createModulesZip(type: Zip, dependsOn: [copyModulesXml]) { } } -mavenPom { - name = "Hibernate ORM modules for WildFly ${majorWildflyVersion}" - description = "Hibernate ORM modules for WildFly ${majorWildflyVersion}" -} - publishing { publications { mavenZip( MavenPublication ) { @@ -118,9 +127,9 @@ publishing { build.dependsOn createModulesZip -/*************************/ -/* Testing */ -/*************************/ + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// tasks related to in-container (Arquillian + WF) testing if ( JavaVersion.current().isJava9Compatible() ) { logger.lifecycle( "WARNING - Skipping hibernate-orm-modules tests for Java 9" ) @@ -128,28 +137,27 @@ if ( JavaVersion.current().isJava9Compatible() ) { test.enabled = false } -test { - systemProperties['jboss.socket.binding.port-offset'] = 137 -} +task installWildFly(type: Copy) { + description = 'Downloads the WildFly distribution and installs it into a local directory (if needed)' -// Unzip Wildfly Dist -task extractWildFly(type: Copy) { from { configurations.wildflyDist.collect { zipTree(it) } } - into "$buildDir/" + into wildFlyInstallDir } -// Unzip Hibernate ORM Modules ZIP into the server's "modules" dir -task extractModules(dependsOn: [extractWildFly, createModulesZip], type: Copy) { +task installHibernateModule( type:Copy, dependsOn: [createModulesZip, installWildFly]) { duplicatesStrategy DuplicatesStrategy.EXCLUDE from zipTree( createModulesZip.archivePath ) - into "$buildDir/wildfly-${wildflyVersion}/modules" + into "${wildFlyInstallDir}/wildfly-${wildflyVersion}/modules" } -test.dependsOn extractModules +task prepareWildFlyForTests( dependsOn: [installWildFly, installHibernateModule]) + +test.dependsOn prepareWildFlyForTests processTestResources { - expand( buildDir: buildDir.getName(), wildflyVersion: wildflyVersion ) + expand( buildDir: wildFlyInstallDir, wildflyVersion: wildflyVersion ) } + diff --git a/hibernate-orm-modules/src/test/resources/arquillian.xml b/hibernate-orm-modules/src/test/resources/arquillian.xml index 69e5d4fd34..3d7e4b6dc0 100644 --- a/hibernate-orm-modules/src/test/resources/arquillian.xml +++ b/hibernate-orm-modules/src/test/resources/arquillian.xml @@ -23,12 +23,16 @@ ${buildDir}/wildfly-${wildflyVersion} - -Djava.net.preferIPv4Stack=true -Djgroups.bind_addr=127.0.0.1 -Djboss.socket.binding.port-offset=137 + + -Djava.net.preferIPv4Stack=true + -Djgroups.bind_addr=127.0.0.1 + -Djboss.socket.binding.port-offset=137 - - + + + diff --git a/release/release.gradle b/release/release.gradle index 69985e4da0..87c6f4ef7f 100644 --- a/release/release.gradle +++ b/release/release.gradle @@ -17,10 +17,6 @@ buildDir = "target" idea.module { } - -final String[] versionComponents = version.split( '\\.' ); -final String majorMinorVersion = versionComponents[0] + '.' + versionComponents[1]; - final File documentationDir = mkdir( "${project.buildDir}/documentation" ); /** @@ -74,7 +70,7 @@ task assembleDocumentation(type: Task, dependsOn: [rootProject.project( 'documen task uploadDocumentation(type:Exec, dependsOn: assembleDocumentation) { description = "Uploads documentation to the JBoss doc server" - final String url = "filemgmt.jboss.org:/docs_htdocs/hibernate/orm/${majorMinorVersion}"; + final String url = "filemgmt.jboss.org:/docs_htdocs/hibernate/orm/${rootProject.hibernateMajorMinorVersion}"; executable 'rsync' args '-avz', '--links', '--protocol=28', "${documentationDir.absolutePath}/", url