use of org.shipkit.gradle.configuration.ShipkitConfiguration in project shipkit by mockito.
the class UploadGistsPlugin method apply.
@Override
public void apply(final Project project) {
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
TaskMaker.task(project, UPLOAD_GISTS_TASK, UploadGistsTask.class, new Action<UploadGistsTask>() {
@Override
public void execute(UploadGistsTask uploadGistsTask) {
uploadGistsTask.setDescription("Uploads to Gist files provided by 'filesToUpload' task property.");
uploadGistsTask.setGitHubApiUrl(conf.getGitHub().getApiUrl());
uploadGistsTask.setGitHubWriteToken(conf.getLenient().getGitHub().getWriteAuthToken());
}
});
}
use of org.shipkit.gradle.configuration.ShipkitConfiguration in project shipkit by mockito.
the class GitPlugin method apply.
public void apply(final Project project) {
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
TaskMaker.task(project, GIT_COMMIT_TASK, GitCommitTask.class, new Action<GitCommitTask>() {
public void execute(final GitCommitTask t) {
t.setDescription("Commits all changed files using generic --author and aggregated commit message");
t.setGitUserName(conf.getGit().getUser());
t.setGitUserEmail(conf.getGit().getEmail());
t.setCommitMessagePostfix(conf.getGit().getCommitMessagePostfix());
}
});
TaskMaker.task(project, GIT_TAG_TASK, ShipkitExecTask.class, new Action<ShipkitExecTask>() {
public void execute(final ShipkitExecTask t) {
t.mustRunAfter(GIT_COMMIT_TASK);
final String tag = GitUtil.getTag(conf, project);
t.setDescription("Creates new version tag '" + tag + "'");
t.execCommand(execCommand("Creating tag", "git", "tag", "-a", tag, "-m", GitUtil.getCommitMessage("Created new tag " + tag, conf.getGit().getCommitMessagePostfix())));
}
});
TaskMaker.task(project, GIT_PUSH_TASK, GitPushTask.class, new Action<GitPushTask>() {
public void execute(final GitPushTask t) {
t.setDescription("Pushes automatically created commits to remote repo.");
t.mustRunAfter(GIT_COMMIT_TASK);
t.mustRunAfter(GIT_TAG_TASK);
t.dependsOn(GitBranchPlugin.IDENTIFY_GIT_BRANCH);
t.getTargets().add(GitUtil.getTag(conf, project));
t.setDryRun(conf.isDryRun());
GitUrlInfo info = new GitUrlInfo(conf);
t.setUrl(info.getGitUrl());
t.setSecretValue(info.getWriteToken());
project.getPlugins().apply(GitBranchPlugin.class).provideBranchTo(t, new Action<String>() {
@Override
public void execute(String branch) {
t.getTargets().add(branch);
}
});
}
});
final Task performPush = TaskMaker.task(project, PERFORM_GIT_PUSH_TASK, Task.class, new Action<Task>() {
public void execute(final Task t) {
t.setDescription("Performs gitCommit, gitTag and gitPush tasks and all tasks dependent on them.");
t.dependsOn(GIT_COMMIT_TASK, GIT_TAG_TASK, GIT_PUSH_TASK);
}
});
TaskMaker.task(project, PERFORM_GIT_COMMIT_CLEANUP_TASK, Task.class, new Action<Task>() {
public void execute(final Task t) {
t.setDescription("Performs " + SOFT_RESET_COMMIT_TASK + " and " + GIT_STASH_TASK + " tasks.");
t.dependsOn(SOFT_RESET_COMMIT_TASK, GIT_STASH_TASK);
t.mustRunAfter(performPush);
}
});
TaskMaker.task(project, GIT_STASH_TASK, ShipkitExecTask.class, new Action<ShipkitExecTask>() {
public void execute(final ShipkitExecTask t) {
t.setDescription("Stashes current changes");
t.execCommand(execCommand("Stashing changes", "git", "stash"));
t.mustRunAfter(SOFT_RESET_COMMIT_TASK);
}
});
TaskMaker.task(project, SOFT_RESET_COMMIT_TASK, ShipkitExecTask.class, new Action<ShipkitExecTask>() {
public void execute(final ShipkitExecTask t) {
t.setDescription("Removes last commit, using 'reset --soft HEAD~'");
t.execCommand(execCommand("Removing last commit", "git", "reset", "--soft", "HEAD~"));
}
});
TaskMaker.task(project, TAG_CLEANUP_TASK, ShipkitExecTask.class, new Action<ShipkitExecTask>() {
public void execute(final ShipkitExecTask t) {
t.setDescription("Deletes version tag '" + getTag(conf, project) + "'");
t.execCommand(execCommand("Deleting version tag", "git", "tag", "-d", getTag(conf, project)));
t.mustRunAfter(performPush);
}
});
}
use of org.shipkit.gradle.configuration.ShipkitConfiguration in project shipkit by mockito.
the class ComparePublicationsPlugin method apply.
@Override
public void apply(final Project project) {
project.getPlugins().apply(JavaPublishPlugin.class);
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
final Jar sourcesJar = (Jar) project.getTasks().getByName(JavaLibraryPlugin.SOURCES_JAR_TASK);
String basePreviousVersionArtifactPath = getBasePreviousVersionArtifactPath(project, conf, sourcesJar);
final File previousSourcesJar = new File(basePreviousVersionArtifactPath + "-sources.jar");
final CreateDependencyInfoFileTask dependencyInfoTask = TaskMaker.task(project, "createDependencyInfoFile", CreateDependencyInfoFileTask.class, new Action<CreateDependencyInfoFileTask>() {
@Override
public void execute(final CreateDependencyInfoFileTask task) {
task.setDescription("Creates a file with all declared runtime dependencies.");
task.setOutputFile(new File(project.getBuildDir(), DEPENDENCY_INFO_FILENAME));
task.setConfiguration(project.getConfigurations().getByName("runtimeClasspath"));
task.setProjectVersion(project.getVersion().toString());
DeferredConfiguration.deferredConfiguration(project, new Runnable() {
@Override
public void run() {
task.setProjectGroup(project.getGroup().toString());
}
});
}
});
sourcesJar.getMetaInf().from(dependencyInfoTask.getOutputFile());
sourcesJar.dependsOn(dependencyInfoTask);
TaskMaker.task(project, DOWNLOAD_PUBLICATIONS_TASK, DownloadPreviousPublicationsTask.class, new Action<DownloadPreviousPublicationsTask>() {
@Override
public void execute(final DownloadPreviousPublicationsTask t) {
t.setDescription("Downloads artifacts of last released version and stores it locally for comparison");
DeferredConfiguration.deferredConfiguration(project, new Runnable() {
@Override
public void run() {
DefaultArtifactUrlResolver artifactUrlResolver = new DefaultArtifactUrlResolverFactory().getDefaultResolver(project, sourcesJar.getBaseName(), conf.getPreviousReleaseVersion());
String previousVersionSourcesJarUrl = getDefaultIfNull(t.getPreviousSourcesJarUrl(), "previousSourcesJarUrl", "-sources.jar", artifactUrlResolver);
t.setPreviousSourcesJarUrl(previousVersionSourcesJarUrl);
t.setPreviousSourcesJarFile(previousSourcesJar);
}
});
}
});
TaskMaker.task(project, COMPARE_PUBLICATIONS_TASK, ComparePublicationsTask.class, new Action<ComparePublicationsTask>() {
public void execute(final ComparePublicationsTask t) {
t.setDescription("Compares artifacts and poms between last version and the currently built one to see if there are any differences");
t.dependsOn(DOWNLOAD_PUBLICATIONS_TASK);
t.setComparisonResult(new File(project.getBuildDir(), "publications-comparison.txt"));
t.setPreviousSourcesJar(previousSourcesJar);
// Set local sources jar for comparison with previously released
t.compareSourcesJar(sourcesJar);
}
});
}
use of org.shipkit.gradle.configuration.ShipkitConfiguration in project shipkit by mockito.
the class JavaPublishPlugin method apply.
public void apply(final Project project) {
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
project.getPlugins().apply(JavaLibraryPlugin.class);
project.getPlugins().apply("maven-publish");
final Jar sourcesJar = (Jar) project.getTasks().getByName(JavaLibraryPlugin.SOURCES_JAR_TASK);
final Jar javadocJar = (Jar) project.getTasks().getByName(JavaLibraryPlugin.JAVADOC_JAR_TASK);
GradleDSLHelper.publications(project, new Action<PublicationContainer>() {
public void execute(PublicationContainer publications) {
MavenPublication p = publications.create(PUBLICATION_NAME, MavenPublication.class, new Action<MavenPublication>() {
public void execute(MavenPublication publication) {
publication.from(project.getComponents().getByName("java"));
publication.artifact(sourcesJar);
publication.artifact(javadocJar);
publication.setArtifactId(((Jar) project.getTasks().getByName("jar")).getBaseName());
PomCustomizer.customizePom(project, conf, publication);
}
});
LOG.info("{} - configured '{}' publication", project.getPath(), p.getArtifactId());
}
});
// so that we flesh out problems with maven publication during the build process
project.getTasks().getByName("build").dependsOn("publishToMavenLocal");
}
use of org.shipkit.gradle.configuration.ShipkitConfiguration in project shipkit by mockito.
the class ReleaseNotesPlugin method apply.
public void apply(final Project project) {
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
project.getPlugins().apply(VersioningPlugin.class);
project.getPlugins().apply(GitHubContributorsPlugin.class);
releaseNotesTasks(project, conf);
}
Aggregations