Search in sources :

Example 1 with UploadGistsTask

use of org.shipkit.internal.gradle.release.tasks.UploadGistsTask 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());
        }
    });
}
Also used : ShipkitConfiguration(org.shipkit.gradle.configuration.ShipkitConfiguration) ShipkitConfigurationPlugin(org.shipkit.internal.gradle.configuration.ShipkitConfigurationPlugin) UploadGistsTask(org.shipkit.internal.gradle.release.tasks.UploadGistsTask)

Example 2 with UploadGistsTask

use of org.shipkit.internal.gradle.release.tasks.UploadGistsTask in project shipkit by mockito.

the class TestDownstreamTask method createRunTestReleaseTask.

private void createRunTestReleaseTask(final String camelCaseRepoName, CloneGitRepositoryTask copy) {
    final File buildOutputFile = new File(logsDirectory, camelCaseRepoName + "-build.log");
    SilentExecTask run = getProject().getTasks().create("test" + capitalize(camelCaseRepoName), SilentExecTask.class);
    run.dependsOn(copy);
    run.finalizedBy(uploadGistsTask);
    run.setWorkDir(copy.getTargetDir());
    dependsOn(run);
    // Using Gradle's composite builds ("--include-build") so that we're picking up current version of tools
    run.setCommand(asList("./gradlew", "releaseNeeded", "performRelease", "releaseCleanUp", "-PdryRun", "-x", "gitPush", "-x", "bintrayUpload", "--include-build", getProject().getRootDir().getAbsolutePath(), "-s"));
    // Build log in separate file instead of including it in the console of the parent build
    // Otherwise the output will be really messy
    run.setBuildOutputFile(buildOutputFile);
    run.doFirst(new Action<Task>() {

        @Override
        public void execute(Task task) {
            LOG.lifecycle(testDownstreamLogMessage(camelCaseRepoName, buildOutputFile, uploadGistsTask.isEnabled(), uploadGistsTask.getName()));
        }
    });
}
Also used : SilentExecTask(org.shipkit.internal.exec.SilentExecTask) UploadGistsTask(org.shipkit.internal.gradle.release.tasks.UploadGistsTask) Task(org.gradle.api.Task) DefaultTask(org.gradle.api.DefaultTask) CloneGitRepositoryTask(org.shipkit.internal.gradle.git.tasks.CloneGitRepositoryTask) File(java.io.File) SilentExecTask(org.shipkit.internal.exec.SilentExecTask)

Example 3 with UploadGistsTask

use of org.shipkit.internal.gradle.release.tasks.UploadGistsTask 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());
        }
    });
}
Also used : ShipkitConfiguration(org.shipkit.gradle.configuration.ShipkitConfiguration) ShipkitConfigurationPlugin(org.shipkit.internal.gradle.configuration.ShipkitConfigurationPlugin) File(java.io.File) UploadGistsTask(org.shipkit.internal.gradle.release.tasks.UploadGistsTask)

Aggregations

UploadGistsTask (org.shipkit.internal.gradle.release.tasks.UploadGistsTask)3 File (java.io.File)2 ShipkitConfiguration (org.shipkit.gradle.configuration.ShipkitConfiguration)2 ShipkitConfigurationPlugin (org.shipkit.internal.gradle.configuration.ShipkitConfigurationPlugin)2 DefaultTask (org.gradle.api.DefaultTask)1 Task (org.gradle.api.Task)1 SilentExecTask (org.shipkit.internal.exec.SilentExecTask)1 CloneGitRepositoryTask (org.shipkit.internal.gradle.git.tasks.CloneGitRepositoryTask)1