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/prebuilt_etc_test.go b/android/prebuilt_etc_test.go
index 3c466a1..6e751e7 100644
--- a/android/prebuilt_etc_test.go
+++ b/android/prebuilt_etc_test.go
@@ -21,7 +21,14 @@
)
func testPrebuiltEtc(t *testing.T, bp string) (*TestContext, Config) {
- config := TestArchConfig(buildDir, nil)
+ fs := map[string][]byte{
+ "foo.conf": nil,
+ "bar.conf": nil,
+ "baz.conf": nil,
+ }
+
+ config := TestArchConfig(buildDir, nil, bp, fs)
+
ctx := NewTestArchContext()
ctx.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory)
ctx.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
@@ -29,14 +36,7 @@
ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
- ctx.Register()
- mockFiles := map[string][]byte{
- "Android.bp": []byte(bp),
- "foo.conf": nil,
- "bar.conf": nil,
- "baz.conf": nil,
- }
- ctx.MockFileSystem(mockFiles)
+ ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
FailIfErrored(t, errs)
_, errs = ctx.PrepareBuildActions(config)