diff --git a/CHANGELOG.md b/CHANGELOG.md index 172a670..0186e47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project are documented in this file, based on [Keep ## [Unreleased] +## [1.7.4] - 2024-07-24 +- Add `printProjects` task that prints the GAV coordinates of all projects. + + ## [1.7.3] - 2024-07-22 - No changes. @@ -30,7 +34,7 @@ All notable changes to this project are documented in this file, based on [Keep ## [1.6.2] - 2024-07-16 -- When creating a forced snapshot version, the snapshot version should be the same regardless of whether the current `HEAD` commit has a relwase tag or not. +- When creating a forced snapshot version, the snapshot version should be the same regardless of whether the current `HEAD` commit has a release tag or not. - By default, set `firstParentOnly` to `true`. diff --git a/plugin/src/main/kotlin/mb/gitonium/GitoniumPlugin.kt b/plugin/src/main/kotlin/mb/gitonium/GitoniumPlugin.kt index 369dad4..67be953 100644 --- a/plugin/src/main/kotlin/mb/gitonium/GitoniumPlugin.kt +++ b/plugin/src/main/kotlin/mb/gitonium/GitoniumPlugin.kt @@ -22,6 +22,7 @@ class GitoniumPlugin : Plugin { // Register tasks registerCheckSnapshotDependenciesTask(project, extension) registerPrintVersionTask(project) + registerPrintProjectsTask(project) registerAssertNotDirtyTask(project) registerWriteBuildPropertiesTask(project, extension) } @@ -66,6 +67,24 @@ class GitoniumPlugin : Plugin { } } + /** + * Registers a task that prints the GAV coordinates of all projects in the build to STDOUT. + * + * @param project The project for which to register the task. + */ + private fun registerPrintProjectsTask(project: Project) { + project.tasks.register("printProjects") { + this.group = "help" + this.description = "Prints the GAV coordinates of all projects in the build." + + doLast { + project.allprojects.forEach { + println("${it.group}:${it.name}:${it.version}") + } + } + } + } + /** * Registers a task that asserts that the current version of the project is not 'dirty', * i.e., has changes not in the current version tag.