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/defaults_test.go b/android/defaults_test.go
index 80980f7..ba607ef 100644
--- a/android/defaults_test.go
+++ b/android/defaults_test.go
@@ -58,19 +58,6 @@
}
func TestDefaultsAllowMissingDependencies(t *testing.T) {
- config := TestConfig(buildDir, nil)
- config.TestProductVariables.Allow_missing_dependencies = proptools.BoolPtr(true)
-
- ctx := NewTestContext()
- ctx.SetAllowMissingDependencies(true)
-
- ctx.RegisterModuleType("test", defaultsTestModuleFactory)
- ctx.RegisterModuleType("defaults", defaultsTestDefaultsFactory)
-
- ctx.PreArchMutators(RegisterDefaultsPreArchMutators)
-
- ctx.Register()
-
bp := `
defaults {
name: "defaults",
@@ -91,9 +78,18 @@
}
`
- ctx.MockFileSystem(map[string][]byte{
- "Android.bp": []byte(bp),
- })
+ config := TestConfig(buildDir, nil, bp, nil)
+ config.TestProductVariables.Allow_missing_dependencies = proptools.BoolPtr(true)
+
+ ctx := NewTestContext()
+ ctx.SetAllowMissingDependencies(true)
+
+ ctx.RegisterModuleType("test", defaultsTestModuleFactory)
+ ctx.RegisterModuleType("defaults", defaultsTestDefaultsFactory)
+
+ ctx.PreArchMutators(RegisterDefaultsPreArchMutators)
+
+ ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
FailIfErrored(t, errs)