Source:
<code>public BlazeCommandResult exec(CommandEnvironment env, OptionsParsingResult options) { BlazeRuntime runtime = env.getRuntime(); List<String> targets = options.getResidue(); BuildRequestOptions buildRequestOptions = options.getOptions(BuildRequestOptions.class); if (!targets.isEmpty()) { if (!buildRequestOptions.buildFile.isEmpty()) { env.getReporter() .handle(Event.error("Command-line target pattern and --build_file cannot both be specified")); return BlazeCommandResult.exitCode(ExitCode.COMMAND_LINE_ERROR); } try (SilentCloseable closeable = Profiler.instance().profile("ProjectFileSupport.getTargets")) { targets = ProjectFileSupport.getTargets(runtime.getProjectFileProvider(), options); } } else if (!buildRequestOptions.buildFile.isEmpty()) { Path residuePath = env.getWorkingDirectory().getRelative(buildRequestOptions.buildFile); try { <START> targets = Lists.newArrayList(FileSystemUtils.readLines(residuePath, StandardCharsets.UTF_8)); <END> } catch (IOException e) { env.getReporter() .handle(Event.error("I/O error reading from " + residuePath.getPathString())); return BlazeCommandResult.exitCode(ExitCode.COMMAND_LINE_ERROR); } } else { env.getReporter() .handle( Event.warn( "Usage: " + runtime.getProductName() + " build <options> <targets>." + "\nInvoke `" + runtime.getProductName() + " help build` for full description of usage and options." + "\nYour request is correct, but requested an empty set of targets." + " Nothing will be built.")); } BuildRequest request; try (SilentCloseable closeable = Profiler.instance().profile("BuildRequest.create")) { request = BuildRequest.create( getClass().getAnnotation(Command.class).name(), options, runtime.getStartupOptionsProvider(), targets, env.getReporter().getOutErr(), env.getCommandId(), env.getCommandStartTime()); } ExitCode exitCode = new BuildTool(env).processRequest(request, null).getExitCondition(); return BlazeCommandResult.exitCode(exitCode); }</code><technical_language>check if targets in files. If this in --query_file oversight..</technical_language>

Target:
public BlazeCommandResult exec(CommandEnvironment env, OptionsParsingResult options) { BlazeRuntime runtime = env.getRuntime(); List<String> targets; try { targets = TargetPatternsHelper.readFrom(env, options); } catch (TargetPatternsHelper.TargetPatternsHelperException e) { env.getReporter() .handle(Event.error(e.getMessage())); return BlazeCommandResult.exitCode(ExitCode.COMMAND_LINE_ERROR); } if (targets.isEmpty()) { env.getReporter() .handle( Event.warn( "Usage: " + runtime.getProductName() + " build <options> <targets>." + "\nInvoke `" + runtime.getProductName() + " help build` for full description of usage and options." + "\nYour request is correct, but requested an empty set of targets." + " Nothing will be built.")); } BuildRequest request; try (SilentCloseable closeable = Profiler.instance().profile("BuildRequest.create")) { request = BuildRequest.create( getClass().getAnnotation(Command.class).name(), options, runtime.getStartupOptionsProvider(), targets, env.getReporter().getOutErr(), env.getCommandId(), env.getCommandStartTime()); } DetailedExitCode detailedExitCode = new BuildTool(env).processRequest(request, null).getDetailedExitCode(); return BlazeCommandResult.detailedExitCode(detailedExitCode); }