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


Java Environment.checkLoadingOrWorkspacePhase方法代码示例

本文整理汇总了Java中com.google.devtools.build.lib.syntax.Environment.checkLoadingOrWorkspacePhase方法的典型用法代码示例。如果您正苦于以下问题:Java Environment.checkLoadingOrWorkspacePhase方法的具体用法?Java Environment.checkLoadingOrWorkspacePhase怎么用?Java Environment.checkLoadingOrWorkspacePhase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.devtools.build.lib.syntax.Environment的用法示例。


在下文中一共展示了Environment.checkLoadingOrWorkspacePhase方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: invoke

import com.google.devtools.build.lib.syntax.Environment; //导入方法依赖的package包/类
public Descriptor invoke(
    Integer defaultInt,
    String doc,
    Boolean mandatory,
    SkylarkList<?> values,
    FuncallExpression ast,
    Environment env)
    throws EvalException {
  // TODO(bazel-team): Replace literal strings with constants.
  env.checkLoadingOrWorkspacePhase("attr.int", ast.getLocation());
  return createAttrDescriptor(
      getName(),
      EvalUtils.<String, Object>optionMap(
          env, DEFAULT_ARG, defaultInt, MANDATORY_ARG, mandatory, VALUES_ARG, values),
      Type.INTEGER,
      ast,
      env);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:19,代码来源:SkylarkAttr.java

示例2: invoke

import com.google.devtools.build.lib.syntax.Environment; //导入方法依赖的package包/类
public Object invoke(String name, FuncallExpression ast, Environment env)
    throws EvalException, InterruptedException {
  env.checkLoadingOrWorkspacePhase("native.existing_rule", ast.getLocation());
  SkylarkDict<String, Object> rule = PackageFactory.callGetRuleFunction(name, ast, env);
  if (rule != null) {
    return rule;
  }

  return Runtime.NONE;
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:11,代码来源:SkylarkNativeModule.java

示例3: invoke

import com.google.devtools.build.lib.syntax.Environment; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "unused"})
public Runtime.NoneType invoke(
    Map<String, Object> kwargs, FuncallExpression ast, Environment env)
    throws EvalException, InterruptedException {
  env.checkLoadingOrWorkspacePhase(ruleClassName, ast.getLocation());
  try {
    addRule(getContext(env, ast), kwargs, ast, env);
  } catch (RuleFactory.InvalidRuleException | Package.NameConflictException e) {
    throw new EvalException(ast.getLocation(), e.getMessage());
  }
  return Runtime.NONE;
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:13,代码来源:PackageFactory.java

示例4: invoke

import com.google.devtools.build.lib.syntax.Environment; //导入方法依赖的package包/类
@SuppressWarnings({"rawtypes", "unchecked"}) // castMap produces
// an Attribute.Builder instead of a Attribute.Builder<?> but it's OK.
public BaseFunction invoke(
    BaseFunction implementation,
    Boolean test,
    Object attrs,
    Object implicitOutputs,
    Boolean executable,
    Boolean outputToGenfiles,
    SkylarkList fragments,
    SkylarkList hostFragments,
    Boolean skylarkTestable,
    SkylarkList<String> toolchains,
    String doc,
    FuncallExpression ast,
    Environment funcallEnv)
    throws EvalException, ConversionException {
  funcallEnv.checkLoadingOrWorkspacePhase("rule", ast.getLocation());
  RuleClassType type = test ? RuleClassType.TEST : RuleClassType.NORMAL;
  RuleClass parent =
      test
          ? getTestBaseRule(SkylarkUtils.getToolsRepository(funcallEnv),
              (PatchTransition) SkylarkUtils.getLipoDataTransition(funcallEnv))
          : (executable ? binaryBaseRule : baseRule);

  // We'll set the name later, pass the empty string for now.
  RuleClass.Builder builder = new RuleClass.Builder("", type, true, parent);
  ImmutableList<Pair<String, SkylarkAttr.Descriptor>> attributes =
      attrObjectToAttributesList(attrs, ast);

  if (skylarkTestable) {
    builder.setSkylarkTestable();
  }

  if (executable || test) {
    addAttribute(
        ast.getLocation(),
        builder,
        attr("$is_executable", BOOLEAN)
            .value(true)
            .nonconfigurable("Called from RunCommand.isExecutable, which takes a Target")
            .build());
    builder.setExecutableSkylark();
  }

  if (implicitOutputs != Runtime.NONE) {
    if (implicitOutputs instanceof BaseFunction) {
      BaseFunction func = (BaseFunction) implicitOutputs;
      SkylarkCallbackFunction callback =
          new SkylarkCallbackFunction(func, ast, funcallEnv.getSemantics());
      builder.setImplicitOutputsFunction(
          new SkylarkImplicitOutputsFunctionWithCallback(callback, ast.getLocation()));
    } else {
      builder.setImplicitOutputsFunction(
          new SkylarkImplicitOutputsFunctionWithMap(
              ImmutableMap.copyOf(
                  castMap(
                      implicitOutputs,
                      String.class,
                      String.class,
                      "implicit outputs of the rule class"))));
    }
  }

  if (outputToGenfiles) {
    builder.setOutputToGenfiles();
  }

  builder.requiresConfigurationFragmentsBySkylarkModuleName(
      fragments.getContents(String.class, "fragments"));
  ConfigAwareRuleClassBuilder.of(builder)
      .requiresHostConfigurationFragmentsBySkylarkModuleName(
          hostFragments.getContents(String.class, "host_fragments"));
  builder.setConfiguredTargetFunction(implementation);
  builder.setRuleDefinitionEnvironment(funcallEnv);
  builder.addRequiredToolchains(collectToolchainLabels(toolchains, ast));

  return new SkylarkRuleFunction(builder, type, attributes, ast.getLocation());
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:80,代码来源:SkylarkRuleClassFunctions.java


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