142 lines
4.3 KiB
Groovy
142 lines
4.3 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>.
|
|
*/
|
|
|
|
buildscript {
|
|
// repositories {
|
|
// mavenCentral()
|
|
// }
|
|
|
|
dependencies {
|
|
classpath 'org.hibernate.build.gradle:version-injection-plugin:1.0.0'
|
|
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.7'
|
|
classpath 'de.thetaphi:forbiddenapis:3.2'
|
|
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.1'
|
|
}
|
|
}
|
|
|
|
|
|
plugins {
|
|
id 'org.hibernate.build.xjc-jakarta' version '1.0.2' apply false
|
|
id 'org.hibernate.matrix-test' version '3.1.1' apply false
|
|
id 'org.hibernate.orm.database-service' apply false
|
|
|
|
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
|
|
|
|
id 'idea'
|
|
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.0'
|
|
id 'eclipse'
|
|
}
|
|
|
|
apply from: file( 'gradle/module.gradle' )
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Release Task
|
|
|
|
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()
|
|
if ( javaVersionsInUse != [JavaLanguageVersion.of( 11 )].toSet() ) {
|
|
throw new IllegalStateException( "Please use JDK 11 to perform the release. Currently using: ${javaVersionsInUse}" )
|
|
}
|
|
}
|
|
}
|
|
|
|
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 " +
|
|
"themselves if they have any publish-related activities to perform"
|
|
}
|
|
|
|
ext {
|
|
if ( project.hasProperty( 'hibernatePublishUsername' ) ) {
|
|
if ( ! project.hasProperty( 'hibernatePublishPassword' ) ) {
|
|
throw new GradleException( "Should specify both `hibernatePublishUsername` and `hibernatePublishPassword` as project properties" );
|
|
}
|
|
}
|
|
}
|
|
|
|
nexusPublishing {
|
|
repositories {
|
|
sonatype {
|
|
username = project.hasProperty( 'hibernatePublishUsername' ) ? project.property( 'hibernatePublishUsername' ) : null
|
|
password = project.hasProperty( 'hibernatePublishPassword' ) ? project.property( 'hibernatePublishPassword' ) : null
|
|
}
|
|
}
|
|
}
|
|
|
|
gradle.taskGraph.addTaskExecutionGraphListener(
|
|
new TaskExecutionGraphListener() {
|
|
@Override
|
|
void graphPopulated(TaskExecutionGraph graph) {
|
|
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
|
|
|
|
if ( project.property( 'hibernatePublishUsername' ) == null ) {
|
|
throw new RuntimeException( "`-PhibernatePublishUsername=...` not found" )
|
|
}
|
|
if ( project.property( 'hibernatePublishPassword' ) == null ) {
|
|
throw new RuntimeException( "`-PhibernatePublishPassword=...` not found" )
|
|
}
|
|
|
|
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 {
|
|
// To upgrade the version of gradle used in the wrapper, run:
|
|
// ./gradlew wrapper --gradle-version NEW_VERSION
|
|
|
|
// uncomment locally if you need to debug build scripts.
|
|
// in such cases, having the sources helps
|
|
//distributionType = Wrapper.DistributionType.ALL
|
|
}
|
|
|
|
|
|
idea {
|
|
module {
|
|
name = "hibernate-orm"
|
|
}
|
|
}
|
|
|
|
|
|
|