Skip to content

Commit

Permalink
Improve Gradle build scripts
Browse files Browse the repository at this point in the history
Closes gh-820
  • Loading branch information
rainboyan committed Dec 24, 2024
1 parent 941c887 commit 23b94e4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 51 deletions.
14 changes: 8 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ subprojects { project ->
ext.isTestSuite = project.name.startsWith("grace-test-suite")
ext.isCiBuild = project.hasProperty("isCiBuild") || System.getenv().get("CI") as Boolean
ext.pomInfo = {
if (project.name != 'grace-gradle-plugin') {
if (project.name == 'grace-gradle-plugin') {
delegate.name "Grace Gradle Plugin"
delegate.description "Grace Framework : A Gradle plugin for Grace which provides a bunch of useful plugins"
}
else {
def projectName = project.name.split('-')*.capitalize().join(' ')
delegate.name projectName
delegate.description "Grace Framework : $projectName"
Expand Down Expand Up @@ -223,11 +227,9 @@ subprojects { project ->
}

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

Expand Down
34 changes: 2 additions & 32 deletions grace-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ dependencies {
}

gradlePlugin {
automatedPublishing = false

plugins {
graceCore {
displayName = "Grace Core Gradle Plugin"
Expand Down Expand Up @@ -127,38 +129,6 @@ tasks.withType(Copy) {
}
}

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))
}

publishing {
publications {
pluginMaven(MavenPublication) {
pom {
name = "Grace Gradle Plugin"
description = "A Gradle plugin for Grace which provides a bunch of useful plugins"

withXml {
def xml = asNode()

xml.children().last() + pomInfo
}
}
}
}
}
16 changes: 3 additions & 13 deletions gradle/assemble.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,10 @@ task install(dependsOn: populateDependencies) { task ->
task publishToDist { task ->
subprojects { Project project ->
if (!project.name.startsWith('grace-test-suite') && !project.name.startsWith('grace-dependencies') && !project.name.startsWith('grace-bom')) {
if (project.name == 'grace-gradle-plugin') {
project.tasks.named("generateMetadataFileForIvyPublication").configure {
enabled = false
}
project.tasks.named("generateMetadataFileForPluginIvyPublication").configure {
enabled = false
}
task.dependsOn("$project.name:publishAllPublicationsToGraceDistRepository")
} else {
project.tasks.named("generateMetadataFileForIvyPublication").configure {
enabled = false
}
task.dependsOn("$project.name:publishAllPublicationsToGraceDistRepository")
project.tasks.named("generateMetadataFileForIvyPublication").configure {
enabled = false
}
task.dependsOn("$project.name:publishAllPublicationsToGraceDistRepository")
}
}
}
Expand Down

0 comments on commit 23b94e4

Please sign in to comment.