Skip to content

Commit

Permalink
Improve Gradle build
Browse files Browse the repository at this point in the history
* Configure Signing plugin

* Support publishing all Grails artifacts to repo
  • Loading branch information
rainboyan committed Jul 20, 2023
1 parent 566e04e commit 779befd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
28 changes: 18 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ ext {
// directories created during the build which are related
// to turning the workspace root into a GRAILS_HOME
distInstallDir = file("$buildDir/dist-tmp")
homeDistDir = file("dist")
homeBinDir = file("bin")
homeConfDir = file("conf")
homeDistDir = file("dist")
homeLibDir = file("lib")
homeRepoDir = file("repo")
homeSrcDir = file("src")
}

Expand Down Expand Up @@ -218,10 +219,17 @@ subprojects { project ->
}
}

repositories {
maven {
name = 'grailsLocal'
url = homeRepoDir
}
}

if (project.name in ['grails-bom', 'grails-dependencies', 'grails-gradle-plugin']) return

publications {
mavenJava(MavenPublication) {
maven(MavenPublication) {
from components.java

pom.withXml {
Expand All @@ -233,13 +241,13 @@ subprojects { project ->
}
}

// signing {
// required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
// sign publishing.publications.mavenJava
// }

tasks.withType(Sign) {
onlyIf { isReleaseVersion }
afterEvaluate {
if (project.name != 'grails-gradle-plugin') {
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.maven
}
}
}

javadoc {
Expand Down Expand Up @@ -408,7 +416,6 @@ subprojects { project ->
}

if (!isTestSuite) {

task installToHomeDist(type: org.grails.gradle.Upload) {
configuration = configurations.archives
repositories {
Expand All @@ -433,6 +440,7 @@ task clean(type: Delete, group: 'build') {
homeConfDir,
homeDistDir,
homeLibDir,
homeRepoDir,
homeSrcDir
}

Expand Down
12 changes: 12 additions & 0 deletions gradle/assemble.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,15 @@ task zipDist(type: Zip, dependsOn: [sourcesJars, install]) {
}*/

task assemble(dependsOn: zipDist)

task publishToGrailsLocal { task ->
subprojects { Project project ->
if (!project.name.startsWith('grails-test-suite')) {
if (project.name == 'grails-gradle-plugin') {
task.dependsOn("$project.name:publishPluginMavenPublicationToGrailsLocalRepository")
} else {
task.dependsOn("$project.name:publishMavenPublicationToGrailsLocalRepository")
}
}
}
}

0 comments on commit 779befd

Please sign in to comment.