TestTargetExecutionSettings(
      RuleContext ruleContext,
      RunfilesSupport runfiles,
      Artifact executable,
      Artifact instrumentedFileManifest,
      int shards) {
    Preconditions.checkArgument(TargetUtils.isTestRule(ruleContext.getRule()));
    Preconditions.checkArgument(shards >= 0);
    BuildConfiguration config = ruleContext.getConfiguration();

    List<String> targetArgs = runfiles.getArgs();
    testArguments =
        targetArgs.isEmpty()
            ? config.getTestArguments()
            : ImmutableList.copyOf(Iterables.concat(targetArgs, config.getTestArguments()));

    totalShards = shards;
    runUnder = config.getRunUnder();
    runUnderExecutable = getRunUnderExecutable(ruleContext);

    this.testFilter = config.getTestFilter();
    this.executable = executable;
    this.runfilesManifest = runfiles.getRunfilesManifest();
    this.runfilesInputManifest = runfiles.getRunfilesInputManifest();
    this.instrumentedFileManifest = instrumentedFileManifest;
  }
예제 #2
0
 @Override
 public Label resolve(Rule rule, AttributeMap attributes, BuildConfiguration configuration) {
   RunUnder runUnder = configuration.getRunUnder();
   return runUnder == null ? null : runUnder.getLabel();
 }