use of org.shipkit.gradle.notes.UpdateReleaseNotesTask in project shipkit by mockito.
the class BintrayReleasePlugin method apply.
public void apply(final Project project) {
project.getPlugins().apply(ReleasePlugin.class);
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
final Task gitPush = project.getTasks().getByName(GitPlugin.GIT_PUSH_TASK);
final Task performRelease = project.getTasks().getByName(ReleasePlugin.PERFORM_RELEASE_TASK);
project.allprojects(subproject -> {
subproject.getPlugins().withType(ShipkitBintrayPlugin.class, plugin -> {
Task bintrayUpload = subproject.getTasks().getByName(ShipkitBintrayPlugin.BINTRAY_UPLOAD_TASK);
performRelease.dependsOn(bintrayUpload);
// bintray upload after git push so that when git push fails we don't publish jars to bintray
// git push is easier to undo than deleting published jars (not possible with Central)
bintrayUpload.mustRunAfter(gitPush);
final BintrayExtension bintray = subproject.getExtensions().getByType(BintrayExtension.class);
deferredConfiguration(subproject, () -> {
UpdateReleaseNotesTask updateNotes = (UpdateReleaseNotesTask) project.getTasks().getByName(ReleaseNotesPlugin.UPDATE_NOTES_TASK);
String userSpecifiedRepo = conf.getLenient().getReleaseNotes().getPublicationRepository();
if (userSpecifiedRepo != null) {
updateNotes.setPublicationRepository(userSpecifiedRepo);
} else {
updateNotes.setPublicationRepository(BintrayUtil.getRepoLink(bintray));
}
});
});
subproject.getPlugins().withType(JavaBintrayPlugin.class, plugin -> {
// Making git push run as late as possible because it is an operation that is hard to reverse.
// Git push will be executed after all tasks needed by bintrayUpload
// but before bintrayUpload.
// Using task path as String because the task comes from maven-publish new configuration model
// and we cannot refer to it in a normal way, by task instance.
String mavenLocalTask = subproject.getPath() + ":" + MAVEN_LOCAL_TASK;
gitPush.mustRunAfter(mavenLocalTask);
});
});
}
use of org.shipkit.gradle.notes.UpdateReleaseNotesTask in project shipkit by mockito.
the class ReleaseNotesPlugin method releaseNotesTasks.
private static void releaseNotesTasks(final Project project, final ShipkitConfiguration conf) {
final FetchReleaseNotesTask releaseNotesFetcher = TaskMaker.task(project, FETCH_NOTES_TASK, FetchReleaseNotesTask.class, new Action<FetchReleaseNotesTask>() {
public void execute(final FetchReleaseNotesTask t) {
t.setDescription("Fetches release notes data from Git and GitHub and serializes them to a file");
t.setOutputFile(new File(project.getBuildDir(), "detailed-release-notes.ser"));
t.setGitHubApiUrl(conf.getGitHub().getApiUrl());
t.setGitHubReadOnlyAuthToken(conf.getGitHub().getReadOnlyAuthToken());
t.setGitHubRepository(conf.getGitHub().getRepository());
t.setPreviousVersion(conf.getPreviousReleaseVersion());
t.setTagPrefix(conf.getGit().getTagPrefix());
t.setIgnoreCommitsContaining(conf.getReleaseNotes().getIgnoreCommitsContaining());
t.setIgnoredContributors(conf.getTeam().getIgnoredContributors());
}
});
final Task contributorsFetcher = project.getTasks().getByName(GitHubContributorsPlugin.FETCH_CONTRIBUTORS);
TaskMaker.task(project, UPDATE_NOTES_TASK, UpdateReleaseNotesTask.class, new Action<UpdateReleaseNotesTask>() {
public void execute(final UpdateReleaseNotesTask t) {
t.setDescription("Updates release notes file. Run with '-Ppreview' if you only want to see the preview.");
configureDetailedNotes(t, releaseNotesFetcher, project, conf, contributorsFetcher);
boolean previewMode = project.hasProperty(PREVIEW_PROJECT_PROPERTY);
t.setPreviewMode(previewMode);
if (!previewMode) {
File releaseNotesFile = project.file(conf.getReleaseNotes().getFile());
GitPlugin.registerChangesForCommitIfApplied(singletonList(releaseNotesFile), "release notes updated", t);
t.getOutputs().file(releaseNotesFile);
}
}
});
}
use of org.shipkit.gradle.notes.UpdateReleaseNotesTask in project shipkit by mockito.
the class GradlePortalReleasePlugin method apply.
@Override
public void apply(final Project project) {
project.getPlugins().apply(ReleasePlugin.class);
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
final Task performRelease = project.getTasks().getByName(ReleasePlugin.PERFORM_RELEASE_TASK);
final Task gitPush = project.getTasks().getByName(GitPlugin.GIT_PUSH_TASK);
project.allprojects(new Action<Project>() {
@Override
public void execute(final Project subproject) {
subproject.getPlugins().withId("com.gradle.plugin-publish", new Action<Plugin>() {
@Override
public void execute(Plugin plugin) {
subproject.getPlugins().apply(PluginDiscoveryPlugin.class);
subproject.getPlugins().apply(PluginValidationPlugin.class);
subproject.getPlugins().apply(GradlePortalPublishPlugin.class);
subproject.getPlugins().apply(ComparePublicationsPlugin.class);
Task publishPlugins = subproject.getTasks().getByName(GradlePortalPublishPlugin.PUBLISH_PLUGINS_TASK);
// perform release will actually publish the plugins
performRelease.dependsOn(publishPlugins);
// git push is easier to revert than perform release
publishPlugins.mustRunAfter(gitPush);
// We first build plugins to be published, then do git push, we're using 'buildArchives' for that
// We know that "buildArchives" task exists because 'com.gradle.plugin-publish' applies Java plugin
Task archivesTask = subproject.getTasks().getByName("buildArchives");
publishPlugins.dependsOn(archivesTask);
gitPush.mustRunAfter(archivesTask);
UpdateReleaseNotesTask updateNotes = (UpdateReleaseNotesTask) project.getTasks().getByName(ReleaseNotesPlugin.UPDATE_NOTES_TASK);
updateNotes.setPublicationRepository(conf.getReleaseNotes().getPublicationRepository());
}
});
}
});
}
Aggregations