Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F: Only register version for the current project #97

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to describe the problem to solve ("...other considerations that need to be made...").

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current change scopes the plugin to the project in which is registered. This is the common pattern for most plugins. There are a few paths that could be followed.

  1. Leave as is where a version task is registered everywhere. I personally don't see the value in only registering part of the plugin. This registers the task, but does not apply the configuration aspects. If this is choose, the task should be registered conditionally and only afterEvaulate has completed. This would still allow the plug to be registered on other projects, which today it fails
  2. Take the change as is only register the plugin and it's tasks in the project requested. This is the pattern most plugins follow. It's the safest and easiest to get correct.
  3. Register and apply not only the version task, but also the versioning semantics to every project when in a multi-project. The challenge with this is that since the versioning happens during the configuration phase ordering is very important and getting this right will be difficult

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider this a bug and not an enhancement, since as the plugin is currently authored it is unusable in a multi-project structure.

// to be made and this current change will make this plugin more composable.
project.getTasks().register("version", VersionTask.class);
}
}