aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2018-03-12 18:06:05 -0700
committerDan Willemsen <dwillemsen@google.com>2018-04-17 10:34:23 -0700
commitcb3bff1b65a696e698ca98a490538d4eb7e18884 (patch)
treea79fcd77cdada2d8f491f87c63280c9ef634ca6f
parent050ca73dbfdd360a209daf93a6f7d059a8705569 (diff)
downloadsoong-cb3bff1b65a696e698ca98a490538d4eb7e18884.tar.gz
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 Merged-In: Iccfb4c912f8e0ee3f620cc1ee00f0cdc5cba7735 (cherry picked from commit 674dc7f7f06dc56edc7e331331d474dcf1bba53d)
-rw-r--r--android/config.go4
-rw-r--r--cc/cc_test.go10
-rw-r--r--java/app_test.go6
-rw-r--r--java/java_test.go2
4 files changed, 13 insertions, 9 deletions
diff --git a/android/config.go b/android/config.go
index e14f42eef..642fa729c 100644
--- a/android/config.go
+++ b/android/config.go
@@ -69,6 +69,9 @@ type config struct {
FileConfigurableOptions
ProductVariables productVariables
+ // Only available on configs created by TestConfig
+ TestProductVariables *productVariables
+
PrimaryBuilder string
ConfigFileName string
ProductVariablesFileName string
@@ -197,6 +200,7 @@ func TestConfig(buildDir string, env map[string]string) Config {
config.deviceConfig = &deviceConfig{
config: config,
}
+ config.TestProductVariables = &config.ProductVariables
if err := config.fromEnv(); err != nil {
panic(err)
diff --git a/cc/cc_test.go b/cc/cc_test.go
index f315b1d7f..a4e253496 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -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 {
t.Helper()
config := android.TestArchConfig(buildDir, nil)
- config.ProductVariables.DeviceVndkVersion = StringPtr("current")
- config.ProductVariables.Platform_vndk_version = StringPtr("VER")
+ config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
+ config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
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 {
t.Helper()
config := android.TestArchConfig(buildDir, nil)
- config.ProductVariables.Platform_vndk_version = StringPtr("VER")
+ config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
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) {
t.Helper()
config := android.TestArchConfig(buildDir, nil)
- config.ProductVariables.DeviceVndkVersion = StringPtr("current")
- config.ProductVariables.Platform_vndk_version = StringPtr("VER")
+ config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
+ config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
ctx := createTestContext(t, config, bp)
diff --git a/java/app_test.go b/java/app_test.go
index d3216bfd2..ba017a183 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -188,12 +188,12 @@ func TestEnforceRRO(t *testing.T) {
for _, testCase := range testEnforceRROTests {
t.Run(testCase.name, func(t *testing.T) {
config := testConfig(nil)
- config.ProductVariables.ResourceOverlays = &resourceOverlays
+ config.TestProductVariables.ResourceOverlays = &resourceOverlays
if testCase.enforceRROTargets != nil {
- config.ProductVariables.EnforceRROTargets = &testCase.enforceRROTargets
+ config.TestProductVariables.EnforceRROTargets = &testCase.enforceRROTargets
}
if testCase.enforceRROExcludedOverlays != nil {
- config.ProductVariables.EnforceRROExcludedOverlays = &testCase.enforceRROExcludedOverlays
+ config.TestProductVariables.EnforceRROExcludedOverlays = &testCase.enforceRROExcludedOverlays
}
ctx := testAppContext(config, bp, fs)
diff --git a/java/java_test.go b/java/java_test.go
index 6ef406f76..015c23314 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -60,7 +60,7 @@ func testConfig(env map[string]string) android.Config {
env["ANDROID_JAVA8_HOME"] = "jdk8"
}
config := android.TestArchConfig(buildDir, env)
- config.ProductVariables.DeviceSystemSdkVersions = &[]string{"14", "15"}
+ config.TestProductVariables.DeviceSystemSdkVersions = &[]string{"14", "15"}
return config
}