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
This commit is contained in:
Colin Cross
2019-12-13 20:41:13 -08:00
parent 572aeed6a4
commit 98be1bb00f
42 changed files with 765 additions and 793 deletions

View File

@@ -327,14 +327,14 @@ func TestClasspath(t *testing.T) {
// Test with legacy javac -source 1.8 -target 1.8
t.Run("Java language level 8", func(t *testing.T) {
config := testConfig(nil)
config := testConfig(nil, bpJava8, nil)
if testcase.unbundled {
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
}
if testcase.pdk {
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
}
ctx := testContext(bpJava8, nil)
ctx := testContext()
run(t, ctx, config)
checkClasspath(t, ctx, true /* isJava8 */)
@@ -350,14 +350,14 @@ func TestClasspath(t *testing.T) {
// Test with default javac -source 9 -target 9
t.Run("Java language level 9", func(t *testing.T) {
config := testConfig(nil)
config := testConfig(nil, bp, nil)
if testcase.unbundled {
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
}
if testcase.pdk {
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
}
ctx := testContext(bp, nil)
ctx := testContext()
run(t, ctx, config)
checkClasspath(t, ctx, false /* isJava8 */)
@@ -373,7 +373,7 @@ func TestClasspath(t *testing.T) {
// Test again with PLATFORM_VERSION_CODENAME=REL, javac -source 8 -target 8
t.Run("REL + Java language level 8", func(t *testing.T) {
config := testConfig(nil)
config := testConfig(nil, bpJava8, nil)
config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("REL")
config.TestProductVariables.Platform_sdk_final = proptools.BoolPtr(true)
@@ -383,7 +383,7 @@ func TestClasspath(t *testing.T) {
if testcase.pdk {
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
}
ctx := testContext(bpJava8, nil)
ctx := testContext()
run(t, ctx, config)
checkClasspath(t, ctx, true /* isJava8 */)
@@ -391,7 +391,7 @@ func TestClasspath(t *testing.T) {
// Test again with PLATFORM_VERSION_CODENAME=REL, javac -source 9 -target 9
t.Run("REL + Java language level 9", func(t *testing.T) {
config := testConfig(nil)
config := testConfig(nil, bp, nil)
config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("REL")
config.TestProductVariables.Platform_sdk_final = proptools.BoolPtr(true)
@@ -401,7 +401,7 @@ func TestClasspath(t *testing.T) {
if testcase.pdk {
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
}
ctx := testContext(bp, nil)
ctx := testContext()
run(t, ctx, config)
checkClasspath(t, ctx, false /* isJava8 */)