当前位置: 首页>>代码示例>>Java>>正文


Java SpawnInfo类代码示例

本文整理汇总了Java中com.google.devtools.build.lib.actions.extra.SpawnInfo的典型用法代码示例。如果您正苦于以下问题:Java SpawnInfo类的具体用法?Java SpawnInfo怎么用?Java SpawnInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SpawnInfo类属于com.google.devtools.build.lib.actions.extra包,在下文中一共展示了SpawnInfo类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSourceFiles

import com.google.devtools.build.lib.actions.extra.SpawnInfo; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static Collection<String> getSourceFiles(String extraActionFile) {

  ExtraActionInfo info = ExtraActionUtils.getExtraActionInfo(extraActionFile);
  SpawnInfo spawnInfo = info.getExtension(SpawnInfo.spawnInfo);

  return Collections2.filter(spawnInfo.getInputFileList(),
      Predicates.and(
        Predicates.or(
          Predicates.containsPattern(".*/src/.+\\.py[c]{0,1}$"),
          Predicates.containsPattern("^heronpy/.+\\.py[c]{0,1}$")
        ),
          Predicates.not(Predicates.containsPattern("third_party/")),
          Predicates.not(Predicates.containsPattern("integration_test/"))
      )
  );
}
 
开发者ID:twitter,项目名称:heron,代码行数:18,代码来源:PythonCheckstyle.java

示例2: getExtraActionSpawnInfo

import com.google.devtools.build.lib.actions.extra.SpawnInfo; //导入依赖的package包/类
/**
 * Returns information about this spawn action for use by the extra action mechanism.
 *
 * <p>Subclasses of SpawnAction may override this in order to provide action-specific behaviour.
 * This can be necessary, for example, when the action discovers inputs.
 */
protected SpawnInfo getExtraActionSpawnInfo() throws CommandLineExpansionException {
  SpawnInfo.Builder info = SpawnInfo.newBuilder();
  Spawn spawn = getSpawn();
  info.addAllArgument(spawn.getArguments());
  for (Map.Entry<String, String> variable : spawn.getEnvironment().entrySet()) {
    info.addVariable(
        EnvironmentVariable.newBuilder()
            .setName(variable.getKey())
            .setValue(variable.getValue())
            .build());
  }
  for (ActionInput input : spawn.getInputFiles()) {
    // Explicitly ignore middleman artifacts here.
    if (!(input instanceof Artifact) || !((Artifact) input).isMiddlemanArtifact()) {
      info.addInputFile(input.getExecPathString());
    }
  }
  info.addAllOutputFile(ActionInputHelper.toExecPaths(spawn.getOutputFiles()));
  return info.build();
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:27,代码来源:SpawnAction.java

示例3: testExtraActionInfo

import com.google.devtools.build.lib.actions.extra.SpawnInfo; //导入依赖的package包/类
@Test
public void testExtraActionInfo() throws Exception {
  SpawnAction action = createCopyFromWelcomeToDestination(ImmutableMap.<String, String>of());
  ExtraActionInfo info = action.getExtraActionInfo(actionKeyContext).build();
  assertThat(info.getMnemonic()).isEqualTo("Dummy");

  SpawnInfo spawnInfo = info.getExtension(SpawnInfo.spawnInfo);
  assertThat(spawnInfo).isNotNull();

  assertThat(spawnInfo.getArgumentList())
      .containsExactlyElementsIn(action.getArguments());

  Iterable<String> inputPaths = Artifact.toExecPaths(
      action.getInputs());
  Iterable<String> outputPaths = Artifact.toExecPaths(
      action.getOutputs());

  assertThat(spawnInfo.getInputFileList()).containsExactlyElementsIn(inputPaths);
  assertThat(spawnInfo.getOutputFileList()).containsExactlyElementsIn(outputPaths);
  Map<String, String> environment = action.getEnvironment();
  assertThat(spawnInfo.getVariableCount()).isEqualTo(environment.size());

  for (EnvironmentVariable variable : spawnInfo.getVariableList()) {
    assertThat(environment).containsEntry(variable.getName(), variable.getValue());
  }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:27,代码来源:SpawnActionTest.java

示例4: testExtraActionInfoEnvironmentVariables

import com.google.devtools.build.lib.actions.extra.SpawnInfo; //导入依赖的package包/类
/**
 * Test that environment variables are not escaped or quoted.
 */
@Test
public void testExtraActionInfoEnvironmentVariables() throws Exception {
  Map<String, String> env = ImmutableMap.of(
      "P1", "simple",
      "P2", "spaces are not escaped",
      "P3", ":",
      "P4", "",
      "NONSENSE VARIABLE", "value"
  );

  SpawnInfo spawnInfo =
      createCopyFromWelcomeToDestination(env)
          .getExtraActionInfo(actionKeyContext)
          .build()
          .getExtension(SpawnInfo.spawnInfo);
  assertThat(env).hasSize(spawnInfo.getVariableCount());
  for (EnvironmentVariable variable : spawnInfo.getVariableList()) {
    assertThat(env).containsEntry(variable.getName(), variable.getValue());
  }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:24,代码来源:SpawnActionTest.java

示例5: getSourceFiles

import com.google.devtools.build.lib.actions.extra.SpawnInfo; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static Collection<String> getSourceFiles(String extraActionFile) {

  ExtraActionInfo info = ExtraActionUtils.getExtraActionInfo(extraActionFile);
  SpawnInfo spawnInfo = info.getExtension(SpawnInfo.spawnInfo);

  return Collections2.filter(spawnInfo.getInputFileList(),
      Predicates.and(
          Predicates.containsPattern(".*/src/.+\\.py[c]{0,1}$"),
          Predicates.not(Predicates.containsPattern("third_party/"))
      )
  );
}
 
开发者ID:DSC-SPIDAL,项目名称:twister2,代码行数:14,代码来源:PythonCheckstyle.java

示例6: getExtraActionInfo

import com.google.devtools.build.lib.actions.extra.SpawnInfo; //导入依赖的package包/类
@Override
public ExtraActionInfo.Builder getExtraActionInfo(ActionKeyContext actionKeyContext)
    throws CommandLineExpansionException {
  ExtraActionInfo.Builder builder = super.getExtraActionInfo(actionKeyContext);
  if (extraActionInfoSupplier == null) {
    SpawnInfo spawnInfo = getExtraActionSpawnInfo();
    return builder
        .setExtension(SpawnInfo.spawnInfo, spawnInfo);
  } else {
    extraActionInfoSupplier.extend(builder);
    return builder;
  }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:14,代码来源:SpawnAction.java

示例7: doNothing

import com.google.devtools.build.lib.actions.extra.SpawnInfo; //导入依赖的package包/类
@SkylarkCallable(
    name = "do_nothing",
    doc =
        "Creates an empty action that neither executes a command nor produces any "
            + "output, but that is useful for inserting 'extra actions'.",
    parameters = {
        @Param(
            name = "mnemonic",
            type = String.class,
            named = true,
            positional = false,
            doc = "A one-word description of the action, for example, CppCompile or GoLink."
        ),
        @Param(
            name = "inputs",
            allowedTypes = {
                @ParamType(type = SkylarkList.class),
                @ParamType(type = SkylarkNestedSet.class),
            },
            generic1 = Artifact.class,
            named = true,
            positional = false,
            defaultValue = "[]",
            doc = "List of the input files of the action."
        ),
    }
)
public void doNothing(String mnemonic, Object inputs) throws EvalException {
  context.checkMutable("actions.do_nothing");
  NestedSet<Artifact> inputSet = inputs instanceof SkylarkNestedSet
      ? ((SkylarkNestedSet) inputs).getSet(Artifact.class)
      : NestedSetBuilder.<Artifact>compileOrder()
          .addAll(((SkylarkList) inputs).getContents(Artifact.class, "inputs"))
          .build();
  Action action =
      new PseudoAction<>(
          UUID.nameUUIDFromBytes(
              String.format("empty action %s", ruleContext.getLabel())
                  .getBytes(StandardCharsets.UTF_8)),
          ruleContext.getActionOwner(),
          inputSet,
          ImmutableList.of(PseudoAction.getDummyOutput(ruleContext)),
          mnemonic,
          SpawnInfo.spawnInfo,
          SpawnInfo.newBuilder().build());
  ruleContext.registerAction(action);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:48,代码来源:SkylarkActionFactory.java


注:本文中的com.google.devtools.build.lib.actions.extra.SpawnInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。