use of org.shipkit.gradle.configuration.ShipkitConfiguration in project shipkit by mockito.
the class GradlePortalPublishPlugin method apply.
@Override
public void apply(final Project project) {
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
project.getPlugins().apply("com.gradle.plugin-publish");
// Above also applies 'java' plugin
final Task publishPlugins = project.getTasks().getByName(PUBLISH_PLUGINS_TASK);
LazyConfiguration.lazyConfiguration(publishPlugins, new Runnable() {
@Override
public void run() {
authenticate(PUBLISH_KEY_PROPERTY, project, PUBLISH_KEY_ENV, envVariables);
authenticate(PUBLISH_SECRET_PROPERTY, project, PUBLISH_SECRET_ENV, envVariables);
}
});
publishPlugins.onlyIf(new Spec<Task>() {
@Override
public boolean isSatisfiedBy(Task t) {
if (conf.isDryRun()) {
LOG.info("dryRun is enabled, skipping '{}' using 'onlyIf'", t.getName());
}
return !conf.isDryRun();
}
});
}
use of org.shipkit.gradle.configuration.ShipkitConfiguration 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());
}
});
}
});
}
use of org.shipkit.gradle.configuration.ShipkitConfiguration in project shipkit by mockito.
the class TestDownstreamPlugin method apply.
public void apply(final Project project) {
IncubatingWarning.warn("downstream-testing plugin");
project.getPlugins().apply(UploadGistsPlugin.class);
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
final File logsDirectory = project.getBuildDir();
final UploadGistsTask uploadGistsTask = (UploadGistsTask) project.getTasks().findByName(UploadGistsPlugin.UPLOAD_GISTS_TASK);
uploadGistsTask.setFilesToUpload((ConfigurableFileTree) project.fileTree(logsDirectory).include("*.log"));
boolean shouldUploadLogs = ciContext.isCiBuild() && !StringUtil.isEmpty(conf.getLenient().getGitHub().getWriteAuthToken());
if (shouldUploadLogs) {
LOG.debug(" Skipping UploadGists task execution -> test-downstream plugin will not send logs to Gist (setting uploadGists.enabled=false)." + " It's only enabled when build is run in CI environment and GH_WRITE_TOKEN env property is set.");
}
uploadGistsTask.setEnabled(shouldUploadLogs);
TaskMaker.task(project, TEST_DOWNSTREAM_TASK, TestDownstreamTask.class, new Action<TestDownstreamTask>() {
@Override
public void execute(TestDownstreamTask task) {
task.setDescription("Runs all downstream tests.");
task.setLogsDirectory(logsDirectory);
task.setUploadGistsTask(uploadGistsTask);
task.setGitHubUrl(conf.getGitHub().getUrl());
}
});
}
use of org.shipkit.gradle.configuration.ShipkitConfiguration in project shipkit by mockito.
the class GitConfigPlugin method apply.
@Override
public void apply(Project project) {
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
TaskMaker.task(project, SET_USER_TASK, ShipkitExecTask.class, new Action<ShipkitExecTask>() {
public void execute(final ShipkitExecTask t) {
t.setDescription("Overwrites local git 'user.name' with a generic name. Intended for CI.");
t.execCommand(ExecCommandFactory.execCommand("Setting git user name", "git", "config", "--local", "user.name", conf.getGit().getUser()));
}
});
TaskMaker.task(project, SET_EMAIL_TASK, ShipkitExecTask.class, new Action<ShipkitExecTask>() {
public void execute(final ShipkitExecTask t) {
t.setDescription("Overwrites local git 'user.email' with a generic email. Intended for CI.");
t.execCommand(ExecCommandFactory.execCommand("Setting git user email", "git", "config", "--local", "user.email", conf.getGit().getEmail()));
}
});
}
use of org.shipkit.gradle.configuration.ShipkitConfiguration in project shipkit by mockito.
the class UpgradeDownstreamPlugin method apply.
@Override
public void apply(final Project project) {
final ShipkitConfiguration conf = project.getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
upgradeDownstreamExtension = project.getExtensions().create("upgradeDownstream", UpgradeDownstreamExtension.class);
final Task performAllUpdates = TaskMaker.task(project, UPGRADE_DOWNSTREAM_TASK, new Action<Task>() {
@Override
public void execute(final Task task) {
task.setDescription("Performs dependency upgrade in all downstream repositories.");
}
});
DeferredConfiguration.deferredConfiguration(project, new Runnable() {
@Override
public void run() {
notNull(upgradeDownstreamExtension.getRepositories(), "'upgradeDownstream.repositories'");
for (String consumerRepositoryName : upgradeDownstreamExtension.getRepositories()) {
Task cloneTask = CloneGitRepositoryTaskFactory.createCloneTask(project, conf.getGitHub().getUrl(), consumerRepositoryName);
Task performUpdate = createProduceUpgradeTask(project, consumerRepositoryName);
performUpdate.dependsOn(cloneTask);
performAllUpdates.dependsOn(performUpdate);
}
}
});
}
Aggregations