summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2024-04-18 21:34:12 +0000
committer Spandan Das <spandandas@google.com> 2024-04-18 22:35:42 +0000
commit7e674e69ef000543e43bed3826c66441512de0d8 (patch)
tree691897406ac8316c18ca020fa6793fef39da1e80
parent17b9a5b8b401c1175eb7b3d4d59882adccf8f425 (diff)
Drop use_source_config_var from prebuilt selection
This CL makes this property a no-op from the perspective of prebuilt selection. The primary user of this was mainline modules, but they have now switched to RELEASE_APEX_CONTRIBUTIONS_* for prebuilt selection, both for internal `main` development and in partner drops. Test: in internal, lunch cf_x86_64_phone-next-userdebug; m nothing; and verified there was a path to the prebuilt bt apex Test: in partner workspace, lunch gsi_partner_arm-ap31-userdebug; m nothing; and verified that there was a path to the prebuilt adservices apex Bug: 308188211 Change-Id: I124a6dada5c20aca4bdebf70dcbe5bbec28cefbe
-rw-r--r--android/prebuilt.go5
-rw-r--r--android/prebuilt_test.go152
-rw-r--r--java/sdk_library_test.go12
3 files changed, 0 insertions, 169 deletions
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 91ba05b6b..2b7b55b5d 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -706,11 +706,6 @@ func (p *Prebuilt) usePrebuilt(ctx BaseMutatorContext, source Module, prebuilt M
return true
}
- // If the use_source_config_var property is set then it overrides the prefer property setting.
- if configVar := p.properties.Use_source_config_var; configVar != nil {
- return !ctx.Config().VendorConfig(proptools.String(configVar.Config_namespace)).Bool(proptools.String(configVar.Var_name))
- }
-
// TODO: use p.Properties.Name and ctx.ModuleDir to override preference
return Bool(p.properties.Prefer)
}
diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go
index 2241b0815..2574ed487 100644
--- a/android/prebuilt_test.go
+++ b/android/prebuilt_test.go
@@ -295,158 +295,6 @@ func TestPrebuilts(t *testing.T) {
}`,
prebuilt: []OsType{Android, buildOS},
},
- {
- name: "prebuilt use_source_config_var={acme, use_source} - no var specified",
- modules: `
- source {
- name: "bar",
- }
-
- prebuilt {
- name: "bar",
- use_source_config_var: {config_namespace: "acme", var_name: "use_source"},
- srcs: ["prebuilt_file"],
- }`,
- // When use_source_env is specified then it will use the prebuilt by default if the environment
- // variable is not set.
- prebuilt: []OsType{Android, buildOS},
- },
- {
- name: "prebuilt use_source_config_var={acme, use_source} - acme_use_source=false",
- modules: `
- source {
- name: "bar",
- }
-
- prebuilt {
- name: "bar",
- use_source_config_var: {config_namespace: "acme", var_name: "use_source"},
- srcs: ["prebuilt_file"],
- }`,
- preparer: FixtureModifyProductVariables(func(variables FixtureProductVariables) {
- variables.VendorVars = map[string]map[string]string{
- "acme": {
- "use_source": "false",
- },
- }
- }),
- // Setting the environment variable named in use_source_env to false will cause the prebuilt to
- // be used.
- prebuilt: []OsType{Android, buildOS},
- },
- {
- name: "apex_contributions supersedes any source preferred via use_source_config_var",
- modules: `
- source {
- name: "bar",
- }
-
- prebuilt {
- name: "bar",
- use_source_config_var: {config_namespace: "acme", var_name: "use_source"},
- srcs: ["prebuilt_file"],
- }
- apex_contributions {
- name: "my_mainline_module_contribution",
- api_domain: "apexfoo",
- // this metadata module contains prebuilt
- contents: ["prebuilt_bar"],
- }
- all_apex_contributions {
- name: "all_apex_contributions",
- }
- `,
- preparer: FixtureModifyProductVariables(func(variables FixtureProductVariables) {
- variables.VendorVars = map[string]map[string]string{
- "acme": {
- "use_source": "true",
- },
- }
- variables.BuildFlags = map[string]string{
- "RELEASE_APEX_CONTRIBUTIONS_ADSERVICES": "my_mainline_module_contribution",
- }
- }),
- // use_source_config_var indicates that source should be used
- // but this is superseded by `my_mainline_module_contribution`
- prebuilt: []OsType{Android, buildOS},
- },
- {
- name: "apex_contributions supersedes any prebuilt preferred via use_source_config_var",
- modules: `
- source {
- name: "bar",
- }
-
- prebuilt {
- name: "bar",
- use_source_config_var: {config_namespace: "acme", var_name: "use_source"},
- srcs: ["prebuilt_file"],
- }
- apex_contributions {
- name: "my_mainline_module_contribution",
- api_domain: "apexfoo",
- // this metadata module contains source
- contents: ["bar"],
- }
- all_apex_contributions {
- name: "all_apex_contributions",
- }
- `,
- preparer: FixtureModifyProductVariables(func(variables FixtureProductVariables) {
- variables.VendorVars = map[string]map[string]string{
- "acme": {
- "use_source": "false",
- },
- }
- variables.BuildFlags = map[string]string{
- "RELEASE_APEX_CONTRIBUTIONS_ADSERVICES": "my_mainline_module_contribution",
- }
- }),
- // use_source_config_var indicates that prebuilt should be used
- // but this is superseded by `my_mainline_module_contribution`
- prebuilt: nil,
- },
- {
- name: "prebuilt use_source_config_var={acme, use_source} - acme_use_source=true",
- modules: `
- source {
- name: "bar",
- }
-
- prebuilt {
- name: "bar",
- use_source_config_var: {config_namespace: "acme", var_name: "use_source"},
- srcs: ["prebuilt_file"],
- }`,
- preparer: FixtureModifyProductVariables(func(variables FixtureProductVariables) {
- variables.VendorVars = map[string]map[string]string{
- "acme": {
- "use_source": "true",
- },
- }
- }),
- // Setting the environment variable named in use_source_env to true will cause the source to be
- // used.
- prebuilt: nil,
- },
- {
- name: "prebuilt use_source_config_var={acme, use_source} - acme_use_source=true, no source",
- modules: `
- prebuilt {
- name: "bar",
- use_source_config_var: {config_namespace: "acme", var_name: "use_source"},
- srcs: ["prebuilt_file"],
- }`,
- preparer: FixtureModifyProductVariables(func(variables FixtureProductVariables) {
- variables.VendorVars = map[string]map[string]string{
- "acme": {
- "use_source": "true",
- },
- }
- }),
- // Although the environment variable says to use source there is no source available.
- prebuilt: []OsType{Android, buildOS},
- },
}
fs := MockFS{
diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go
index 5fac2556d..0f163e6e0 100644
--- a/java/sdk_library_test.go
+++ b/java/sdk_library_test.go
@@ -1085,18 +1085,6 @@ func TestJavaSdkLibraryImport_Preferred(t *testing.T) {
t.Run("prefer", func(t *testing.T) {
testJavaSdkLibraryImport_Preferred(t, "prefer: true,", android.NullFixturePreparer)
})
-
- t.Run("use_source_config_var", func(t *testing.T) {
- testJavaSdkLibraryImport_Preferred(t,
- "use_source_config_var: {config_namespace: \"acme\", var_name: \"use_source\"},",
- android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
- variables.VendorVars = map[string]map[string]string{
- "acme": {
- "use_source": "false",
- },
- }
- }))
- })
}
// If a module is listed in `mainline_module_contributions, it should be used