diff --git a/build.gradle b/build.gradle index 56541483ba..c2d7e81e0b 100644 --- a/build.gradle +++ b/build.gradle @@ -44,9 +44,7 @@ ext { hibernateTargetVersion = '4.3.0-SNAPSHOT' javaLanguageLevel = '1.6' - // The OSGi manifest exported package versions need to be only the numerical release -- no "SNAPSHOT" or "Final" - // todo : brett - what about Alpha, Beta, CR, SP, etc? - osgiExportVersion = hibernateTargetVersion.replaceAll( "-SNAPSHOT", "" ).replaceAll( ".Final", "" ); + osgiExportVersion = hibernateTargetVersion.replaceAll( "-SNAPSHOT", ".SNAPSHOT" ) } idea { @@ -78,6 +76,11 @@ def pomName() { def pomDescription() { return "A module of the Hibernate O/RM project" } +// Used in MANIFEST.MF for OSGi Bundles +def osgiDescription() { + // by default just reuse the pomDescription + return pomDescription() +} // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ subprojects { subProject -> @@ -210,35 +213,34 @@ subprojects { subProject -> task generateSources(type: Task) jar { - Set exportPackages = new HashSet() - Set privatePackages = new HashSet() + // internal packages that need to temporarily be exported + final String[] temporaryExports = [ + // - org.hibernate.boot.registry.classloading.internal + // until EntityManagerFactoryBuilderImpl no longer imports ClassLoaderServiceImpl + 'org.hibernate.boot.registry.classloading.internal', + // - .util for external module use (especially envers) + 'org.hibernate.internal.util' + ] - // TODO: Could more of this be pulled into utilities.gradle? - sourceSets.each { sourceSet -> - // skip certain source sets - if ( ! ['test','matrix'].contains( sourceSet.name ) ) { - sourceSet.java.each { javaFile -> - // - org.hibernate.boot.registry.classloading.internal - // until EntityManagerFactoryBuilderImpl no longer imports ClassLoaderServiceImpl - // - .util for external module use (especially envers) - final String[] temporaryExports = [ - 'org.hibernate.boot.registry.classloading.internal', - 'org.hibernate.internal.util' ] + SortedSet exportPackages = new TreeSet() + SortedSet privatePackages = new TreeSet() - final String packageName = determinePackageName( sourceSet.java, javaFile ); - if ( ! temporaryExports.contains( packageName ) - && ( packageName.endsWith( ".internal" ) - || packageName.contains( ".internal." ) - || packageName.endsWith( ".test" ) - || packageName.contains( ".test." ) ) ) { - privatePackages.add( packageName ); - } - else { - exportPackages.add( packageName + ";version=\"" + exportPackageVersion + "\"" ); - } - } - } - } + sourceSets.main.java.each { javaFile -> + if ( javaFile.name.endsWith( 'package-info.java' ) ) { + return; + } + final String packageName = determinePackageName( sourceSets.main.java, javaFile ); + if ( ! temporaryExports.contains( packageName ) + && ( packageName.endsWith( ".internal" ) + || packageName.contains( ".internal." ) + || packageName.endsWith( ".test" ) + || packageName.contains( ".test." ) ) ) { + privatePackages.add( packageName ); + } + else { + exportPackages.add( packageName + ";version=\"" + exportPackageVersion + "\"" ); + } + } manifest = osgiManifest { // GRADLE-1411: Even if we override Imports and Exports @@ -260,6 +262,7 @@ subprojects { subProject -> instruction 'Private-Package', privatePackages.toArray(new String[0]) instruction 'Bundle-Vendor', 'Hibernate.org' + instruction 'Bundle-Description', osgiDescription() instruction 'Implementation-Url', 'http://hibernate.org' instruction 'Implementation-Version', version instruction 'Implementation-Vendor', 'Hibernate.org' diff --git a/hibernate-c3p0/hibernate-c3p0.gradle b/hibernate-c3p0/hibernate-c3p0.gradle index c149a9c1c1..e171c6e5ad 100644 --- a/hibernate-c3p0/hibernate-c3p0.gradle +++ b/hibernate-c3p0/hibernate-c3p0.gradle @@ -17,9 +17,3 @@ def pomName() { def pomDescription() { return 'Integration for c3p0 Connection pooling into Hibernate O/RM' } - -jar { - manifest { - instruction 'Bundle-Description', 'Hibernate ORM C3P0' - } -} \ No newline at end of file diff --git a/hibernate-core/hibernate-core.gradle b/hibernate-core/hibernate-core.gradle index 4bc46fb822..b37a93b401 100644 --- a/hibernate-core/hibernate-core.gradle +++ b/hibernate-core/hibernate-core.gradle @@ -53,8 +53,6 @@ jar { manifest { mainAttributes( 'Main-Class': 'org.hibernate.Version' ) - instruction 'Bundle-Description', 'Hibernate ORM Core' - instructionFirst 'Import-Package', 'javax.security.auth;resolution:=optional', 'javax.security.jacc;resolution:=optional', @@ -77,11 +75,11 @@ jar { 'org.apache.tools.ant.taskdefs;resolution:=optional', 'org.apache.tools.ant.types;resolution:=optional' - // TODO: Uncomment once EntityManagerFactoryBuilderImpl no longer - // uses ClassLoaderServiceImpl. - instruction 'Export-Package', - 'org.hibernate.boot.registry.classloading.internal', - '*' +// // TODO: Uncomment once EntityManagerFactoryBuilderImpl no longer +// // uses ClassLoaderServiceImpl. +// instruction 'Export-Package', +// 'org.hibernate.boot.registry.classloading.internal', +// '*' } } diff --git a/hibernate-ehcache/hibernate-ehcache.gradle b/hibernate-ehcache/hibernate-ehcache.gradle index 78b0c84500..dae140df17 100644 --- a/hibernate-ehcache/hibernate-ehcache.gradle +++ b/hibernate-ehcache/hibernate-ehcache.gradle @@ -12,9 +12,3 @@ def pomName() { def pomDescription() { return 'Integration for Ehcache into Hibernate as a second-level caching service' } - -jar { - manifest { - instruction 'Bundle-Description', 'Hibernate ORM EHCache' - } -} \ No newline at end of file diff --git a/hibernate-entitymanager/hibernate-entitymanager.gradle b/hibernate-entitymanager/hibernate-entitymanager.gradle index 3e18bc65a2..fbc6697572 100644 --- a/hibernate-entitymanager/hibernate-entitymanager.gradle +++ b/hibernate-entitymanager/hibernate-entitymanager.gradle @@ -45,8 +45,6 @@ def pomDescription() { jar { manifest { - instruction 'Bundle-Description', 'Hibernate ORM JPA Entity Manager' - // A cdi-api OSGi bundle does not currently exist. For now, explicitly // ignore its packages. This will only cause issues if an app tries // to use the BeanManagerListenerFactory functionality. diff --git a/hibernate-envers/hibernate-envers.gradle b/hibernate-envers/hibernate-envers.gradle index 644207dfdd..373e4c53ca 100644 --- a/hibernate-envers/hibernate-envers.gradle +++ b/hibernate-envers/hibernate-envers.gradle @@ -56,8 +56,6 @@ compileJava { jar { manifest { - instruction 'Bundle-Description', 'Hibernate ORM Envers' - instructionFirst 'Import-Package', // TODO: Shouldn't have to explicitly list the JPA packages, but // the plugin generates them with [1.0,2) versions. diff --git a/hibernate-infinispan/hibernate-infinispan.gradle b/hibernate-infinispan/hibernate-infinispan.gradle index 2431c54e5d..7362c73442 100644 --- a/hibernate-infinispan/hibernate-infinispan.gradle +++ b/hibernate-infinispan/hibernate-infinispan.gradle @@ -48,9 +48,3 @@ task sourcesTestJar(type: Jar, dependsOn:classes) { artifacts.archives packageTests artifacts.archives sourcesTestJar - -jar { - manifest { - instruction 'Bundle-Description', 'Hibernate ORM Infinispan' - } -} \ No newline at end of file diff --git a/hibernate-osgi/hibernate-osgi.gradle b/hibernate-osgi/hibernate-osgi.gradle index 7635cde49b..4e7183c47d 100644 --- a/hibernate-osgi/hibernate-osgi.gradle +++ b/hibernate-osgi/hibernate-osgi.gradle @@ -72,7 +72,6 @@ def pomDescription() { jar { manifest { instruction 'Bundle-Activator', 'org.hibernate.osgi.HibernateBundleActivator' - instruction 'Bundle-Description', 'Hibernate ORM OSGi' instructionFirst 'Import-Package', // TODO: Shouldn't have to explicitly list this, but the plugin diff --git a/hibernate-proxool/hibernate-proxool.gradle b/hibernate-proxool/hibernate-proxool.gradle index e537f1c6d3..08dbfd402c 100644 --- a/hibernate-proxool/hibernate-proxool.gradle +++ b/hibernate-proxool/hibernate-proxool.gradle @@ -11,9 +11,3 @@ def pomName() { def pomDescription() { return 'Integration for Proxool Connection pooling into Hibernate O/RM' } - -jar { - manifest { - instruction 'Bundle-Description', 'Hibernate ORM Proxool' - } -} \ No newline at end of file