Expose ProductVariables from TestConfig

In preparation for unexporting ProductVariables, explicitly return a
pointer to the structure from TestConfig / TestArchConfig.

Bug: 76168832
Test: m blueprint_tools
Change-Id: Iccfb4c912f8e0ee3f620cc1ee00f0cdc5cba7735
This commit is contained in:
Dan Willemsen 2018-03-12 18:06:05 -07:00
parent 3fb1faeeb9
commit 674dc7f7f0
4 changed files with 13 additions and 9 deletions

View file

@ -69,6 +69,9 @@ type config struct {
FileConfigurableOptions FileConfigurableOptions
ProductVariables productVariables ProductVariables productVariables
// Only available on configs created by TestConfig
TestProductVariables *productVariables
PrimaryBuilder string PrimaryBuilder string
ConfigFileName string ConfigFileName string
ProductVariablesFileName string ProductVariablesFileName string
@ -197,6 +200,7 @@ func TestConfig(buildDir string, env map[string]string) Config {
config.deviceConfig = &deviceConfig{ config.deviceConfig = &deviceConfig{
config: config, config: config,
} }
config.TestProductVariables = &config.ProductVariables
if err := config.fromEnv(); err != nil { if err := config.fromEnv(); err != nil {
panic(err) panic(err)

View file

@ -188,8 +188,8 @@ func testCcWithConfig(t *testing.T, bp string, config android.Config) *android.T
func testCc(t *testing.T, bp string) *android.TestContext { func testCc(t *testing.T, bp string) *android.TestContext {
t.Helper() t.Helper()
config := android.TestArchConfig(buildDir, nil) config := android.TestArchConfig(buildDir, nil)
config.ProductVariables.DeviceVndkVersion = StringPtr("current") config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.ProductVariables.Platform_vndk_version = StringPtr("VER") config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
return testCcWithConfig(t, bp, config) return testCcWithConfig(t, bp, config)
} }
@ -197,7 +197,7 @@ func testCc(t *testing.T, bp string) *android.TestContext {
func testCcNoVndk(t *testing.T, bp string) *android.TestContext { func testCcNoVndk(t *testing.T, bp string) *android.TestContext {
t.Helper() t.Helper()
config := android.TestArchConfig(buildDir, nil) config := android.TestArchConfig(buildDir, nil)
config.ProductVariables.Platform_vndk_version = StringPtr("VER") config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
return testCcWithConfig(t, bp, config) return testCcWithConfig(t, bp, config)
} }
@ -205,8 +205,8 @@ func testCcNoVndk(t *testing.T, bp string) *android.TestContext {
func testCcError(t *testing.T, pattern string, bp string) { func testCcError(t *testing.T, pattern string, bp string) {
t.Helper() t.Helper()
config := android.TestArchConfig(buildDir, nil) config := android.TestArchConfig(buildDir, nil)
config.ProductVariables.DeviceVndkVersion = StringPtr("current") config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.ProductVariables.Platform_vndk_version = StringPtr("VER") config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
ctx := createTestContext(t, config, bp) ctx := createTestContext(t, config, bp)

View file

@ -188,12 +188,12 @@ func TestEnforceRRO(t *testing.T) {
for _, testCase := range testEnforceRROTests { for _, testCase := range testEnforceRROTests {
t.Run(testCase.name, func(t *testing.T) { t.Run(testCase.name, func(t *testing.T) {
config := testConfig(nil) config := testConfig(nil)
config.ProductVariables.ResourceOverlays = &resourceOverlays config.TestProductVariables.ResourceOverlays = &resourceOverlays
if testCase.enforceRROTargets != nil { if testCase.enforceRROTargets != nil {
config.ProductVariables.EnforceRROTargets = &testCase.enforceRROTargets config.TestProductVariables.EnforceRROTargets = &testCase.enforceRROTargets
} }
if testCase.enforceRROExcludedOverlays != nil { if testCase.enforceRROExcludedOverlays != nil {
config.ProductVariables.EnforceRROExcludedOverlays = &testCase.enforceRROExcludedOverlays config.TestProductVariables.EnforceRROExcludedOverlays = &testCase.enforceRROExcludedOverlays
} }
ctx := testAppContext(config, bp, fs) ctx := testAppContext(config, bp, fs)

View file

@ -60,7 +60,7 @@ func testConfig(env map[string]string) android.Config {
env["ANDROID_JAVA8_HOME"] = "jdk8" env["ANDROID_JAVA8_HOME"] = "jdk8"
} }
config := android.TestArchConfig(buildDir, env) config := android.TestArchConfig(buildDir, env)
config.ProductVariables.DeviceSystemSdkVersions = &[]string{"14", "15"} config.TestProductVariables.DeviceSystemSdkVersions = &[]string{"14", "15"}
return config return config
} }