本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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());
}