HHH-12188 - Add Java 9 automatic module name hinting
aligned OSGi symbolic name with Java 9 module name; cleaned up jar/osgi manifest configuration block
This commit is contained in:
parent
78bc62fe1e
commit
abbf1fdbbe
44
build.gradle
44
build.gradle
|
@ -330,25 +330,39 @@ subprojects { subProject ->
|
||||||
}
|
}
|
||||||
classpath = configurations.runtime
|
classpath = configurations.runtime
|
||||||
|
|
||||||
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 *.
|
|
||||||
'*'
|
|
||||||
|
|
||||||
instruction 'Bundle-Vendor', 'Hibernate.org'
|
String moduleSimpleName = java9ModuleName( subProject )
|
||||||
instruction 'Bundle-Description', subProject.osgiDescription()
|
String moduleName = "org.hibernate.orm.$moduleSimpleName"
|
||||||
instruction 'Implementation-Url', 'http://hibernate.org'
|
|
||||||
instruction 'Implementation-Version', version
|
// Java 9 module name
|
||||||
instruction 'Implementation-Vendor', 'Hibernate.org'
|
instruction 'Automatic-Module-Name', moduleName
|
||||||
instruction 'Implementation-Vendor-Id', 'org.hibernate'
|
|
||||||
instruction 'Implementation-Title', name
|
// 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-Title', name
|
||||||
instruction 'Specification-Version', version
|
instruction 'Specification-Version', version
|
||||||
instruction 'Specification-Vendor', 'Hibernate.org'
|
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'
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ class UtilitiesPlugin implements Plugin<Project> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class UtilitiesPluginDef {
|
class UtilitiesPluginDef {
|
||||||
|
@SuppressWarnings("GrUnnecessarySemicolon")
|
||||||
public String determinePackageName(SourceDirectorySet sourceDirectorySet, File javaFile) {
|
public String determinePackageName(SourceDirectorySet sourceDirectorySet, File javaFile) {
|
||||||
final javaFileAbsolutePath = javaFile.absolutePath;
|
final javaFileAbsolutePath = javaFile.absolutePath;
|
||||||
for ( File sourceDirectory : sourceDirectorySet.srcDirs ) {
|
for ( File sourceDirectory : sourceDirectorySet.srcDirs ) {
|
||||||
|
@ -28,4 +29,16 @@ class UtilitiesPluginDef {
|
||||||
}
|
}
|
||||||
throw new RuntimeException( "ugh" );
|
throw new RuntimeException( "ugh" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String java9ModuleName(Project project) {
|
||||||
|
String name = project.name
|
||||||
|
|
||||||
|
// alternative is to just use the full project name (don't drop the 'hibernate-' prefix)
|
||||||
|
|
||||||
|
if ( name.startsWith( 'hibernate-' ) ) {
|
||||||
|
name = name.drop( 'hibernate-'.length() )
|
||||||
|
}
|
||||||
|
|
||||||
|
return name
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue