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/paths.go b/android/paths.go
index 85c861d..a04dc6b 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -1353,19 +1353,17 @@
type testPathContext struct {
config Config
- fs pathtools.FileSystem
}
-func (x *testPathContext) Fs() pathtools.FileSystem { return x.fs }
+func (x *testPathContext) Fs() pathtools.FileSystem { return x.config.fs }
func (x *testPathContext) Config() Config { return x.config }
func (x *testPathContext) AddNinjaFileDeps(...string) {}
// PathContextForTesting returns a PathContext that can be used in tests, for example to create an OutputPath with
// PathForOutput.
-func PathContextForTesting(config Config, fs map[string][]byte) PathContext {
+func PathContextForTesting(config Config) PathContext {
return &testPathContext{
config: config,
- fs: pathtools.MockFs(fs),
}
}