Search in sources :

Example 1 with ProjectOutcomes

use of org.gradle.tooling.model.internal.outcomes.ProjectOutcomes in project gradle by gradle.

the class GradleBuildComparison method compare.

public BuildComparisonResult compare(FileStore<String> fileStore, File reportDir, Map<String, String> hostAttributes) {
    String executingSourceBuildMessage = executingMessage("source", sourceBuildExecuter);
    String executingTargetBuildMessage = executingMessage("target", targetBuildExecuter);
    if (!sourceBuildExecuter.isExecutable() || !targetBuildExecuter.isExecutable()) {
        throw new GradleException(String.format("Builds must be executed with %s or newer (source: %s, target: %s)", ComparableGradleBuildExecuter.EXEC_MINIMUM_VERSION, sourceBuildExecuter.getSpec().getGradleVersion(), targetBuildExecuter.getSpec().getGradleVersion()));
    }
    Set<BuildOutcome> sourceOutcomes;
    logger.info(executingSourceBuildMessage);
    progressLogger.started(executingSourceBuildMessage);
    ProjectOutcomes sourceOutput = executeBuild(sourceBuildExecuter);
    progressLogger.progress("inspecting source build outcomes");
    GradleBuildOutcomeSetTransformer sourceOutcomeTransformer = createOutcomeSetTransformer(fileStore, SOURCE_FILESTORE_PREFIX);
    sourceOutcomes = sourceOutcomeTransformer.transform(sourceOutput);
    logger.info(executingTargetBuildMessage);
    progressLogger.progress(executingTargetBuildMessage);
    ProjectOutcomes targetOutput = executeBuild(targetBuildExecuter);
    Set<BuildOutcome> targetOutcomes;
    progressLogger.progress("inspecting target build outcomes");
    GradleBuildOutcomeSetTransformer targetOutcomeTransformer = createOutcomeSetTransformer(fileStore, TARGET_FILESTORE_PREFIX);
    targetOutcomes = targetOutcomeTransformer.transform(targetOutput);
    progressLogger.progress("comparing build outcomes");
    BuildComparisonResult result = compareBuilds(sourceOutcomes, targetOutcomes);
    writeReport(result, reportDir, fileStore, hostAttributes);
    progressLogger.completed();
    return result;
}
Also used : BuildComparisonResult(org.gradle.api.plugins.buildcomparison.compare.internal.BuildComparisonResult) GradleException(org.gradle.api.GradleException) ProjectOutcomes(org.gradle.tooling.model.internal.outcomes.ProjectOutcomes) BuildOutcome(org.gradle.api.plugins.buildcomparison.outcome.internal.BuildOutcome)

Aggregations

GradleException (org.gradle.api.GradleException)1 BuildComparisonResult (org.gradle.api.plugins.buildcomparison.compare.internal.BuildComparisonResult)1 BuildOutcome (org.gradle.api.plugins.buildcomparison.outcome.internal.BuildOutcome)1 ProjectOutcomes (org.gradle.tooling.model.internal.outcomes.ProjectOutcomes)1