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/androidmk_test.go b/android/androidmk_test.go
index 940e324..71f8020 100644
--- a/android/androidmk_test.go
+++ b/android/androidmk_test.go
@@ -43,14 +43,6 @@
}
func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testing.T) {
- config := TestConfig(buildDir, nil)
- config.inMake = true // Enable androidmk Singleton
-
- ctx := NewTestContext()
- ctx.RegisterSingletonType("androidmk", AndroidMkSingleton)
- ctx.RegisterModuleType("custom", customModuleFactory)
- ctx.Register()
-
bp := `
custom {
name: "foo",
@@ -60,9 +52,13 @@
}
`
- ctx.MockFileSystem(map[string][]byte{
- "Android.bp": []byte(bp),
- })
+ config := TestConfig(buildDir, nil, bp, nil)
+ config.inMake = true // Enable androidmk Singleton
+
+ ctx := NewTestContext()
+ ctx.RegisterSingletonType("androidmk", AndroidMkSingleton)
+ ctx.RegisterModuleType("custom", customModuleFactory)
+ ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
FailIfErrored(t, errs)