Simplified configuration
I don't think we needed the extra conditional logic.
We also can rely on the fact that the update task is already added to the project because we had applied the release plugin.
@@ -79,11 +79,10 @@ public class JavaReleasePlugin implements Plugin<Project> {
bintrayUpload.mustRunAfter(gitPush);
final BintrayExtension bintray = subproject.getExtensions().getByType(BintrayExtension.class);
- //TODO clean up below. We don't need 'deferredConfiguration' because at this point
- // shipkit file was already loaded and java library plugin applied on the subproject
deferredConfiguration(subproject, new Runnable() {
public void run() {
- configurePublicationRepo(project, BintrayUtil.getRepoLink(bintray));
+ UpdateReleaseNotesTask updateNotes = (UpdateReleaseNotesTask) project.getTasks().getByName(ReleaseNotesPlugin.UPDATE_NOTES_TASK);
+ updateNotes.setPublicationRepository(BintrayUtil.getRepoLink(bintray));
}
});
}
@@ -91,19 +90,4 @@ public class JavaReleasePlugin implements Plugin<Project> {
}
});
}
-
- private static void configurePublicationRepo(Project project, String bintrayRepo) {
- //not using 'getTasks().withType()' because I don't want to create too many task configuration rules
- //TODO add information about it in the development guide
- for (Task t : project.getTasks()) {
- if (t instanceof UpdateReleaseNotesTask) {
- UpdateReleaseNotesTask task = (UpdateReleaseNotesTask) t;
- if (task.getPublicationRepository() == null) {
- LOG.info("Configuring publication repository '{}' on task: {}", bintrayRepo, t.getPath());
- task.setPublicationRepository(bintrayRepo);
- }
- }
- }
- //TODO unit test coverage
- }
}
