blob: a1226c19420bbb8ef179cf500997b57ab22139e2 [file]
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "io.github.gradle-nexus:publish-plugin:1.3.0"
classpath "com.bmuschko:gradle-nexus-plugin:2.3.1"
}
}
group "org.grails"
version project.projectVersion
repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
}
ext.isSnapshot = version.endsWith("-SNAPSHOT")
ext.isReleaseVersion = !ext.isSnapshot
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.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'
}
sourceCompatibility = "1.11"
targetCompatibility = "1.11"
configurations {
documentation
}
java {
withJavadocJar()
withSourcesJar()
}
configurations {
all {
resolutionStrategy.force 'org.codehaus.groovy:groovy-xml:3.0.13'
resolutionStrategy.force 'org.yaml:snakeyaml:1.33'
}
}
dependencies {
documentation "org.fusesource.jansi:jansi:2.4.1"
documentation "org.codehaus.groovy:groovy-cli-picocli:$groovyVersion"
api gradleApi()
api "io.github.gradle-nexus:publish-plugin:1.3.0"
api "com.bmuschko:gradle-nexus-plugin:2.3.1"
api "org.grails:grails-gradle-model:$grailsVersion"
api "org.grails:grails-shell:$grailsVersion", {
exclude group: "org.slf4j", module: "slf4j-simple"
}
api "org.grails:grails-bootstrap:$grailsVersion", {
exclude group: "org.fusesource.jansi", module: "jansi"
exclude group: "jline", module: "jline"
exclude group: "net.java.dev.jna", module: "jna"
// Ant
exclude group: "org.codehaus.groovy", module: "groovy-ant"
exclude group: "org.apache.ant", module: "ant"
exclude group: "org.apache.ant", module: "ant-launcher"
exclude group: "org.apache.ivy", module: "ivy"
exclude group: "org.apache.ant", module: "ant-trax"
exclude group: "org.apache.ant", module: "ant-junit"
exclude group: "org.codehaus.gant", module: "gant_groovy1.8"
}
api "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
api "io.spring.gradle:dependency-management-plugin:1.1.3"
api "com.netflix.nebula:gradle-extra-configurations-plugin:7.0.0"
}
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'
}
grailsPluginPublish {
displayName = "Grails Publish Gradle Plugin"
description = 'A plugin to setup publishing to Grails central repo'
id = 'org.grails.internal.grails-plugin-publish'
implementationClass = 'org.grails.gradle.plugin.publishing.internal.GrailsCentralPublishGradlePlugin'
}
grailsProfilePublish {
displayName = "Grails Profile Publish Plugin"
description = 'A plugin for publishing profiles'
id = 'org.grails.internal.grails-profile-publish'
implementationClass = 'org.grails.gradle.plugin.profiles.internal.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")
classpath += configurations.documentation
}
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"
}
}
}
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")
}