當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。