Search in sources :

Example 1 with BlazeCommandRunner

use of com.google.idea.blaze.base.command.BlazeCommandRunner in project intellij by bazelbuild.

the class BlazeIdeInterfaceAspectsImpl method runBuildForTargets.

/**
 * Runs a blaze build for the given output groups.
 */
private static BlazeBuildOutputs runBuildForTargets(Project project, BlazeContext context, WorkspaceRoot workspaceRoot, BlazeBuildParams buildParams, ProjectViewSet viewSet, BlazeInfo blazeInfo, ImmutableSet<LanguageClass> activeLanguages, List<? extends TargetExpression> targets, AspectStrategy aspectStrategy, ImmutableSet<OutputGroup> outputGroups) {
    boolean onlyDirectDeps = viewSet.getScalarValue(AutomaticallyDeriveTargetsSection.KEY).orElse(false);
    try (BuildResultHelper buildResultHelper = BuildResultHelperProvider.create(project, blazeInfo)) {
        BlazeCommand.Builder builder = BlazeCommand.builder(buildParams.blazeBinaryPath(), BlazeCommandName.BUILD);
        builder.addTargets(targets).addBlazeFlags(BlazeFlags.KEEP_GOING).addBlazeFlags(buildResultHelper.getBuildFlags()).addBlazeFlags(BlazeFlags.blazeFlags(project, viewSet, BlazeCommandName.BUILD, BlazeInvocationContext.SYNC_CONTEXT));
        if (disableValidationActionExperiment.getValue()) {
            builder.addBlazeFlags(BlazeFlags.DISABLE_VALIDATIONS);
        }
        aspectStrategy.addAspectAndOutputGroups(builder, outputGroups, activeLanguages, onlyDirectDeps);
        for (BlazeCommandRunner runner : BlazeCommandRunner.EP_NAME.getExtensions()) {
            if (runner.isAvailable(project)) {
                return runner.run(project, builder, buildParams, buildResultHelper, workspaceRoot, context);
            }
        }
        IssueOutput.error("Failed to create build: no blaze command runner found").submit(context);
        return BlazeBuildOutputs.noOutputs(BuildResult.FATAL_ERROR);
    }
}
Also used : BuildResultHelper(com.google.idea.blaze.base.command.buildresult.BuildResultHelper) BlazeCommand(com.google.idea.blaze.base.command.BlazeCommand) BlazeCommandRunner(com.google.idea.blaze.base.command.BlazeCommandRunner)

Aggregations

BlazeCommand (com.google.idea.blaze.base.command.BlazeCommand)1 BlazeCommandRunner (com.google.idea.blaze.base.command.BlazeCommandRunner)1 BuildResultHelper (com.google.idea.blaze.base.command.buildresult.BuildResultHelper)1