Merge "Drop use_source_config_var from prebuilt selection" into main
This commit is contained in:
commit
2182c08f3e
3 changed files with 0 additions and 169 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue