From 1bcd2ef7fddfad8a721af175103e24f6f6ca11f2 Mon Sep 17 00:00:00 2001 From: Eric Maino Date: Mon, 17 Oct 2022 10:58:53 -0700 Subject: [PATCH] F: Only register version for the current project The main challenge is that currently the plugin is partially registering it self with subprojects, but not fully doing so. It should be updated to fully register and handle versioning everywhere or only do it for the project configured. This change moves it to only register for the currently configured project. I thought of making the existing behavior conditional, however even then it didn't feel like the correct change. --- .../qoomon/gradle/gitversioning/GitVersioningPlugin.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPlugin.java b/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPlugin.java index 9bcc18e..eb6fc6a 100644 --- a/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPlugin.java +++ b/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPlugin.java @@ -14,7 +14,13 @@ public void apply(@Nonnull Project project) { project.getExtensions().create("gitVersioning", GitVersioningPluginExtension.class, project); - project.getAllprojects().forEach(it -> it.getTasks().create("version", VersionTask.class)); + // Only Register version task for current project so the plugin may be applied + // on + // sub projects. It would be nice to only define this once for all project in + // a multi-module project, however there are a few other considerations that + // need + // to be made and this current change will make this plugin more composable. + project.getTasks().register("version", VersionTask.class); } }