hibernate-orm/gradle/published-java-module.gradle

171 lines
5.4 KiB
Groovy

/*
* 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 from: rootProject.file( 'gradle/publishing-repos.gradle' )
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Jar
jar {
manifest {
attributes(
// Basic JAR manifest attributes
'Specification-Title': project.name,
'Specification-Version': project.version,
'Specification-Vendor': 'Hibernate.org',
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Hibernate.org',
'Implementation-Vendor-Id': 'org.hibernate',
'Implementation-Url': 'http://hibernate.org/orm',
// Java 9 module name
'Automatic-Module-Name': project.java9ModuleName,
// Hibernate-specific JAR manifest attributes
'Hibernate-VersionFamily': project.ormVersion.family,
'Hibernate-JpaVersion': project.jpaVersion.name,
// BND Plugin instructions (for OSGi):
'Bundle-Name': project.name,
'Bundle-SymbolicName': project.java9ModuleName,
'Bundle-Vendor': 'Hibernate.org',
'Bundle-DocURL': "http://www.hibernate.org/orm/${project.ormVersion.family}",
// This is overridden in some sub-projects
'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)"',
// Also import every package referenced in the code
// (note that '*' is resolved at build time to a list of packages)
'*'
].join( ',' ),
'-exportcontents': "*;version=${project.version}"
)
}
}
task sourcesJar(type: Jar) {
from project.sourceSets.main.allSource
manifest {
attributes(
// Basic JAR manifest attributes
'Specification-Title': project.name,
'Specification-Version': project.version,
'Specification-Vendor': 'Hibernate.org',
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Hibernate.org',
'Implementation-Vendor-Id': 'org.hibernate',
'Implementation-Url': 'http://hibernate.org/orm',
// Hibernate-specific JAR manifest attributes
'Hibernate-VersionFamily': project.ormVersion.family,
'Hibernate-JpaVersion': project.jpaVersion.name
)
}
archiveClassifier.set( 'sources' )
}
task javadocJar(type: Jar) {
from project.tasks.javadoc.outputs
manifest {
attributes(
// Basic JAR manifest attributes
'Specification-Title': project.name,
'Specification-Version': project.version,
'Specification-Vendor': 'Hibernate.org',
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Hibernate.org',
'Implementation-Vendor-Id': 'org.hibernate',
'Implementation-Url': 'http://hibernate.org/orm',
// Hibernate-specific JAR manifest attributes
'Hibernate-VersionFamily': project.ormVersion.family,
'Hibernate-JpaVersion': project.jpaVersion.name
)
}
archiveClassifier.set( 'javadoc' )
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Javadoc
javadoc {
exclude( "**/internal/*" )
exclude( "**/generated-src/**" )
final int currentYear = new GregorianCalendar().get( Calendar.YEAR )
configure( options ) {
windowTitle = "$project.name JavaDocs"
docTitle = "$project.name JavaDocs ($project.version)"
bottom = "Copyright &copy; 2001-$currentYear <a href=\"http://redhat.com\">Red Hat, Inc.</a> 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://javaee.github.io/javaee-spec/javadocs/'
]
tags = [ "apiNote", 'implSpec', 'implNote', 'todo' ]
if ( gradle.ext.javaVersions.main.compiler.asInt() >= 11 ) {
//The need to set `--source 1.8` applies to all JVMs after 11, and also to 11
// but after excluding the first two builds; see also specific comments on
// https://bugs.openjdk.java.net/browse/JDK-8212233?focusedCommentId=14245762
// For now, let's be compatible with JDK 11.0.3+. We can improve on it if people
// complain they cannot build with JDK 11.0.0, 11.0.1 and 11.0.2.
logger.lifecycle "Forcing Javadoc in Java 8 compatible mode"
options.source = gradle.ext.baselineJavaVersion
}
options.addStringOption( 'Xdoclint:none', '-quiet' )
doFirst {
// ordering problems if we try to do this during config phase :(
classpath += project.sourceSets.main.output.classesDirs + project.sourceSets.main.compileClasspath + project.configurations.provided
}
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Publishing
publishing {
publications {
publishedArtifacts {
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"
}
}
}
}
task ciBuild( dependsOn: [test, publish] )
task release( dependsOn: [test, publishToSonatype] )
publishToSonatype.mustRunAfter test