Move filesystem into Config
The filesystem object was available through ModuleContext.Fs(), but
gives too much access to the filesystem without enforicing correct
dependencies. In order to support sandboxing the soong_build
process move the filesystem into the Config. The next change will
make it private.
Bug: 146437378
Test: all Soong tests
Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
diff --git a/android/visibility_test.go b/android/visibility_test.go
index 1984a21..fbf2fb7 100644
--- a/android/visibility_test.go
+++ b/android/visibility_test.go
@@ -868,7 +868,7 @@
func testVisibility(buildDir string, fs map[string][]byte) (*TestContext, []error) {
// Create a new config per test as visibility information is stored in the config.
- config := TestArchConfig(buildDir, nil)
+ config := TestArchConfig(buildDir, nil, "", fs)
ctx := NewTestArchContext()
ctx.RegisterModuleType("package", PackageFactory)
@@ -879,9 +879,7 @@
ctx.PreArchMutators(RegisterDefaultsPreArchMutators)
ctx.PreArchMutators(RegisterVisibilityRuleGatherer)
ctx.PostDepsMutators(RegisterVisibilityRuleEnforcer)
- ctx.Register()
-
- ctx.MockFileSystem(fs)
+ ctx.Register(config)
_, errs := ctx.ParseBlueprintsFiles(".")
if len(errs) > 0 {