hibernate-orm/build.gradle

188 lines
5.9 KiB
Groovy
Raw Normal View History

/*
* 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>.
*/
buildscript {
repositories {
jcenter()
2018-05-24 06:55:51 -04:00
mavenCentral()
}
dependencies {
classpath 'org.hibernate.build.gradle:version-injection-plugin:1.0.0'
classpath 'gradle.plugin.com.github.lburgazzoli:gradle-karaf-plugin:0.5.1'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.7'
2019-11-08 12:05:09 -05:00
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'de.thetaphi:forbiddenapis:3.0.1'
2019-05-21 17:29:57 -04:00
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.1'
}
2010-10-08 21:20:10 -04:00
}
plugins {
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'nu.studer.credentials' version '2.1'
id 'org.hibernate.orm.database-service' version '1.0.0-SNAPSHOT' apply false
id 'idea'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.0'
id 'eclipse'
2021-07-19 17:45:50 -04:00
id 'org.hibernate.build.xjc' version '2.2.0' apply false
id 'org.hibernate.matrix-test' version '3.1.1' apply false
id 'biz.aQute.bnd' version '5.1.1' apply false
}
allprojects {
repositories {
mavenCentral()
2018-08-10 11:00:15 -04:00
//Allow loading additional dependencies from a local path;
//useful to load JDBC drivers which can not be distributed in public.
if (System.env['ADDITIONAL_REPO'] != null) {
flatDir {
dirs "${System.env.ADDITIONAL_REPO}"
}
}
}
apply from: rootProject.file( 'gradle/base-information.gradle' )
apply plugin: 'org.hibernate.orm.database-service'
apply plugin: 'idea'
2019-05-21 17:29:57 -04:00
apply plugin: 'eclipse'
// minimize changes, at least for now (gradle uses 'build' by default)..
buildDir = "target"
2013-11-21 14:46:03 -05:00
}
2013-12-02 21:53:19 -05:00
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Release Task
2010-10-08 21:20:10 -04:00
task release {
description = "The task performed when we are performing a release build. Relies on " +
"the fact that subprojects will appropriately define a release task " +
"themselves if they have any release-related activities to perform"
doFirst {
def javaVersionsInUse = [gradle.ext.javaVersions.main.compiler, gradle.ext.javaVersions.main.release,
gradle.ext.javaVersions.test.compiler, gradle.ext.javaVersions.test.release,
gradle.ext.javaVersions.test.launcher].toSet()
// Force to release with JDK 8. It used to not work on JDK11 because of the hibernate-orm-modules module,
// but this limitation might be resolved now that this module has been deleted?
if ( javaVersionsInUse != [JavaLanguageVersion.of( 8 )].toSet() ) {
throw new IllegalStateException( "Please use JDK 8 to perform the release. Currently using: ${javaVersionsInUse}" )
}
}
}
2017-08-17 07:04:39 -04:00
2018-02-01 14:19:08 -05:00
task publish {
description = "The task performed when we want to just publish maven artifacts. Relies on " +
"the fact that subprojects will appropriately define a release task " +
2018-02-01 14:19:08 -05:00
"themselves if they have any release-related activities to perform"
}
ext {
// look for command-line overrides of the username/password pairs for publishing
if ( project.hasProperty( 'hibernatePublishUsername' ) ) {
if ( ! project.hasProperty( 'hibernatePublishPassword' ) ) {
throw new GradleException( "Should specify both `hibernatePublishUsername` and `hibernatePublishPassword` as project properties" );
}
credentials.hibernatePublishUsername = project.property( 'hibernatePublishUsername' )
credentials.hibernatePublishPassword = project.property( 'hibernatePublishPassword' )
}
else if ( System.properties.hibernatePublishUsername != null ) {
if ( System.properties.hibernatePublishPassword == null ) {
throw new GradleException( "Should specify both `hibernatePublishUsername` and `hibernatePublishPassword` as system properties" );
}
credentials.hibernatePublishUsername = System.properties.hibernatePublishUsername
credentials.hibernatePublishPassword = System.properties.hibernatePublishPassword
}
2021-05-14 17:47:30 -04:00
}
2021-05-14 17:47:30 -04:00
nexusPublishing {
repositories {
sonatype {
username = credentials.hibernatePublishUsername
password = credentials.hibernatePublishPassword
2021-05-14 17:47:30 -04:00
}
}
}
gradle.taskGraph.addTaskExecutionGraphListener(
new TaskExecutionGraphListener() {
@Override
void graphPopulated(TaskExecutionGraph graph) {
2021-05-14 17:47:30 -04:00
String[] tasksToLookFor = [
'publish',
'publishToSonatype',
'publishAllPublicationsToSonatype',
'publishPublishedArtifactsPublicationToSonatypeRepository',
'publishRelocationArtifactsPublicationToSonatypeRepository',
]
for ( String taskToLookFor : tasksToLookFor ) {
if ( graph.hasTask( taskToLookFor ) ) {
// trying to publish - make sure the needed credentials are available
2021-05-14 17:47:30 -04:00
if ( credentials.hibernatePublishUsername == null ) {
2021-05-14 17:47:30 -04:00
throw new GradleException( "Publishing credentials not specified" );
}
if ( credentials.hibernatePublishPassword == null ) {
2021-05-14 17:47:30 -04:00
throw new GradleException( "Publishing credentials not specified" );
}
break;
}
}
}
}
)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CI Build Task
task ciBuild {
description = "The task performed when one of the 'main' jobs are triggered on the " +
"CI server. Just as above, relies on the fact that subprojects will " +
"appropriately define a release task themselves if they have any tasks " +
"which should be performed from these CI jobs"
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Misc...
wrapper {
2019-10-21 12:48:17 -04:00
// To upgrade the version of gradle used in the wrapper, run:
// ./gradlew wrapper --gradle-version NEW_VERSION
distributionType = Wrapper.DistributionType.ALL
}
2013-12-02 21:53:19 -05:00
2019-05-21 17:29:57 -04:00
idea {
// project {
// jdkName = gradle.ext.baselineJavaVersion
// languageLevel = gradle.ext.baselineJavaVersion
//
// vcs = 'Git'
//
2019-05-21 17:29:57 -04:00
// settings {
// taskTriggers {
// afterSync tasks.getByName("projects"), tasks.getByName("tasks")
// }
// }
// }
2019-05-21 17:29:57 -04:00
module {
name = "hibernate-orm"
}
}
2013-11-21 14:46:03 -05:00