public abstract class AbstractSkylarkFunctions extends Object
SkylarkBuildModule
and SkylarkPackageModule
.
Note: @SkylarkModule does not support having the same name for multiple classes in Runtime.setupSkylarkLibrary(com.google.common.collect.ImmutableMap.Builder<java.lang.String, java.lang.Object>, java.lang.Object)
and since we want the shared
functions to also be under "native", we must subclass.
Constructor and Description |
---|
AbstractSkylarkFunctions() |
Modifier and Type | Method and Description |
---|---|
Object |
readConfig(String section,
String field,
Object defaultValue,
com.google.devtools.build.lib.syntax.FuncallExpression ast,
com.google.devtools.build.lib.syntax.Environment env)
Exposes a
read_config for Skylark parser. |
public Object readConfig(String section, String field, Object defaultValue, com.google.devtools.build.lib.syntax.FuncallExpression ast, com.google.devtools.build.lib.syntax.Environment env) throws com.google.devtools.build.lib.syntax.EvalException
read_config
for Skylark parser.
This is a temporary solution to simplify migration from Python DSL to Skylark and allows
clients to query values from .buckconfig
files and --config
command line
arguments.
Example, when buck is invoked with --config user.value=my_value
an invocation of
read_config("user", "value", "default_value")
will return my_value
.
com.google.devtools.build.lib.syntax.EvalException