blob: 0bad79c6cdc06666101f2568fae03e4c830f9cd6 [file] [log] [blame]
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.codehaus.groovy.modules.http-builder:http-builder:0.7.2"
classpath "io.github.gradle-nexus:publish-plugin:1.3.0"
classpath "io.github.groovylang.groovydoc:groovydoc-gradle-plugin:1.0.1"
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath "org.grails.plugins:views-gradle:2.3.2"
classpath("org.asciidoctor:asciidoctor-gradle-jvm:4.0.0-alpha.1")
classpath "com.github.erdi:webdriver-binaries-gradle-plugin:3.0"
classpath "org.gradle:test-retry-gradle-plugin:1.5.2"
}
}
group "org.grails"
version project.projectVersion
logger.info("GORM VERSION = ${project.gormVersion}")
ext {
isTravisBuild = System.getenv().get("TRAVIS") == 'true'
isCiBuild = project.hasProperty("isCiBuild") || System.getenv().get("CI") as Boolean
isBuildSnapshot = version.endsWith('-SNAPSHOT')
isReleaseVersion = !isBuildSnapshot
nexusUsername = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
nexusPassword = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
}
ext."signing.keyId" = System.getenv("SIGNING_KEY") ?: project.hasProperty("signing.keyId") ? project.getProperty('signing.keyId') : null
ext."signing.password" = System.getenv("SIGNING_PASSPHRASE") ?: project.hasProperty("signing.password") ? project.getProperty('signing.password') : null
ext."signing.secretKeyRingFile" = project.hasProperty("signing.secretKeyRingFile") ? project.getProperty('signing.secretKeyRingFile') : null
ext['junit-jupiter.version'] = junitJupiterVersion
if (isReleaseVersion) {
apply plugin: 'maven-publish'
apply plugin: "io.github.gradle-nexus.publish-plugin"
nexusPublishing {
repositories {
sonatype {
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileId") ? project.sonatypeOssStagingProfileId : ''
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
username = ossUser
password = ossPass
stagingProfileId = ossStagingProfileId
}
}
}
}
subprojects { Project subproject ->
repositories {
maven { url "https://repo.grails.org/grails/core" }
if(groovyVersion && groovyVersion.endsWith('-SNAPSHOT')) {
maven {
name 'JFrog OSS snapshot repo'
url 'https://oss.jfrog.org/oss-snapshot-local/'
}
}
}
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module("org.codehaus.groovy:groovy-all") with module("org.codehaus.groovy:groovy:$groovyVersion")
}
}
ext {
isExample = subproject.name.startsWith('example')
isPluginProject = subproject.name.endsWith("-plugin") && (subproject.name.startsWith("grails") || subproject.name.startsWith("rx-"))
isGrails3PluginProject = subproject.name.endsWith("-plugin")
}
if(isExample) {
apply plugin: "groovy"
ext['h2.version'] = h2Version
ext['gorm.version'] = gormVersion
if(subproject.name.startsWith("examples-grails")) {
if (subproject.name != "examples-grails-data-service") {
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.grails-gsp"
apply plugin:"com.github.erdi.webdriver-binaries"
}
}
configurations.all { Configuration configuration->
configuration.resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if(details.requested.group == 'org.codehaus.groovy' && details.requested.name.startsWith('groovy')) {
details.useVersion(groovyVersion)
}
if(details.requested.group == 'org.springframework') {
details.useVersion(springVersion)
}
if (details.requested.group == "org.springframework.boot") {
details.useVersion(springBootVersion)
}
if (details.requested.group == "org.grails" && details.requested.name.contains("testing-support")) {
details.useVersion(testingSupportVersion)
}
if(details.requested.group == 'org.grails' &&
details.requested.name.startsWith('grails-datastore') &&
details.requested.name != 'grails-datastore-gorm-hibernate5') {
details.useVersion(gormVersion)
}
if (details.requested.group == "io.micronaut") {
details.useVersion(micronautVersion)
}
if (details.requested.group == "io.micronaut.spring") {
details.useVersion(micronautSpringVersion)
}
}
}
dependencies {
testImplementation "io.projectreactor:reactor-test:3.5.5"
testImplementation "org.codehaus.groovy:groovy-test-junit5:$groovyVersion"
testImplementation("org.spockframework:spock-core:$spockVersion") { transitive = false}
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
testImplementation "org.junit.platform:junit-platform-runner:1.9.3"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"
}
apply from: "${rootProject.projectDir}/gradle/testVerbose.gradle"
tasks.withType(Jar) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
return
}
ext {
projectInfo = new PublishingConvention(project)
pomInfo = {
delegate.name projectInfo.projectName
delegate.description projectInfo.projectDescription
delegate.url projectInfo.projectURL
delegate.licenses {
delegate.license {
delegate.name 'The Apache Software License, Version 2.0'
delegate.url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
delegate.distribution 'repo'
}
}
delegate.scm {
delegate.url projectInfo.projectVcsUrl
delegate.connection projectInfo.projectVcsUrl
delegate.developerConnection projectInfo.projectVcsUrl
}
delegate.developers {
delegate.developer {
delegate.id 'graemerocher'
delegate.name 'Graeme Rocher'
}
delegate.developer {
delegate.id 'jeffscottbrown'
delegate.name 'Jeff Brown'
}
delegate.developer {
delegate.id 'burtbeckwith'
delegate.name 'Burt Beckwith'
}
delegate.developer {
delegate.id 'puneetbehl'
delegate.name 'Puneet Behl'
}
}
}
}
apply plugin: 'groovy'
configurations {
documentation.extendsFrom(compileClasspath)
}
if(isPluginProject) {
group "org.grails.plugins"
version project.rootProject.version
}
else {
group "org.grails"
version project.rootProject.version
}
if(subproject.name == 'docs') {
return
}
if(isGrails3PluginProject) {
apply plugin: "org.grails.grails-plugin"
}
else {
apply plugin:"groovy"
}
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: "org.gradle.test-retry"
sourceCompatibility = "1.11"
targetCompatibility = "1.11"
java {
withJavadocJar()
withSourcesJar()
}
dependencies {
documentation "org.fusesource.jansi:jansi:$jansiVersion"
documentation "org.codehaus.groovy:groovy-dateutil:$groovyVersion"
documentation "info.picocli:picocli:$picocliVersion"
documentation "com.github.javaparser:javaparser-core:$javaParserCoreVersion"
implementation "org.codehaus.groovy:groovy:$groovyVersion"
testImplementation "org.codehaus.groovy:groovy-test-junit5:$groovyVersion"
testImplementation("org.spockframework:spock-core:$spockVersion") { transitive = false}
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
testImplementation "org.junit.platform:junit-platform-runner:1.9.3"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"
}
apply from: "${rootProject.projectDir}/gradle/testVerbose.gradle"
tasks.withType(Test) {
configure {
retry {
maxRetries = 2
maxFailures = 20
failOnPassedAfterRetry = true
filter {
excludeClasses.add("*GroovyChangeLogSpec")
}
}
}
}
groovydoc.classpath = configurations.documentation
publishing {
if (isBuildSnapshot) {
repositories {
maven {
credentials {
def u = System.getenv("ARTIFACTORY_USERNAME") ?: project.hasProperty("artifactoryPublishUsername") ? project.artifactoryPublishUsername : ''
def p = System.getenv("ARTIFACTORY_PASSWORD") ?: project.hasProperty("artifactoryPublishPassword") ? project.artifactoryPublishPassword : ''
username = u
password = p
}
if(isGrails3PluginProject) {
url "https://repo.grails.org/grails/plugins3-snapshots-local"
} else {
url "https://repo.grails.org/grails/libs-snapshots-local"
}
}
}
}
publications {
maven(MavenPublication) {
pom {
name = projectInfo.projectName
description = projectInfo.projectDescription
url = projectInfo.projectURL
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
url = 'scm:git@github.com:grails/gorm-hibernate5.git'
connection = 'scm:git@github.com:grails/gorm-hibernate5.git'
developerConnection = 'scm:git@github.com:grails/gorm-hibernate5.git'
}
developers {
developer {
id = 'puneetbehl'
name = 'Puneet Behl'
email = 'behlp@objectcomputing.com'
}
}
}
artifactId projectInfo.projectArtifactId
from components.java
afterEvaluate {
if(isGrails3PluginProject) {
artifact source:"${sourceSets.main.groovy.outputDir}/META-INF/grails-plugin.xml",
classifier:"plugin",
extension:'xml'
}
}
}
}
}
afterEvaluate {
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.maven
}
}
tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}
//do not generate extra load on Nexus with new staging repository if signing fails
tasks.withType(io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository).configureEach {
shouldRunAfter(tasks.withType(Sign))
}
}
class PublishingConvention {
Project project
String projectArtifactId
String projectName = 'GORM for Hibernate 5'
String projectDescription = 'Provides a GORM Object Mapping implementations for Hibernate 5'
String projectURL = 'https://gorm.grails.org/latest/hibernate'
String projectIssueTrackerUrl = 'https://github.com/grails/gorm-hibernate5/issues'
String projectVcsUrl = 'https://github.com/grails/gorm-hibernate5'
PublishingConvention(Project project) {
this.project = project
def name = project.name
if(name.startsWith('grails') && name.endsWith('-plugin')) {
name = 'hibernate5'
}
projectArtifactId = name
}
}