2020-10-15 18:20:30 -04:00
|
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
|
2015-05-19 00:23:35 -04: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>.
|
|
|
|
*/
|
2020-04-06 13:21:11 -04:00
|
|
|
|
2020-10-15 18:20:30 -04:00
|
|
|
plugins {
|
|
|
|
id 'java-gradle-plugin'
|
2020-11-19 09:50:16 -05:00
|
|
|
id 'com.github.sebersole.testkit-junit5' version '1.0.1'
|
2020-10-15 18:20:30 -04:00
|
|
|
|
|
|
|
// for portal publishing
|
|
|
|
id "com.gradle.plugin-publish" version "0.12.0"
|
|
|
|
id "nu.studer.credentials" version "2.1"
|
|
|
|
|
|
|
|
// for publishing snapshots
|
|
|
|
id 'maven-publish'
|
|
|
|
id 'org.hibernate.build.maven-repo-auth'
|
|
|
|
|
|
|
|
id 'idea'
|
|
|
|
id 'eclipse'
|
|
|
|
}
|
|
|
|
|
|
|
|
description = "Gradle plugin for integrating Hibernate aspects into your build"
|
|
|
|
|
|
|
|
apply from: rootProject.file( 'gradle/base-information.gradle' )
|
|
|
|
apply from: rootProject.file( 'gradle/libraries.gradle' )
|
|
|
|
apply from: rootProject.file( 'gradle/javadoc.gradle' )
|
2020-04-06 13:21:11 -04:00
|
|
|
|
2020-10-15 18:20:30 -04:00
|
|
|
ext {
|
|
|
|
pluginId = 'org.hibernate.orm'
|
|
|
|
pluginVersion = project.version
|
2013-06-26 03:45:14 -04:00
|
|
|
|
2020-10-15 18:20:30 -04:00
|
|
|
//noinspection GrUnresolvedAccess
|
|
|
|
publishKey = credentials.'hibernate.gradle.publish.key'
|
|
|
|
//noinspection GrUnresolvedAccess
|
|
|
|
publishSecret = credentials.'hibernate.gradle.publish.secret'
|
|
|
|
|
|
|
|
if ( publishKey != null && publishSecret != null ) {
|
|
|
|
project.'gradle.publish.key' = publishKey
|
|
|
|
project.'gradle.publish.secret' = publishSecret
|
|
|
|
}
|
|
|
|
}
|
2018-01-10 16:06:58 -05:00
|
|
|
|
2013-06-26 03:45:14 -04:00
|
|
|
dependencies {
|
2021-04-22 04:25:50 -04:00
|
|
|
compile project( ':hibernate-core' )
|
|
|
|
compile project( ':hibernate-testing' )
|
2020-10-15 18:20:30 -04:00
|
|
|
implementation( libraries.jpa )
|
|
|
|
implementation( libraries.javassist )
|
|
|
|
implementation( libraries.byteBuddy )
|
|
|
|
}
|
|
|
|
|
|
|
|
gradlePlugin {
|
|
|
|
plugins {
|
|
|
|
ormPlugin {
|
|
|
|
id = project.pluginId
|
|
|
|
implementationClass = 'org.hibernate.orm.tooling.gradle.HibernateOrmPlugin'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pluginBundle {
|
2021-03-22 07:38:00 -04:00
|
|
|
website = 'https://github.com/hibernate/hibernate-orm/tree/main/tooling/hibernate-gradle-plugin'
|
|
|
|
vcsUrl = 'https://github.com/hibernate/hibernate-orm/tree/main/tooling/hibernate-gradle-plugin'
|
2020-10-15 18:20:30 -04:00
|
|
|
tags = ['hibernate','orm','bytecode','enhancement','bytebuddy']
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
ormPlugin {
|
|
|
|
id = project.pluginId
|
|
|
|
displayName = 'Gradle plugin for Hibernate ORM'
|
|
|
|
description = 'Applies Hibernate aspects into the build'
|
|
|
|
}
|
|
|
|
}
|
2013-12-02 21:53:19 -05:00
|
|
|
}
|
2020-07-17 07:04:56 -04:00
|
|
|
|
2020-10-15 18:20:30 -04:00
|
|
|
processResources {
|
|
|
|
filter( ReplaceTokens, tokens: [ 'hibernateVersion': getVersion() ] )
|
2020-07-17 07:04:56 -04:00
|
|
|
}
|
2020-10-15 18:20:30 -04:00
|
|
|
|
|
|
|
|
|
|
|
task release
|
|
|
|
|
|
|
|
if ( project.version.toString().endsWith( '-SNAPSHOT' ) ) {
|
|
|
|
tasks.publishPlugins.enabled = false
|
|
|
|
tasks.release.dependsOn tasks.publish
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
tasks.publish.enabled = false
|
|
|
|
tasks.release.dependsOn( tasks.publishPlugins )
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.publishPlugins {
|
|
|
|
doFirst {
|
|
|
|
if ( project.'gradle.publish.key' == null ) {
|
|
|
|
throw new RuntimeException( "`gradle.publish.key` not found" )
|
|
|
|
}
|
|
|
|
if ( project.'gradle.publish.secret' == null ) {
|
|
|
|
throw new RuntimeException( "`gradle.publish.secret` not found" )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// for SNAPSHOT version
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
plugin( MavenPublication ) {
|
|
|
|
from components.java
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
name 'jboss-snapshots-repository'
|
|
|
|
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-17 07:04:56 -04:00
|
|
|
tasks.withType( GroovyCompile ) {
|
|
|
|
options.encoding = 'UTF-8'
|
2020-11-09 04:13:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !gradle.ext.javaToolchainEnabled ) {
|
|
|
|
tasks.withType( GroovyCompile ) {
|
|
|
|
sourceCompatibility = JavaVersion.toVersion( gradle.ext.baselineJavaVersion )
|
|
|
|
targetCompatibility = JavaVersion.toVersion( gradle.ext.baselineJavaVersion )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
logger.warn( "[WARN] Toolchains are not yet supported for Groovy compilation." +
|
2020-11-17 06:40:43 -05:00
|
|
|
" Using the JDK that runs Gradle for Groovy compilation." )
|
2020-07-17 07:04:56 -04:00
|
|
|
}
|
2020-11-17 06:40:43 -05:00
|
|
|
|
2020-12-14 08:11:00 -05:00
|
|
|
tasks.test {
|
|
|
|
if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) {
|
|
|
|
// Needs add-opens because Gradle uses illegal accesses to inject... mocks? Something like that.
|
|
|
|
jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )
|
|
|
|
}
|
|
|
|
}
|