blob: a874db2a67891e1b02ba5297f53316e41091b238 [file]
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath "io.github.gradle-nexus:publish-plugin:$gradleNexusPublishPluginVersion"
}
}
group "org.grails"
version project.projectVersion
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
}
ext.isSnapshot = version.endsWith("-SNAPSHOT")
ext.isReleaseVersion = !ext.isSnapshot
ext."signing.keyId" = project.findProperty("signing.keyId") ?: System.getenv('SIGNING_KEY')
ext."signing.password" = project.findProperty("signing.password") ?: System.getenv('SIGNING_PASSPHRASE')
ext."signing.secretKeyRingFile" = project.findProperty("signing.secretKeyRingFile") ?: "${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg"
ext.pomInfo = {
delegate.url 'https://github.com/grails/grails-gradle-plugin'
delegate.licenses {
delegate.license {
delegate.name 'The Apache Software License, Version 2.0'
delegate.url 'https://www.apache.org/licenses/LICENSE-2.0.txt'
delegate.distribution 'repo'
}
}
delegate.scm {
delegate.url "scm:git@github.com:grails/grails-gradle-plugin.git"
delegate.connection "scm:git@github.com:grails/grails-gradle-plugin.git"
delegate.developerConnection "scm:git@github.com:grails/grails-gradle-plugin.git"
}
delegate.developers {
delegate.developer {
delegate.id 'graemerocher'
delegate.name 'Graeme Rocher'
}
delegate.developer {
delegate.id 'jeffscottbrown'
delegate.name 'Jeff Brown'
}
delegate.developer {
delegate.id 'puneetbehl'
delegate.name 'Puneet Behl'
}
}
}
apply plugin: 'idea'
apply plugin: 'java-gradle-plugin'
apply plugin: 'groovy'
apply plugin: 'maven-publish'
if (isReleaseVersion) {
apply plugin: "io.github.gradle-nexus.publish-plugin"
apply plugin: 'signing'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withJavadocJar()
withSourcesJar()
}
dependencies {
// compile grails-gradle-plugin with the Groovy version provided by Gradle
// to ensure build compatibility with Gradle, currently Groovy 3.0.x
// see: https://docs.gradle.org/current/userguide/compatibility.html#groovy
compileOnly "org.codehaus.groovy:groovy:$GroovySystem.version"
compileOnly "org.grails:grails-bootstrap:$grailsVersion", {
exclude group: 'org.apache.groovy'
exclude group: 'org.spockframework'
}
compileOnly "org.grails:grails-shell:$grailsShellVersion", {
exclude group: 'org.apache.groovy'
exclude group: 'org.spockframework'
}
runtimeOnly "org.grails:grails-bootstrap:$grailsVersion", {
exclude group: 'org.apache.groovy'
exclude group: 'org.spockframework'
}
runtimeOnly "org.grails:grails-shell:$grailsShellVersion", {
exclude group: 'org.apache.groovy'
exclude group: 'org.spockframework'
}
implementation "org.grails:grails-gradle-model:$grailsVersion", {
exclude group: 'org.apache.groovy'
exclude group: 'org.spockframework'
}
implementation "io.github.gradle-nexus:publish-plugin:$gradleNexusPublishPluginVersion"
implementation "com.bmuschko:gradle-nexus-plugin:$gradleNexusPluginVersion"
implementation "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
implementation "org.springframework.boot:spring-boot-loader-tools:$springBootVersion"
implementation "io.spring.gradle:dependency-management-plugin:$springGradleDependencyManagementVersion"
}
gradlePlugin {
plugins {
grailsCore {
displayName = "Grails Core Gradle Plugin"
description = 'The main Grails gradle plugin implementation'
id = 'org.grails.grails-core'
implementationClass = 'org.grails.gradle.plugin.core.GrailsGradlePlugin'
}
grailsDoc {
displayName = "Grails Doc Gradle Plugin"
description = 'Adds Grails doc publishing support'
id = 'org.grails.grails-doc'
implementationClass = 'org.grails.gradle.plugin.doc.GrailsDocGradlePlugin'
}
grailsGsp {
displayName = "Grails GSP Gradle Plugin"
description = 'A plugin that adds support for compiling Groovy Server Pages (GSP)'
id = 'org.grails.grails-gsp'
implementationClass = 'org.grails.gradle.plugin.web.gsp.GroovyPagePlugin'
}
grailsPlugin {
displayName = "Grails-Plugin Gradle Plugin"
description = 'A Gradle plugin for Grails plugins'
id = 'org.grails.grails-plugin'
implementationClass = 'org.grails.gradle.plugin.core.GrailsPluginGradlePlugin'
}
grailsProfile {
displayName = "Grails Profile Gradle Plugin"
description = 'A plugin that is capable of compiling a Grails profile into a JAR file for distribution'
id = 'org.grails.grails-profile'
implementationClass = 'org.grails.gradle.plugin.profiles.GrailsProfileGradlePlugin'
}
grailsWeb {
displayName = "Grails Web Gradle Plugin"
description = 'Adds web specific extensions'
id = 'org.grails.grails-web'
implementationClass = 'org.grails.gradle.plugin.web.GrailsWebGradlePlugin'
}
grailsPublish {
displayName = "Grails Publish Gradle Plugin"
description = 'A plugin to assist in publishing Grails related artifacts'
id = 'org.grails.grails-publish'
implementationClass = 'org.grails.gradle.plugin.publishing.GrailsPublishGradlePlugin'
}
grailsProfilePublish {
displayName = "Grails Profile Publish Plugin"
description = 'A plugin for publishing profiles'
id = 'org.grails.grails-profile-publish'
implementationClass = 'org.grails.gradle.plugin.profiles.GrailsProfilePublishGradlePlugin'
}
}
}
jar {
manifest.mainAttributes(
"Built-By": System.properties['user.name'],
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": "Grails",
"Implementation-Version": grailsVersion,
"Implementation-Vendor": 'grails.org')
}
configure([compileGroovy, compileTestGroovy]) {
groovyOptions.fork(memoryInitialSize: '128M', memoryMaximumSize: '1G')
groovyOptions.encoding = "UTF-8"
options.encoding = "UTF-8"
}
configure([compileJava, compileTestJava]) {
options.deprecation = true
options.debug = true
}
configure([groovydoc]) {
destinationDir = project.file("build/docs/api")
}
configure([javadoc]) {
options.encoding "UTF-8"
options.docEncoding "UTF-8"
options.charSet "UTF-8"
options.jFlags "-Xms64M", "-Xmx512M"
}
tasks.withType(Copy) {
configure {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}
if (isReleaseVersion) {
afterEvaluate {
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
Publication[] publications = new Publication[publishing.publications.size()]
publishing.publications.findAll().toArray(publications)
sign(publications)
}
}
tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}
}
tasks.withType(io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository).configureEach {
shouldRunAfter(tasks.withType(Sign))
}
if (isReleaseVersion) {
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
}
}
}
}
publishing {
if (isSnapshot) {
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
}
url "https://repo.grails.org/grails/libs-snapshots-local"
}
}
}
// publishAllPublicationsToTestCaseMavenRepoRepository
repositories {
maven {
name = "TestCaseMavenRepo"
url = layout.buildDirectory.dir('local-maven')
}
}
publications {
pluginMaven(MavenPublication) {
pom {
name = "Grails Gradle Plugin"
description = "A Gradle plugin for Grails which provides a bunch of useful plugins"
url = 'https://github.com/grails/grails-gradle-plugin'
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/grails-gradle-plugin.git"
connection = "scm:git@github.com:grails/grails-gradle-plugin.git"
developerConnection = "scm:git@github.com:grails/grails-gradle-plugin.git"
}
developers {
developer {
id = 'graemerocher'
name = 'Graeme Rocher'
}
developer {
id = 'jeffscottbrown'
name = 'Jeff Brown'
}
developer {
id = 'puneetbehl'
name = 'Puneet Behl'
}
}
}
}
}
}
project.afterEvaluate {
project.publishing.publications.each { MavenPublication publication ->
if (publication.name != "pluginMaven") {
publication.pom.withXml {
def xml = asNode()
xml.children().last() + pomInfo
}
}
}
}
tasks.named("build").configure {
finalizedBy("groovydoc")
}
apply from: rootProject.layout.projectDirectory.file('gradle/e2eTest.gradle')