Search in sources :

Example 1 with CloneGitRepositoryTask

use of org.shipkit.internal.gradle.git.tasks.CloneGitRepositoryTask in project shipkit by mockito.

the class CloneGitRepositoryTaskFactory method createCloneTask.

/**
 * Creates an instance of CloneGitRepositoryTask for given {@param #consumerRepository} in the root project
 * or returns already existing one.
 */
public static CloneGitRepositoryTask createCloneTask(final Project project, final String gitHubUrl, final String consumerRepository) {
    String taskName = "clone" + repositoryNameToCapitalizedCamelCase(consumerRepository);
    Project taskProject = project.getRootProject();
    CloneGitRepositoryTask alreadyExistingTask = (CloneGitRepositoryTask) taskProject.getTasks().findByName(taskName);
    if (alreadyExistingTask != null) {
        return alreadyExistingTask;
    }
    return TaskMaker.task(taskProject, taskName, CloneGitRepositoryTask.class, new Action<CloneGitRepositoryTask>() {

        @Override
        public void execute(final CloneGitRepositoryTask task) {
            task.setDescription("Clones consumer repo " + consumerRepository + " into a temporary directory.");
            task.setRepositoryUrl(gitHubUrl + "/" + consumerRepository);
            task.setTargetDir(getConsumerRepoCloneDir(project, consumerRepository));
        }
    });
}
Also used : Project(org.gradle.api.Project) CloneGitRepositoryTask(org.shipkit.internal.gradle.git.tasks.CloneGitRepositoryTask)

Example 2 with CloneGitRepositoryTask

use of org.shipkit.internal.gradle.git.tasks.CloneGitRepositoryTask in project shipkit by mockito.

the class TestDownstreamTask method createTasks.

private void createTasks(String gitHubRepoUrl) {
    String repoName = extractRepoNameFromGitHubUrl(gitHubRepoUrl);
    String camelCaseRepoName = repositoryNameToCamelCase(repoName);
    CloneGitRepositoryTask clone = CloneGitRepositoryTaskFactory.createCloneTask(getProject(), gitHubUrl, repoName);
    createRunTestReleaseTask(camelCaseRepoName, clone);
}
Also used : CloneGitRepositoryTask(org.shipkit.internal.gradle.git.tasks.CloneGitRepositoryTask)

Example 3 with CloneGitRepositoryTask

use of org.shipkit.internal.gradle.git.tasks.CloneGitRepositoryTask 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)

Aggregations

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