Require scl files in ExecutionModeScl
Also remove json from scl file builtins, as it's not in bazel.
Bug: 309686282
Test: Presubmits
Change-Id: I6227c5dc14922b4682380254b4716b4ae38c47b9
diff --git a/tools/rbcrun/host.go b/tools/rbcrun/host.go
index f36553e..8cd2845 100644
--- a/tools/rbcrun/host.go
+++ b/tools/rbcrun/host.go
@@ -24,7 +24,6 @@
"strings"
"go.starlark.net/starlark"
- "go.starlark.net/starlarkjson"
"go.starlark.net/starlarkstruct"
)
@@ -60,7 +59,6 @@
var sclBuiltins starlark.StringDict = starlark.StringDict{
"struct": starlark.NewBuiltin("struct", starlarkstruct.Make),
- "json": starlarkjson.Module,
}
func isSymlink(filepath string) (bool, error) {
@@ -389,6 +387,10 @@
return nil, nil, err
}
+ if mode == ExecutionModeScl && !strings.HasSuffix(filename, ".scl") {
+ return nil, nil, fmt.Errorf("filename must end in .scl: %s", filename)
+ }
+
// Add top-level file to cache for cycle detection purposes
moduleCache[filename] = nil