bazel syntax: eliminate all but one calls to Runtime.setupStarlarkFunctions
This functionality has moved to class Starlark, in two variants
that reflect the two different intentions of their callers:
- addModule adds a single name to the environment (e.g. attr, native)
- addMethods adds all the methods of a value to the environment (e.g. glob, exports_files, etc)
setupStarlarkFunctions must remain in place temporarily until the last
remaining use, in the copybara code base, is removed. This is trivial but
cannot be done in the same change.
Also, make these CallUtils methods private:
getMethods
getMethodNames (1 overload)
getBuiltinCallable
PiperOrigin-RevId: 279746790
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
index 672fee8..f840c7c 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
@@ -414,9 +414,7 @@
allowReturnNones = true)
public ClassObject proxyMethodsObject() {
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
- for (String nativeFunction : CallUtils.getMethodNames(Mock.class)) {
- builder.put(nativeFunction, CallUtils.getBuiltinCallable(this, nativeFunction));
- }
+ Starlark.addMethods(builder, this);
return StructProvider.STRUCT.create(builder.build(), "no native callable '%s'");
}