2018-01-10 16:06:58 -05:00
/ *
* 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' )
2018-01-22 12:43:16 -05:00
2018-01-22 12:28:24 -05:00
apply from: rootProject . file ( 'gradle/publishing-repos.gradle' )
2018-06-13 05:45:41 -04:00
apply from: rootProject . file ( 'gradle/publishing-pom.gradle' )
2018-01-22 12:28:24 -05:00
2018-02-01 15:00:37 -05:00
2020-02-19 09:30:57 -05:00
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Configurations and Dependencies
configurations {
asciidoclet {
description = 'Dependencies for Asciidoctor Javadoc taglet'
}
}
dependencies {
asciidoclet ( libraries . asciidoclet )
}
2018-01-10 17:52:28 -05:00
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Jar
jar {
2019-10-23 04:03:00 -04:00
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}"
)
2018-01-10 17:52:28 -05:00
}
}
2018-01-22 12:28:24 -05:00
2018-01-10 16:06:58 -05:00
task sourcesJar ( type: Jar ) {
from project . sourceSets . main . allSource
2019-10-23 04:03:00 -04:00
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
)
}
2019-10-23 03:58:09 -04:00
archiveClassifier . set ( 'sources' )
2018-01-10 16:06:58 -05:00
}
task javadocJar ( type: Jar ) {
from project . tasks . javadoc . outputs
2019-10-23 04:03:00 -04:00
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
)
}
2019-10-23 03:58:09 -04:00
archiveClassifier . set ( 'javadoc' )
2018-01-10 16:06:58 -05:00
}
2018-01-10 17:52:28 -05:00
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Javadoc
javadoc {
exclude ( "**/internal/*" )
exclude ( "**/generated-src/**" )
final int currentYear = new GregorianCalendar ( ) . get ( Calendar . YEAR )
configure ( options ) {
2020-02-19 09:30:57 -05:00
// this is the config needed to use asciidoclet for Javadoc rendering. It relies on a build from John's PR @ https://github.com/asciidoctor/asciidoclet/pull/91
// however, the PR does not work for me in that Javadocs with `@asciidoclet` are not rendered using asciidoc(tor/let). Also tried the preferable `@asciidoc`
// with the same result. Leaving all this config in place however as the outcome is the same as not enabling it.
// todo (6.0) : need to find out why the asciidoclet PR does not work
2020-02-19 13:46:28 -05:00
//
// Travis CI JDK 11 build did not like this
// docletpath = configurations.asciidoclet.files.asType(List)
// doclet = 'org.asciidoctor.Asciidoclet'
2018-01-10 17:52:28 -05:00
windowTitle = "$project.name JavaDocs"
docTitle = "$project.name JavaDocs ($project.version)"
bottom = "Copyright © 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/' ,
2018-06-13 14:35:45 -04:00
'https://javaee.github.io/javaee-spec/javadocs/'
2018-01-10 17:52:28 -05:00
]
2020-01-05 19:02:08 -05:00
tags = [ "apiNote" , 'implSpec' , 'implNote' , 'todo' ]
2019-05-24 04:50:02 -04:00
2019-02-18 07:31:18 -05:00
if ( JavaVersion . current ( ) . isJava11Compatible ( ) ) {
2019-05-24 04:50:02 -04:00
//The need to set `--source 1.8` applies to all JVMs after 11, and also to 11
2019-05-29 13:43:36 -04:00
// 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.
System . out . println ( "Forcing Javadoc in Java 8 compatible mode" ) ;
2019-05-24 04:50:02 -04:00
options . source = project . baselineJavaVersion
2019-02-17 16:32:03 -05:00
}
2018-01-10 17:52:28 -05:00
if ( JavaVersion . current ( ) . isJava8Compatible ( ) ) {
2019-05-21 17:29:57 -04:00
addStringOption ( 'Xdoclint:none' , '-quiet' )
2018-01-10 17:52:28 -05:00
}
2020-02-19 14:05:30 -05:00
// // by default, exclude the files from Asciidoclet processing
// // add the @asciidoclet tag to enable Asciidoclet on a particular file
// options.addStringOption( '-exclude-asciidoclet-process', '**' )
2020-02-19 09:30:57 -05:00
2019-05-21 17:29:57 -04:00
tags (
'todo:X"' ,
'apiNote:a:"API Note:"' ,
2020-02-19 09:30:57 -05:00
'implSpec:a:"Implementation Specification:"' ,
2019-05-21 17:29:57 -04:00
'implNote:a:"Implementation Note:"'
)
}
doFirst {
// ordering problems if we try to do this during config phase :(
2020-04-01 12:32:00 -04:00
classpath + = project . sourceSets . main . output . classesDirs + project . sourceSets . main . compileClasspath + project . configurations . provided
2018-01-10 17:52:28 -05:00
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Publishing
2018-01-10 16:06:58 -05:00
publishing {
publications {
2018-02-01 15:00:37 -05:00
publishedArtifacts {
2018-01-10 16:06:58 -05:00
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"
}
}
}
}
2019-05-21 17:29:57 -04:00
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Relocation for the published artifacts based on the old groupId
publishing {
publications {
relocationArtifacts ( MavenPublication ) {
pom {
name = project . name + ' - relocation'
groupId = 'org.hibernate'
artifactId = project . name
version = project . version
description = project . description
url = 'http://hibernate.org/orm'
organization {
name = 'Hibernate.org'
url = 'http://hibernate.org'
}
licenses {
license {
name = 'GNU Library General Public License v2.1 or later'
url = 'http://www.opensource.org/licenses/LGPL-2.1'
comments = 'See discussion at http://hibernate.org/community/license/ for more details.'
distribution = 'repo'
}
}
scm {
url = 'http://github.com/hibernate/hibernate-orm'
connection = 'scm:git:http://github.com/hibernate/hibernate-orm.git'
developerConnection = 'scm:git:git@github.com:hibernate/hibernate-orm.git'
}
developers {
developer {
id = 'hibernate-team'
name = 'The Hibernate Development Team'
organization = 'Hibernate.org'
organizationUrl = 'http://hibernate.org'
}
}
issueManagement {
system = 'jira'
url = 'https://hibernate.atlassian.net/browse/HHH'
}
distributionManagement {
relocation {
groupId = 'org.hibernate.orm'
artifactId = project . name
version = project . version
}
}
}
}
}
}
2018-02-15 13:06:01 -05:00
task ciBuild ( dependsOn: [ test , publish ] )
2018-02-01 14:19:08 -05:00
2018-02-15 13:06:01 -05:00
task release ( dependsOn: [ test , bintrayUpload ] )
2018-02-01 14:19:08 -05:00
2019-05-21 17:29:57 -04:00
afterEvaluate { Project project - >
project . rootProject . subprojects { Project subproject - >
// NOTE : we want this even when `project == subproject`
project . tasks . bintrayUpload . dependsOn ( subproject . tasks . build )
}
}