/* * 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 . */ buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath 'org.hibernate.build.gradle:hibernate-matrix-testing:3.0.0.Final' 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' classpath 'de.thetaphi:forbiddenapis:3.0.1' } } plugins { id 'me.champeau.buildscan-recipes' version '0.2.3' id 'io.github.gradle-nexus.publish-plugin' version '1.0.0' id 'nu.studer.credentials' version '2.1' id 'org.hibernate.build.xjc' version '2.0.1' apply false id 'org.hibernate.build.maven-repo-auth' version '3.0.3' apply false id 'biz.aQute.bnd' version '5.1.1' apply false } ext { sonatypeOssrhUser = project.findProperty( 'SONATYPE_OSSRH_USER' ) sonatypeOssrhPassword = project.findProperty( 'SONATYPE_OSSRH_PASSWORD' ) } File versionFile = file( "${rootProject.projectDir}/gradle/version.properties" ) ext { ormVersionFile = versionFile ormVersion = HibernateVersion.fromFile( versionFile, project ) // Override during releases if ( project.hasProperty( 'releaseVersion' ) ) { ormVersion = new HibernateVersion( project.releaseVersion, project ) } jpaVersion = new JpaVersion('2.2') } // The Gradle Nexus Publish Plugin must be applied to the root project and requires group and version group = 'org.hibernate' version = project.ormVersion.fullName logger.lifecycle "Publishing groupId: '" + project.group + "', version: '" + project.version + "'" nexusPublishing { repositories { sonatype { username = project.sonatypeOssrhUser password = project.sonatypeOssrhPassword } } } allprojects { repositories { mavenCentral() //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 plugin: 'idea' // minimize changes, at least for now (gradle uses 'build' by default).. buildDir = "target" group = 'org.hibernate' version = project.ormVersion.fullName } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // 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() // Force to release with JDK 8. Releasing with JDK 11 is not supported yet: // - the hibernate-orm-modules tests do not run due to an issue with the ASM version currently used by Gradle if ( javaVersionsInUse != [JavaLanguageVersion.of( 8 )].toSet() ) { throw new IllegalStateException( "Please use JDK 8 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 release-related activities to perform" } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // 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" } wrapper { // To upgrade the version of gradle used in the wrapper, run: // ./gradlew wrapper --gradle-version NEW_VERSION distributionType = Wrapper.DistributionType.ALL } buildScan { termsOfServiceUrl = 'https://gradle.com/terms-of-service' termsOfServiceAgree = 'yes' } buildScanRecipes { recipe 'git-commit', baseUrl: 'https://github.com/hibernate/hibernate-orm/tree' } class JpaVersion { /** The *normal* name (1.0, 2.0, ..) */ final String name; final String osgiName JpaVersion(String version){ this.name = version this.osgiName = version + ".0" } @Override String toString() { return name } } class HibernateVersion { final String fullName final String majorVersion final String family final String osgiVersion final boolean isSnapshot HibernateVersion(String fullName, Project project) { this.fullName = fullName final String[] hibernateVersionComponents = fullName.split( '\\.' ) this.majorVersion = hibernateVersionComponents[0] this.family = hibernateVersionComponents[0] + '.' + hibernateVersionComponents[1] this.isSnapshot = fullName.endsWith( '-SNAPSHOT' ) this.osgiVersion = isSnapshot ? family + '.' + hibernateVersionComponents[2] + '.SNAPSHOT' : fullName } static HibernateVersion fromFile(File file, Project project){ def fullName = readVersionProperties(file) return new HibernateVersion(fullName, project) } private static String readVersionProperties(File file) { if ( !file.exists() ) { throw new GradleException( "Version file $file.canonicalPath does not exists" ) } Properties versionProperties = new Properties() file.withInputStream { stream -> versionProperties.load( stream ) } return versionProperties.hibernateVersion } @Override String toString() { return this.fullName } } //idea { // project { // jdkName = gradle.ext.baselineJavaVersion // languageLevel = gradle.ext.baselineJavaVersion // // vcs = 'Git' // } // module { // name = "hibernate-orm" // } //}