Search in sources :

Example 1 with FetchReleaseNotesTask

use of org.shipkit.gradle.notes.FetchReleaseNotesTask 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);
            }
        }
    });
}
Also used : FetchReleaseNotesTask(org.shipkit.gradle.notes.FetchReleaseNotesTask) Task(org.gradle.api.Task) UpdateReleaseNotesTask(org.shipkit.gradle.notes.UpdateReleaseNotesTask) UpdateReleaseNotesTask(org.shipkit.gradle.notes.UpdateReleaseNotesTask) FetchReleaseNotesTask(org.shipkit.gradle.notes.FetchReleaseNotesTask) File(java.io.File)

Aggregations

File (java.io.File)1 Task (org.gradle.api.Task)1 FetchReleaseNotesTask (org.shipkit.gradle.notes.FetchReleaseNotesTask)1 UpdateReleaseNotesTask (org.shipkit.gradle.notes.UpdateReleaseNotesTask)1