Skip to content

Commit

Permalink
avoid duplicate task creation
Browse files Browse the repository at this point in the history
  • Loading branch information
farrell-m committed May 17, 2024
1 parent f498c41 commit 30a2c57
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ class LaaCcmsJavaGradlePlugin implements Plugin<Project> {
}

// Used for deploying snapshot packages
target.rootProject.tasks.register("updateSnapshotVersion") {
doLast(task -> {
if (target.rootProject.tasks.findByName('updateSnapshotVersion') == null) {
target.rootProject.tasks.register("updateSnapshotVersion") {
doLast(task -> {
def gitHash = "git rev-parse --short HEAD".execute().text.trim()
def propertiesFile = target.rootProject.file('gradle.properties')
def properties = new Properties()
Expand All @@ -167,7 +168,8 @@ class LaaCcmsJavaGradlePlugin implements Plugin<Project> {
properties.setProperty('version', newVersion)
properties.store(propertiesFile.newWriter(), null)
}
)
)
}
}
}
}

0 comments on commit 30a2c57

Please sign in to comment.