Permalink
Browse files

emit nice summary at the end of the release:

 - very first version which includes a link to the release notes
  • Loading branch information...
epeee committed Oct 8, 2017
1 parent 5b3155f commit 97f1750b36a499c90f29c4cac16cb3a2c8da6cb2
@@ -5,13 +5,17 @@
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.shipkit.gradle.exec.ShipkitExecTask;
import org.shipkit.gradle.git.IdentifyGitBranchTask;
import org.shipkit.gradle.notes.UpdateReleaseNotesTask;
import org.shipkit.internal.gradle.notes.ReleaseNotesPlugin;
import org.shipkit.internal.gradle.version.VersioningPlugin;
import org.shipkit.internal.gradle.git.GitPlugin;
import org.shipkit.internal.gradle.util.TaskMaker;
import org.shipkit.internal.gradle.util.TaskSuccessfulMessage;
import org.shipkit.internal.notes.util.Supplier;
import static java.util.Arrays.asList;
import static org.shipkit.internal.gradle.git.GitBranchPlugin.IDENTIFY_GIT_BRANCH;
import static org.shipkit.internal.gradle.notes.ReleaseNotesPlugin.UPDATE_NOTES_TASK;
import static org.shipkit.internal.gradle.exec.ExecCommandFactory.execCommand;
import static org.shipkit.internal.gradle.release.ReleaseNeededPlugin.RELEASE_NEEDED;
@@ -41,7 +45,7 @@
public static final String RELEASE_CLEAN_UP_TASK = "releaseCleanUp";
@Override
public void apply(Project project) {
public void apply(final Project project) {
project.getPlugins().apply(ReleaseNotesPlugin.class);
project.getPlugins().apply(GitPlugin.class);
project.getPlugins().apply(ReleaseNeededPlugin.class);
@@ -53,6 +57,18 @@ public void execute(final Task t) {
t.dependsOn(VersioningPlugin.BUMP_VERSION_FILE_TASK, UPDATE_NOTES_TASK);
t.dependsOn(GitPlugin.PERFORM_GIT_PUSH_TASK);
final UpdateReleaseNotesTask updateReleaseNotes = (UpdateReleaseNotesTask) project.getTasks().getByName(UPDATE_NOTES_TASK);
final IdentifyGitBranchTask identifyGitBranchTask = (IdentifyGitBranchTask) project.getTasks().getByName(IDENTIFY_GIT_BRANCH);
TaskSuccessfulMessage.logOnSuccess(t, new Supplier<String>() {
@Override
public String get() {
return "\n" +
"Release shipped!\n" +
" - Release notes: " + updateReleaseNotes.getReleaseNotesUrl(identifyGitBranchTask.getBranch());
}
});
}
});
@@ -4,6 +4,7 @@
import org.gradle.api.Task;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.shipkit.internal.notes.util.Supplier;
public class TaskSuccessfulMessage {
@@ -21,4 +22,13 @@ public void execute(Task task) {
}
});
}
public static void logOnSuccess(Task task, final Supplier<String> supplier) {
task.doLast(new Action<Task>() {
@Override
public void execute(Task task) {
LOG.lifecycle(supplier.get());
}
});
}
}
@@ -0,0 +1,6 @@
package org.shipkit.internal.notes.util;
public interface Supplier<T> {
T get();
}

0 comments on commit 97f1750

Please sign in to comment.