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/xml/xml_test.go b/xml/xml_test.go
index 0a11566..f8ec823 100644
--- a/xml/xml_test.go
+++ b/xml/xml_test.go
@@ -48,20 +48,18 @@
}
func testXml(t *testing.T, bp string) *android.TestContext {
- config := android.TestArchConfig(buildDir, nil)
+ fs := map[string][]byte{
+ "foo.xml": nil,
+ "foo.dtd": nil,
+ "bar.xml": nil,
+ "bar.xsd": nil,
+ "baz.xml": nil,
+ }
+ config := android.TestArchConfig(buildDir, nil, bp, fs)
ctx := android.NewTestArchContext()
ctx.RegisterModuleType("prebuilt_etc", android.PrebuiltEtcFactory)
ctx.RegisterModuleType("prebuilt_etc_xml", PrebuiltEtcXmlFactory)
- ctx.Register()
- mockFiles := map[string][]byte{
- "Android.bp": []byte(bp),
- "foo.xml": nil,
- "foo.dtd": nil,
- "bar.xml": nil,
- "bar.xsd": nil,
- "baz.xml": nil,
- }
- ctx.MockFileSystem(mockFiles)
+ ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
android.FailIfErrored(t, errs)
_, errs = ctx.PrepareBuildActions(config)