Add ctx to AndroidMkExtraEntriesFunc

Add a ctx parameter to AndroidMkExtraEntriesFunc to allow them to
access providers.

Test: m checkbuild
Change-Id: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
Merged-In: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
This commit is contained in:
Colin Cross 2020-07-03 13:18:24 -07:00
parent a6cfcac727
commit aa2555387d
27 changed files with 238 additions and 203 deletions

View File

@ -141,7 +141,20 @@ type AndroidMkEntries struct {
entryOrder []string entryOrder []string
} }
type AndroidMkExtraEntriesFunc func(entries *AndroidMkEntries) type AndroidMkExtraEntriesContext interface {
Provider(provider blueprint.ProviderKey) interface{}
}
type androidMkExtraEntriesContext struct {
ctx fillInEntriesContext
mod blueprint.Module
}
func (a *androidMkExtraEntriesContext) Provider(provider blueprint.ProviderKey) interface{} {
return a.ctx.ModuleProvider(a.mod, provider)
}
type AndroidMkExtraEntriesFunc func(ctx AndroidMkExtraEntriesContext, entries *AndroidMkEntries)
type AndroidMkExtraFootersFunc func(w io.Writer, name, prefix, moduleDir string) type AndroidMkExtraFootersFunc func(w io.Writer, name, prefix, moduleDir string)
// Utility funcs to manipulate Android.mk variable entries. // Utility funcs to manipulate Android.mk variable entries.
@ -448,7 +461,13 @@ func (a *AndroidMkEntries) WriteLicenseVariables(w io.Writer) {
// fillInEntries goes through the common variable processing and calls the extra data funcs to // fillInEntries goes through the common variable processing and calls the extra data funcs to
// generate and fill in AndroidMkEntries's in-struct data, ready to be flushed to a file. // generate and fill in AndroidMkEntries's in-struct data, ready to be flushed to a file.
func (a *AndroidMkEntries) fillInEntries(config Config, bpPath string, mod blueprint.Module) { type fillInEntriesContext interface {
ModuleDir(module blueprint.Module) string
Config() Config
ModuleProvider(module blueprint.Module, provider blueprint.ProviderKey) interface{}
}
func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint.Module) {
a.EntryMap = make(map[string][]string) a.EntryMap = make(map[string][]string)
amod := mod.(Module).base() amod := mod.(Module).base()
name := amod.BaseModuleName() name := amod.BaseModuleName()
@ -470,7 +489,7 @@ func (a *AndroidMkEntries) fillInEntries(config Config, bpPath string, mod bluep
fmt.Fprintln(&a.header, "\ninclude $(CLEAR_VARS)") fmt.Fprintln(&a.header, "\ninclude $(CLEAR_VARS)")
// Collect make variable assignment entries. // Collect make variable assignment entries.
a.SetString("LOCAL_PATH", filepath.Dir(bpPath)) a.SetString("LOCAL_PATH", ctx.ModuleDir(mod))
a.SetString("LOCAL_MODULE", name+a.SubName) a.SetString("LOCAL_MODULE", name+a.SubName)
a.AddStrings("LOCAL_LICENSE_KINDS", amod.commonProperties.Effective_license_kinds...) a.AddStrings("LOCAL_LICENSE_KINDS", amod.commonProperties.Effective_license_kinds...)
a.AddStrings("LOCAL_LICENSE_CONDITIONS", amod.commonProperties.Effective_license_conditions...) a.AddStrings("LOCAL_LICENSE_CONDITIONS", amod.commonProperties.Effective_license_conditions...)
@ -561,17 +580,23 @@ func (a *AndroidMkEntries) fillInEntries(config Config, bpPath string, mod bluep
} }
if amod.Arch().ArchType != config.Targets[amod.Os()][0].Arch.ArchType { if amod.Arch().ArchType != ctx.Config().Targets[amod.Os()][0].Arch.ArchType {
prefix = "2ND_" + prefix prefix = "2ND_" + prefix
} }
} }
extraCtx := &androidMkExtraEntriesContext{
ctx: ctx,
mod: mod,
}
for _, extra := range a.ExtraEntries { for _, extra := range a.ExtraEntries {
extra(a) extra(extraCtx, a)
} }
// Write to footer. // Write to footer.
fmt.Fprintln(&a.footer, "include "+a.Include) fmt.Fprintln(&a.footer, "include "+a.Include)
blueprintDir := filepath.Dir(bpPath) blueprintDir := ctx.ModuleDir(mod)
for _, footerFunc := range a.ExtraFooters { for _, footerFunc := range a.ExtraFooters {
footerFunc(&a.footer, name, prefix, blueprintDir) footerFunc(&a.footer, name, prefix, blueprintDir)
} }
@ -732,7 +757,7 @@ func translateGoBinaryModule(ctx SingletonContext, w io.Writer, mod blueprint.Mo
return nil return nil
} }
func (data *AndroidMkData) fillInData(config Config, bpPath string, mod blueprint.Module) { func (data *AndroidMkData) fillInData(ctx fillInEntriesContext, mod blueprint.Module) {
// Get the preamble content through AndroidMkEntries logic. // Get the preamble content through AndroidMkEntries logic.
data.Entries = AndroidMkEntries{ data.Entries = AndroidMkEntries{
Class: data.Class, Class: data.Class,
@ -745,7 +770,7 @@ func (data *AndroidMkData) fillInData(config Config, bpPath string, mod blueprin
Host_required: data.Host_required, Host_required: data.Host_required,
Target_required: data.Target_required, Target_required: data.Target_required,
} }
data.Entries.fillInEntries(config, bpPath, mod) data.Entries.fillInEntries(ctx, mod)
// copy entries back to data since it is used in Custom // copy entries back to data since it is used in Custom
data.Required = data.Entries.Required data.Required = data.Entries.Required
@ -768,7 +793,7 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, mod blueprint.Mod
data.Include = "$(BUILD_PREBUILT)" data.Include = "$(BUILD_PREBUILT)"
} }
data.fillInData(ctx.Config(), ctx.BlueprintFile(mod), mod) data.fillInData(ctx, mod)
prefix := "" prefix := ""
if amod.ArchSpecific() { if amod.ArchSpecific() {
@ -795,7 +820,7 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, mod blueprint.Mod
if data.Custom != nil { if data.Custom != nil {
// List of module types allowed to use .Custom(...) // List of module types allowed to use .Custom(...)
// Additions to the list require careful review for proper license handling. // Additions to the list require careful review for proper license handling.
switch reflect.TypeOf(mod).String() { // ctx.ModuleType(mod) doesn't work: aidl_interface creates phony without type switch reflect.TypeOf(mod).String() { // ctx.ModuleType(mod) doesn't work: aidl_interface creates phony without type
case "*aidl.aidlApi": // writes non-custom before adding .phony case "*aidl.aidlApi": // writes non-custom before adding .phony
case "*aidl.aidlMapping": // writes non-custom before adding .phony case "*aidl.aidlMapping": // writes non-custom before adding .phony
case "*android.customModule": // appears in tests only case "*android.customModule": // appears in tests only
@ -850,7 +875,7 @@ func translateAndroidMkEntriesModule(ctx SingletonContext, w io.Writer, mod blue
// Any new or special cases here need review to verify correct propagation of license information. // Any new or special cases here need review to verify correct propagation of license information.
for _, entries := range provider.AndroidMkEntries() { for _, entries := range provider.AndroidMkEntries() {
entries.fillInEntries(ctx.Config(), ctx.BlueprintFile(mod), mod) entries.fillInEntries(ctx, mod)
entries.write(w) entries.write(w)
} }

View File

@ -137,9 +137,9 @@ func customModuleFactory() Module {
return module return module
} }
// buildConfigAndCustomModuleFoo creates a config object, processes the supplied // buildContextAndCustomModuleFoo creates a config object, processes the supplied
// bp module and then returns the config and the custom module called "foo". // bp module and then returns the config and the custom module called "foo".
func buildConfigAndCustomModuleFoo(t *testing.T, bp string) (Config, *customModule) { func buildContextAndCustomModuleFoo(t *testing.T, bp string) (*TestContext, *customModule) {
t.Helper() t.Helper()
config := TestConfig(buildDir, nil, bp, nil) config := TestConfig(buildDir, nil, bp, nil)
config.katiEnabled = true // Enable androidmk Singleton config.katiEnabled = true // Enable androidmk Singleton
@ -155,7 +155,7 @@ func buildConfigAndCustomModuleFoo(t *testing.T, bp string) (Config, *customModu
FailIfErrored(t, errs) FailIfErrored(t, errs)
module := ctx.ModuleForTests("foo", "").Module().(*customModule) module := ctx.ModuleForTests("foo", "").Module().(*customModule)
return config, module return ctx, module
} }
func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testing.T) { func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testing.T) {
@ -168,7 +168,7 @@ func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testin
} }
` `
_, m := buildConfigAndCustomModuleFoo(t, bp) _, m := buildContextAndCustomModuleFoo(t, bp)
assertEqual := func(expected interface{}, actual interface{}) { assertEqual := func(expected interface{}, actual interface{}) {
if !reflect.DeepEqual(expected, actual) { if !reflect.DeepEqual(expected, actual) {
@ -253,8 +253,8 @@ func TestGetDistForGoals(t *testing.T) {
"$(call dist-for-goals,my_goal my_other_goal,three/four.out:four.out)\n", "$(call dist-for-goals,my_goal my_other_goal,three/four.out:four.out)\n",
} }
config, module := buildConfigAndCustomModuleFoo(t, bp) ctx, module := buildContextAndCustomModuleFoo(t, bp)
entries := AndroidMkEntriesForTest(t, config, "", module) entries := AndroidMkEntriesForTest(t, ctx, module)
if len(entries) != 1 { if len(entries) != 1 {
t.Errorf("Expected a single AndroidMk entry, got %d", len(entries)) t.Errorf("Expected a single AndroidMk entry, got %d", len(entries))
} }
@ -343,8 +343,8 @@ func TestGetDistContributions(t *testing.T) {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
t.Helper() t.Helper()
config, module := buildConfigAndCustomModuleFoo(t, bp) ctx, module := buildContextAndCustomModuleFoo(t, bp)
entries := AndroidMkEntriesForTest(t, config, "", module) entries := AndroidMkEntriesForTest(t, ctx, module)
if len(entries) != 1 { if len(entries) != 1 {
t.Errorf("Expected a single AndroidMk entry, got %d", len(entries)) t.Errorf("Expected a single AndroidMk entry, got %d", len(entries))
} }

View File

@ -40,7 +40,7 @@ func (me *CSuiteConfig) AndroidMkEntries() []AndroidMkEntries {
OutputFile: OptionalPathForPath(me.OutputFilePath), OutputFile: OptionalPathForPath(me.OutputFilePath),
} }
androidMkEntries.ExtraEntries = []AndroidMkExtraEntriesFunc{ androidMkEntries.ExtraEntries = []AndroidMkExtraEntriesFunc{
func(entries *AndroidMkEntries) { func(ctx AndroidMkExtraEntriesContext, entries *AndroidMkEntries) {
if me.properties.Test_config != nil { if me.properties.Test_config != nil {
entries.SetString("LOCAL_TEST_CONFIG", *me.properties.Test_config) entries.SetString("LOCAL_TEST_CONFIG", *me.properties.Test_config)
} }

View File

@ -201,6 +201,10 @@ func (ctx *TestContext) SingletonForTests(name string) TestingSingleton {
"\nall singletons: %v", name, allSingletonNames)) "\nall singletons: %v", name, allSingletonNames))
} }
func (ctx *TestContext) Config() Config {
return ctx.config
}
type testBuildProvider interface { type testBuildProvider interface {
BuildParamsForTests() []BuildParams BuildParamsForTests() []BuildParams
RuleParamsForTests() map[blueprint.Rule]blueprint.RuleParams RuleParamsForTests() map[blueprint.Rule]blueprint.RuleParams
@ -461,7 +465,7 @@ func SetKatiEnabledForTests(config Config) {
config.katiEnabled = true config.katiEnabled = true
} }
func AndroidMkEntriesForTest(t *testing.T, config Config, bpPath string, mod blueprint.Module) []AndroidMkEntries { func AndroidMkEntriesForTest(t *testing.T, ctx *TestContext, mod blueprint.Module) []AndroidMkEntries {
var p AndroidMkEntriesProvider var p AndroidMkEntriesProvider
var ok bool var ok bool
if p, ok = mod.(AndroidMkEntriesProvider); !ok { if p, ok = mod.(AndroidMkEntriesProvider); !ok {
@ -470,19 +474,19 @@ func AndroidMkEntriesForTest(t *testing.T, config Config, bpPath string, mod blu
entriesList := p.AndroidMkEntries() entriesList := p.AndroidMkEntries()
for i, _ := range entriesList { for i, _ := range entriesList {
entriesList[i].fillInEntries(config, bpPath, mod) entriesList[i].fillInEntries(ctx, mod)
} }
return entriesList return entriesList
} }
func AndroidMkDataForTest(t *testing.T, config Config, bpPath string, mod blueprint.Module) AndroidMkData { func AndroidMkDataForTest(t *testing.T, ctx *TestContext, mod blueprint.Module) AndroidMkData {
var p AndroidMkDataProvider var p AndroidMkDataProvider
var ok bool var ok bool
if p, ok = mod.(AndroidMkDataProvider); !ok { if p, ok = mod.(AndroidMkDataProvider); !ok {
t.Errorf("module does not implement AndroidMkDataProvider: " + mod.Name()) t.Errorf("module does not implement AndroidMkDataProvider: " + mod.Name())
} }
data := p.AndroidMk() data := p.AndroidMk()
data.fillInData(config, bpPath, mod) data.fillInData(ctx, mod)
return data return data
} }

View File

@ -354,7 +354,7 @@ func ensureListNotEmpty(t *testing.T, result []string) {
// Minimal test // Minimal test
func TestBasicApex(t *testing.T) { func TestBasicApex(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex_defaults { apex_defaults {
name: "myapex-defaults", name: "myapex-defaults",
manifest: ":myapex.manifest", manifest: ":myapex.manifest",
@ -562,7 +562,7 @@ func TestBasicApex(t *testing.T) {
// Make sure that Android.mk is created // Make sure that Android.mk is created
ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, config, "", ab) data := android.AndroidMkDataForTest(t, ctx, ab)
var builder strings.Builder var builder strings.Builder
data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data) data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data)
@ -2508,7 +2508,7 @@ func TestUseVendorFailsIfNotVendorAvailable(t *testing.T) {
} }
func TestVendorApex(t *testing.T) { func TestVendorApex(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2539,7 +2539,7 @@ func TestVendorApex(t *testing.T) {
}) })
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, config, "", apexBundle) data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName() name := apexBundle.BaseModuleName()
prefix := "TARGET_" prefix := "TARGET_"
var builder strings.Builder var builder strings.Builder
@ -2643,7 +2643,7 @@ func TestApex_withPrebuiltFirmware(t *testing.T) {
} }
func TestAndroidMk_UseVendorRequired(t *testing.T) { func TestAndroidMk_UseVendorRequired(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2667,7 +2667,7 @@ func TestAndroidMk_UseVendorRequired(t *testing.T) {
}) })
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, config, "", apexBundle) data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName() name := apexBundle.BaseModuleName()
prefix := "TARGET_" prefix := "TARGET_"
var builder strings.Builder var builder strings.Builder
@ -2677,7 +2677,7 @@ func TestAndroidMk_UseVendorRequired(t *testing.T) {
} }
func TestAndroidMk_VendorApexRequired(t *testing.T) { func TestAndroidMk_VendorApexRequired(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2698,7 +2698,7 @@ func TestAndroidMk_VendorApexRequired(t *testing.T) {
`) `)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, config, "", apexBundle) data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName() name := apexBundle.BaseModuleName()
prefix := "TARGET_" prefix := "TARGET_"
var builder strings.Builder var builder strings.Builder
@ -2708,7 +2708,7 @@ func TestAndroidMk_VendorApexRequired(t *testing.T) {
} }
func TestAndroidMkWritesCommonProperties(t *testing.T) { func TestAndroidMkWritesCommonProperties(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -2726,7 +2726,7 @@ func TestAndroidMkWritesCommonProperties(t *testing.T) {
`) `)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, config, "", apexBundle) data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName() name := apexBundle.BaseModuleName()
prefix := "TARGET_" prefix := "TARGET_"
var builder strings.Builder var builder strings.Builder
@ -3799,7 +3799,7 @@ func TestDependenciesInApexManifest(t *testing.T) {
} }
func TestApexName(t *testing.T) { func TestApexName(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -3832,7 +3832,7 @@ func TestApexName(t *testing.T) {
ensureContains(t, apexRule.Args["opt_flags"], "--do_not_check_keyname") ensureContains(t, apexRule.Args["opt_flags"], "--do_not_check_keyname")
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, config, "", apexBundle) data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName() name := apexBundle.BaseModuleName()
prefix := "TARGET_" prefix := "TARGET_"
var builder strings.Builder var builder strings.Builder
@ -4336,7 +4336,7 @@ func TestPrebuiltFilenameOverride(t *testing.T) {
} }
func TestPrebuiltOverrides(t *testing.T) { func TestPrebuiltOverrides(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
prebuilt_apex { prebuilt_apex {
name: "myapex.prebuilt", name: "myapex.prebuilt",
src: "myapex-arm.apex", src: "myapex-arm.apex",
@ -4349,7 +4349,7 @@ func TestPrebuiltOverrides(t *testing.T) {
p := ctx.ModuleForTests("myapex.prebuilt", "android_common").Module().(*Prebuilt) p := ctx.ModuleForTests("myapex.prebuilt", "android_common").Module().(*Prebuilt)
expected := []string{"myapex"} expected := []string{"myapex"}
actual := android.AndroidMkEntriesForTest(t, config, "", p)[0].EntryMap["LOCAL_OVERRIDES_MODULES"] actual := android.AndroidMkEntriesForTest(t, ctx, p)[0].EntryMap["LOCAL_OVERRIDES_MODULES"]
if !reflect.DeepEqual(actual, expected) { if !reflect.DeepEqual(actual, expected) {
t.Errorf("Incorrect LOCAL_OVERRIDES_MODULES value '%s', expected '%s'", actual, expected) t.Errorf("Incorrect LOCAL_OVERRIDES_MODULES value '%s', expected '%s'", actual, expected)
} }
@ -4708,7 +4708,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
} }
func TestApexWithTests(t *testing.T) { func TestApexWithTests(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex_test { apex_test {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -4796,7 +4796,7 @@ func TestApexWithTests(t *testing.T) {
// Ensure the module is correctly translated. // Ensure the module is correctly translated.
bundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) bundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, config, "", bundle) data := android.AndroidMkDataForTest(t, ctx, bundle)
name := bundle.BaseModuleName() name := bundle.BaseModuleName()
prefix := "TARGET_" prefix := "TARGET_"
var builder strings.Builder var builder strings.Builder
@ -4811,7 +4811,7 @@ func TestApexWithTests(t *testing.T) {
ensureContains(t, androidMk, "LOCAL_MODULE := myapex\n") ensureContains(t, androidMk, "LOCAL_MODULE := myapex\n")
flatBundle := ctx.ModuleForTests("myapex", "android_common_myapex_flattened").Module().(*apexBundle) flatBundle := ctx.ModuleForTests("myapex", "android_common_myapex_flattened").Module().(*apexBundle)
data = android.AndroidMkDataForTest(t, config, "", flatBundle) data = android.AndroidMkDataForTest(t, ctx, flatBundle)
data.Custom(&builder, name, prefix, "", data) data.Custom(&builder, name, prefix, "", data)
flatAndroidMk := builder.String() flatAndroidMk := builder.String()
ensureContainsOnce(t, flatAndroidMk, "LOCAL_TEST_DATA := :baz :bar/baz\n") ensureContainsOnce(t, flatAndroidMk, "LOCAL_TEST_DATA := :baz :bar/baz\n")
@ -4819,7 +4819,7 @@ func TestApexWithTests(t *testing.T) {
} }
func TestInstallExtraFlattenedApexes(t *testing.T) { func TestInstallExtraFlattenedApexes(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -4834,7 +4834,7 @@ func TestInstallExtraFlattenedApexes(t *testing.T) {
}) })
ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
ensureListContains(t, ab.requiredDeps, "myapex.flattened") ensureListContains(t, ab.requiredDeps, "myapex.flattened")
mk := android.AndroidMkDataForTest(t, config, "", ab) mk := android.AndroidMkDataForTest(t, ctx, ab)
var builder strings.Builder var builder strings.Builder
mk.Custom(&builder, ab.Name(), "TARGET_", "", mk) mk.Custom(&builder, ab.Name(), "TARGET_", "", mk)
androidMk := builder.String() androidMk := builder.String()
@ -5382,7 +5382,7 @@ func TestApexAvailable_CreatedForApex(t *testing.T) {
} }
func TestOverrideApex(t *testing.T) { func TestOverrideApex(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5450,7 +5450,7 @@ func TestOverrideApex(t *testing.T) {
optFlags := apexRule.Args["opt_flags"] optFlags := apexRule.Args["opt_flags"]
ensureContains(t, optFlags, "--override_apk_package_name test.overridden.package") ensureContains(t, optFlags, "--override_apk_package_name test.overridden.package")
data := android.AndroidMkDataForTest(t, config, "", apexBundle) data := android.AndroidMkDataForTest(t, ctx, apexBundle)
var builder strings.Builder var builder strings.Builder
data.Custom(&builder, name, "TARGET_", "", data) data.Custom(&builder, name, "TARGET_", "", data)
androidMk := builder.String() androidMk := builder.String()
@ -5838,7 +5838,7 @@ func TestRejectNonInstallableJavaLibrary(t *testing.T) {
} }
func TestCarryRequiredModuleNames(t *testing.T) { func TestCarryRequiredModuleNames(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -5864,7 +5864,7 @@ func TestCarryRequiredModuleNames(t *testing.T) {
`) `)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, config, "", apexBundle) data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName() name := apexBundle.BaseModuleName()
prefix := "TARGET_" prefix := "TARGET_"
var builder strings.Builder var builder strings.Builder
@ -6005,7 +6005,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
} }
func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) { func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -6043,7 +6043,7 @@ func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
`) `)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, config, "", apexBundle) data := android.AndroidMkDataForTest(t, ctx, apexBundle)
var builder strings.Builder var builder strings.Builder
data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data) data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
androidMk := builder.String() androidMk := builder.String()
@ -6728,7 +6728,7 @@ func intPtr(i int) *int {
} }
func TestApexSet(t *testing.T) { func TestApexSet(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex_set { apex_set {
name: "myapex", name: "myapex",
set: "myapex.apks", set: "myapex.apks",
@ -6760,7 +6760,7 @@ func TestApexSet(t *testing.T) {
a := m.Module().(*ApexSet) a := m.Module().(*ApexSet)
expectedOverrides := []string{"foo"} expectedOverrides := []string{"foo"}
actualOverrides := android.AndroidMkEntriesForTest(t, config, "", a)[0].EntryMap["LOCAL_OVERRIDES_MODULES"] actualOverrides := android.AndroidMkEntriesForTest(t, ctx, a)[0].EntryMap["LOCAL_OVERRIDES_MODULES"]
if !reflect.DeepEqual(actualOverrides, expectedOverrides) { if !reflect.DeepEqual(actualOverrides, expectedOverrides) {
t.Errorf("Incorrect LOCAL_OVERRIDES_MODULES - expected %q vs actual %q", expectedOverrides, actualOverrides) t.Errorf("Incorrect LOCAL_OVERRIDES_MODULES - expected %q vs actual %q", expectedOverrides, actualOverrides)
} }
@ -6933,7 +6933,7 @@ func TestNonPreferredPrebuiltDependency(t *testing.T) {
} }
func TestCompressedApex(t *testing.T) { func TestCompressedApex(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -6959,7 +6959,7 @@ func TestCompressedApex(t *testing.T) {
ensureContains(t, ab.outputFile.String(), "myapex.capex") ensureContains(t, ab.outputFile.String(), "myapex.capex")
// Verify android.mk rules // Verify android.mk rules
data := android.AndroidMkDataForTest(t, config, "", ab) data := android.AndroidMkDataForTest(t, ctx, ab)
var builder strings.Builder var builder strings.Builder
data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data) data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data)
androidMk := builder.String() androidMk := builder.String()
@ -6967,7 +6967,7 @@ func TestCompressedApex(t *testing.T) {
} }
func TestPreferredPrebuiltSharedLibDep(t *testing.T) { func TestPreferredPrebuiltSharedLibDep(t *testing.T) {
ctx, config := testApex(t, ` ctx, _ := testApex(t, `
apex { apex {
name: "myapex", name: "myapex",
key: "myapex.key", key: "myapex.key",
@ -7007,7 +7007,7 @@ func TestPreferredPrebuiltSharedLibDep(t *testing.T) {
`) `)
ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, config, "", ab) data := android.AndroidMkDataForTest(t, ctx, ab)
var builder strings.Builder var builder strings.Builder
data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data) data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data)
androidMk := builder.String() androidMk := builder.String()
@ -7159,7 +7159,7 @@ func TestPrebuiltStubLibDep(t *testing.T) {
t.Run(test.name, func(t *testing.T) { t.Run(test.name, func(t *testing.T) {
for _, otherApexEnabled := range test.otherApexEnabled { for _, otherApexEnabled := range test.otherApexEnabled {
t.Run("otherapex_enabled_"+otherApexEnabled, func(t *testing.T) { t.Run("otherapex_enabled_"+otherApexEnabled, func(t *testing.T) {
ctx, config := testApex(t, fmt.Sprintf(bpBase, otherApexEnabled)+test.stublibBp) ctx, _ := testApex(t, fmt.Sprintf(bpBase, otherApexEnabled)+test.stublibBp)
type modAndMkEntries struct { type modAndMkEntries struct {
mod *cc.Module mod *cc.Module
@ -7177,7 +7177,7 @@ func TestPrebuiltStubLibDep(t *testing.T) {
if !mod.Enabled() || mod.IsHideFromMake() { if !mod.Enabled() || mod.IsHideFromMake() {
continue continue
} }
for _, ent := range android.AndroidMkEntriesForTest(t, config, "", mod) { for _, ent := range android.AndroidMkEntriesForTest(t, ctx, mod) {
if ent.Disabled { if ent.Disabled {
continue continue
} }

View File

@ -414,7 +414,7 @@ func (p *Prebuilt) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(p.inputApex), OutputFile: android.OptionalPathForPath(p.inputApex),
Include: "$(BUILD_PREBUILT)", Include: "$(BUILD_PREBUILT)",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_PATH", p.installDir.ToMakePath().String()) entries.SetString("LOCAL_MODULE_PATH", p.installDir.ToMakePath().String())
entries.SetString("LOCAL_MODULE_STEM", p.installFilename) entries.SetString("LOCAL_MODULE_STEM", p.installFilename)
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.installable()) entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.installable())
@ -609,7 +609,7 @@ func (a *ApexSet) AndroidMkEntries() []android.AndroidMkEntries {
Include: "$(BUILD_PREBUILT)", Include: "$(BUILD_PREBUILT)",
Host_required: a.hostRequired, Host_required: a.hostRequired,
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_PATH", a.installDir.ToMakePath().String()) entries.SetString("LOCAL_MODULE_PATH", a.installDir.ToMakePath().String())
entries.SetString("LOCAL_MODULE_STEM", a.installFilename) entries.SetString("LOCAL_MODULE_STEM", a.installFilename)
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !a.installable()) entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !a.installable())

View File

@ -83,7 +83,7 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries {
Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if len(c.Properties.Logtags) > 0 { if len(c.Properties.Logtags) > 0 {
entries.AddStrings("LOCAL_LOGTAGS_FILES", c.Properties.Logtags...) entries.AddStrings("LOCAL_LOGTAGS_FILES", c.Properties.Logtags...)
} }
@ -162,16 +162,17 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries {
func androidMkWriteExtraTestConfigs(extraTestConfigs android.Paths, entries *android.AndroidMkEntries) { func androidMkWriteExtraTestConfigs(extraTestConfigs android.Paths, entries *android.AndroidMkEntries) {
if len(extraTestConfigs) > 0 { if len(extraTestConfigs) > 0 {
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries,
entries.AddStrings("LOCAL_EXTRA_FULL_TEST_CONFIGS", extraTestConfigs.Strings()...) func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
}) entries.AddStrings("LOCAL_EXTRA_FULL_TEST_CONFIGS", extraTestConfigs.Strings()...)
})
} }
} }
func AndroidMkWriteTestData(data []android.DataPath, entries *android.AndroidMkEntries) { func AndroidMkWriteTestData(data []android.DataPath, entries *android.AndroidMkEntries) {
testFiles := android.AndroidMkDataPaths(data) testFiles := android.AndroidMkDataPaths(data)
if len(testFiles) > 0 { if len(testFiles) > 0 {
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.AddStrings("LOCAL_TEST_DATA", testFiles...) entries.AddStrings("LOCAL_TEST_DATA", testFiles...)
}) })
} }
@ -224,7 +225,7 @@ func (library *libraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries
entries.Class = "STATIC_LIBRARIES" entries.Class = "STATIC_LIBRARIES"
} else if library.shared() { } else if library.shared() {
entries.Class = "SHARED_LIBRARIES" entries.Class = "SHARED_LIBRARIES"
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(_ android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_SOONG_TOC", library.toc().String()) entries.SetString("LOCAL_SOONG_TOC", library.toc().String())
if !library.buildStubs() { if !library.buildStubs() {
entries.SetString("LOCAL_SOONG_UNSTRIPPED_BINARY", library.unstrippedOutputFile.String()) entries.SetString("LOCAL_SOONG_UNSTRIPPED_BINARY", library.unstrippedOutputFile.String())
@ -244,7 +245,7 @@ func (library *libraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries
entries.DistFiles = android.MakeDefaultDistFiles(library.distFile) entries.DistFiles = android.MakeDefaultDistFiles(library.distFile)
} }
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
library.androidMkWriteExportedFlags(entries) library.androidMkWriteExportedFlags(entries)
library.androidMkEntriesWriteAdditionalDependenciesForSourceAbiDiff(entries) library.androidMkEntriesWriteAdditionalDependenciesForSourceAbiDiff(entries)
@ -272,7 +273,7 @@ func (library *libraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries
if library.buildStubs() && library.stubsVersion() != "" { if library.buildStubs() && library.stubsVersion() != "" {
entries.SubName = "." + library.stubsVersion() entries.SubName = "." + library.stubsVersion()
} }
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
// library.makeUninstallable() depends on this to bypass HideFromMake() for // library.makeUninstallable() depends on this to bypass HideFromMake() for
// static libraries. // static libraries.
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true) entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
@ -315,7 +316,7 @@ func (binary *binaryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *a
entries.Class = "EXECUTABLES" entries.Class = "EXECUTABLES"
entries.DistFiles = binary.distFiles entries.DistFiles = binary.distFiles
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(_ android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_SOONG_UNSTRIPPED_BINARY", binary.unstrippedOutputFile.String()) entries.SetString("LOCAL_SOONG_UNSTRIPPED_BINARY", binary.unstrippedOutputFile.String())
if len(binary.symlinks) > 0 { if len(binary.symlinks) > 0 {
entries.AddStrings("LOCAL_MODULE_SYMLINKS", binary.symlinks...) entries.AddStrings("LOCAL_MODULE_SYMLINKS", binary.symlinks...)
@ -337,7 +338,7 @@ func (binary *binaryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *a
func (benchmark *benchmarkDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) { func (benchmark *benchmarkDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
ctx.subAndroidMk(entries, benchmark.binaryDecorator) ctx.subAndroidMk(entries, benchmark.binaryDecorator)
entries.Class = "NATIVE_TESTS" entries.Class = "NATIVE_TESTS"
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if len(benchmark.Properties.Test_suites) > 0 { if len(benchmark.Properties.Test_suites) > 0 {
entries.AddCompatibilityTestSuites(benchmark.Properties.Test_suites...) entries.AddCompatibilityTestSuites(benchmark.Properties.Test_suites...)
} }
@ -362,7 +363,7 @@ func (test *testBinary) AndroidMkEntries(ctx AndroidMkContext, entries *android.
if Bool(test.Properties.Test_per_src) { if Bool(test.Properties.Test_per_src) {
entries.SubName = "_" + String(test.binaryDecorator.Properties.Stem) entries.SubName = "_" + String(test.binaryDecorator.Properties.Stem)
} }
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if len(test.Properties.Test_suites) > 0 { if len(test.Properties.Test_suites) > 0 {
entries.AddCompatibilityTestSuites(test.Properties.Test_suites...) entries.AddCompatibilityTestSuites(test.Properties.Test_suites...)
} }
@ -406,7 +407,7 @@ func (fuzz *fuzzBinary) AndroidMkEntries(ctx AndroidMkContext, entries *android.
filepath.Dir(fuzz.config.String())+":config.json") filepath.Dir(fuzz.config.String())+":config.json")
} }
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetBool("LOCAL_IS_FUZZ_TARGET", true) entries.SetBool("LOCAL_IS_FUZZ_TARGET", true)
if len(fuzzFiles) > 0 { if len(fuzzFiles) > 0 {
entries.AddStrings("LOCAL_TEST_DATA", fuzzFiles...) entries.AddStrings("LOCAL_TEST_DATA", fuzzFiles...)
@ -423,7 +424,7 @@ func (test *testLibrary) AndroidMkEntries(ctx AndroidMkContext, entries *android
func (library *toolchainLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) { func (library *toolchainLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
entries.Class = "STATIC_LIBRARIES" entries.Class = "STATIC_LIBRARIES"
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
_, suffix, _ := android.SplitFileExt(entries.OutputFile.Path().Base()) _, suffix, _ := android.SplitFileExt(entries.OutputFile.Path().Base())
entries.SetString("LOCAL_MODULE_SUFFIX", suffix) entries.SetString("LOCAL_MODULE_SUFFIX", suffix)
}) })
@ -439,7 +440,7 @@ func (installer *baseInstaller) AndroidMkEntries(ctx AndroidMkContext, entries *
entries.OutputFile = android.OptionalPathForPath(installer.path) entries.OutputFile = android.OptionalPathForPath(installer.path)
} }
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
path, file := filepath.Split(installer.path.ToMakePath().String()) path, file := filepath.Split(installer.path.ToMakePath().String())
stem, suffix, _ := android.SplitFileExt(file) stem, suffix, _ := android.SplitFileExt(file)
entries.SetString("LOCAL_MODULE_SUFFIX", suffix) entries.SetString("LOCAL_MODULE_SUFFIX", suffix)
@ -457,7 +458,7 @@ func (c *stubDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.
return return
} }
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
path, file := filepath.Split(c.installPath.String()) path, file := filepath.Split(c.installPath.String())
stem, suffix, _ := android.SplitFileExt(file) stem, suffix, _ := android.SplitFileExt(file)
entries.SetString("LOCAL_MODULE_SUFFIX", suffix) entries.SetString("LOCAL_MODULE_SUFFIX", suffix)
@ -481,7 +482,7 @@ func (c *vndkPrebuiltLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, en
entries.SubName = c.androidMkSuffix entries.SubName = c.androidMkSuffix
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
c.libraryDecorator.androidMkWriteExportedFlags(entries) c.libraryDecorator.androidMkWriteExportedFlags(entries)
// Specifying stem is to pass check_elf_files when vendor modules link against vndk prebuilt. // Specifying stem is to pass check_elf_files when vendor modules link against vndk prebuilt.
@ -521,7 +522,7 @@ func (c *snapshotLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entrie
entries.SubName += c.baseProperties.Androidmk_suffix entries.SubName += c.baseProperties.Androidmk_suffix
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
c.libraryDecorator.androidMkWriteExportedFlags(entries) c.libraryDecorator.androidMkWriteExportedFlags(entries)
if c.shared() || c.static() { if c.shared() || c.static() {
@ -548,7 +549,7 @@ func (c *snapshotBinaryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries
entries.Class = "EXECUTABLES" entries.Class = "EXECUTABLES"
entries.SubName = c.baseProperties.Androidmk_suffix entries.SubName = c.baseProperties.Androidmk_suffix
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.AddStrings("LOCAL_MODULE_SYMLINKS", c.Properties.Symlinks...) entries.AddStrings("LOCAL_MODULE_SYMLINKS", c.Properties.Symlinks...)
}) })
} }
@ -575,7 +576,7 @@ func (c *vendorPublicLibraryStubDecorator) AndroidMkEntries(ctx AndroidMkContext
entries.Class = "SHARED_LIBRARIES" entries.Class = "SHARED_LIBRARIES"
entries.SubName = vendorPublicLibrarySuffix entries.SubName = vendorPublicLibrarySuffix
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
c.libraryDecorator.androidMkWriteExportedFlags(entries) c.libraryDecorator.androidMkWriteExportedFlags(entries)
_, _, ext := android.SplitFileExt(entries.OutputFile.Path().Base()) _, _, ext := android.SplitFileExt(entries.OutputFile.Path().Base())
@ -586,7 +587,7 @@ func (c *vendorPublicLibraryStubDecorator) AndroidMkEntries(ctx AndroidMkContext
} }
func (p *prebuiltLinker) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) { func (p *prebuiltLinker) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if p.properties.Check_elf_files != nil { if p.properties.Check_elf_files != nil {
entries.SetBool("LOCAL_CHECK_ELF_FILES", *p.properties.Check_elf_files) entries.SetBool("LOCAL_CHECK_ELF_FILES", *p.properties.Check_elf_files)
} else { } else {
@ -616,7 +617,7 @@ func (p *prebuiltBinaryLinker) AndroidMkEntries(ctx AndroidMkContext, entries *a
func androidMkWriteAllowUndefinedSymbols(linker *baseLinker, entries *android.AndroidMkEntries) { func androidMkWriteAllowUndefinedSymbols(linker *baseLinker, entries *android.AndroidMkEntries) {
allow := linker.Properties.Allow_undefined_symbols allow := linker.Properties.Allow_undefined_symbols
if allow != nil { if allow != nil {
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetBool("LOCAL_ALLOW_UNDEFINED_SYMBOLS", *allow) entries.SetBool("LOCAL_ALLOW_UNDEFINED_SYMBOLS", *allow)
}) })
} }

View File

@ -566,7 +566,7 @@ func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
ctx := testCcWithConfig(t, config) ctx := testCcWithConfig(t, config)
module := ctx.ModuleForTests("llndk.libraries.txt", "") module := ctx.ModuleForTests("llndk.libraries.txt", "")
entries := android.AndroidMkEntriesForTest(t, config, "", module.Module())[0] entries := android.AndroidMkEntriesForTest(t, ctx, module.Module())[0]
assertArrayString(t, entries.EntryMap["LOCAL_MODULE_STEM"], []string{"llndk.libraries.VER.txt"}) assertArrayString(t, entries.EntryMap["LOCAL_MODULE_STEM"], []string{"llndk.libraries.VER.txt"})
} }
@ -712,7 +712,7 @@ func TestDataLibsRelativeInstallPath(t *testing.T) {
if !strings.HasSuffix(outputPath, "/main_test") { if !strings.HasSuffix(outputPath, "/main_test") {
t.Errorf("expected test output file to be 'main_test', but was '%s'", outputPath) t.Errorf("expected test output file to be 'main_test', but was '%s'", outputPath)
} }
entries := android.AndroidMkEntriesForTest(t, config, "", module)[0] entries := android.AndroidMkEntriesForTest(t, ctx, module)[0]
if !strings.HasSuffix(entries.EntryMap["LOCAL_TEST_DATA"][0], ":test_lib.so:foo/bar/baz") { if !strings.HasSuffix(entries.EntryMap["LOCAL_TEST_DATA"][0], ":test_lib.so:foo/bar/baz") {
t.Errorf("expected LOCAL_TEST_DATA to end with `:test_lib.so:foo/bar/baz`,"+ t.Errorf("expected LOCAL_TEST_DATA to end with `:test_lib.so:foo/bar/baz`,"+
" but was '%s'", entries.EntryMap["LOCAL_TEST_DATA"][0]) " but was '%s'", entries.EntryMap["LOCAL_TEST_DATA"][0])
@ -3104,7 +3104,7 @@ func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
if !strings.HasSuffix(outputPath, "/main_test") { if !strings.HasSuffix(outputPath, "/main_test") {
t.Errorf("expected test output file to be 'main_test', but was '%s'", outputPath) t.Errorf("expected test output file to be 'main_test', but was '%s'", outputPath)
} }
entries := android.AndroidMkEntriesForTest(t, config, "", module)[0] entries := android.AndroidMkEntriesForTest(t, ctx, module)[0]
if !strings.HasSuffix(entries.EntryMap["LOCAL_TEST_DATA"][0], ":test_lib.so:foo/bar/baz") { if !strings.HasSuffix(entries.EntryMap["LOCAL_TEST_DATA"][0], ":test_lib.so:foo/bar/baz") {
t.Errorf("expected LOCAL_TEST_DATA to end with `:test_lib.so:foo/bar/baz`,"+ t.Errorf("expected LOCAL_TEST_DATA to end with `:test_lib.so:foo/bar/baz`,"+
" but was '%s'", entries.EntryMap["LOCAL_TEST_DATA"][0]) " but was '%s'", entries.EntryMap["LOCAL_TEST_DATA"][0])

View File

@ -561,7 +561,7 @@ func (txt *vndkLibrariesTxt) AndroidMkEntries() []android.AndroidMkEntries {
Class: "ETC", Class: "ETC",
OutputFile: android.OptionalPathForPath(txt.outputFile), OutputFile: android.OptionalPathForPath(txt.outputFile),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_STEM", txt.outputFile.Base()) entries.SetString("LOCAL_MODULE_STEM", txt.outputFile.Base())
}, },
}, },

View File

@ -293,7 +293,7 @@ func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries {
SubName: nameSuffix, SubName: nameSuffix,
OutputFile: android.OptionalPathForPath(p.outputFilePath), OutputFile: android.OptionalPathForPath(p.outputFilePath),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_TAGS", "optional") entries.SetString("LOCAL_MODULE_TAGS", "optional")
entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String()) entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base())

View File

@ -175,7 +175,7 @@ func TestPrebuiltEtcGlob(t *testing.T) {
} }
func TestPrebuiltEtcAndroidMk(t *testing.T) { func TestPrebuiltEtcAndroidMk(t *testing.T) {
ctx, config := testPrebuiltEtc(t, ` ctx, _ := testPrebuiltEtc(t, `
prebuilt_etc { prebuilt_etc {
name: "foo", name: "foo",
src: "foo.conf", src: "foo.conf",
@ -198,7 +198,7 @@ func TestPrebuiltEtcAndroidMk(t *testing.T) {
} }
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*PrebuiltEtc) mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*PrebuiltEtc)
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0] entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
for k, expectedValue := range expected { for k, expectedValue := range expected {
if value, ok := entries.EntryMap[k]; ok { if value, ok := entries.EntryMap[k]; ok {
if !reflect.DeepEqual(value, expectedValue) { if !reflect.DeepEqual(value, expectedValue) {

View File

@ -207,7 +207,7 @@ func (b *bootimg) AndroidMkEntries() []android.AndroidMkEntries {
Class: "ETC", Class: "ETC",
OutputFile: android.OptionalPathForPath(b.output), OutputFile: android.OptionalPathForPath(b.output),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_PATH", b.installDir.ToMakePath().String()) entries.SetString("LOCAL_MODULE_PATH", b.installDir.ToMakePath().String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", b.installFileName()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", b.installFileName())
}, },

View File

@ -272,7 +272,7 @@ func (f *filesystem) AndroidMkEntries() []android.AndroidMkEntries {
Class: "ETC", Class: "ETC",
OutputFile: android.OptionalPathForPath(f.output), OutputFile: android.OptionalPathForPath(f.output),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_PATH", f.installDir.ToMakePath().String()) entries.SetString("LOCAL_MODULE_PATH", f.installDir.ToMakePath().String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", f.installFileName()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", f.installFileName())
}, },

View File

@ -41,7 +41,7 @@ func (library *Library) AndroidMkEntriesHostDex() android.AndroidMkEntries {
Required: library.deviceProperties.Target.Hostdex.Required, Required: library.deviceProperties.Target.Hostdex.Required,
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetBool("LOCAL_IS_HOST_MODULE", true) entries.SetBool("LOCAL_IS_HOST_MODULE", true)
entries.SetPath("LOCAL_PREBUILT_MODULE_FILE", output) entries.SetPath("LOCAL_PREBUILT_MODULE_FILE", output)
if library.dexJarFile != nil { if library.dexJarFile != nil {
@ -74,7 +74,7 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(checkedModulePaths[0]), OutputFile: android.OptionalPathForPath(checkedModulePaths[0]),
Include: "$(BUILD_PHONY_PACKAGE)", Include: "$(BUILD_PHONY_PACKAGE)",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.AddStrings("LOCAL_ADDITIONAL_CHECKED_MODULE", checkedModulePaths.Strings()...) entries.AddStrings("LOCAL_ADDITIONAL_CHECKED_MODULE", checkedModulePaths.Strings()...)
}, },
}, },
@ -88,7 +88,7 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(library.outputFile), OutputFile: android.OptionalPathForPath(library.outputFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if len(library.logtagsSrcs) > 0 { if len(library.logtagsSrcs) > 0 {
var logtags []string var logtags []string
for _, l := range library.logtagsSrcs { for _, l := range library.logtagsSrcs {
@ -152,7 +152,7 @@ func testSuiteComponent(entries *android.AndroidMkEntries, test_suites []string)
func (j *Test) AndroidMkEntries() []android.AndroidMkEntries { func (j *Test) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := j.Library.AndroidMkEntries() entriesList := j.Library.AndroidMkEntries()
entries := &entriesList[0] entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
testSuiteComponent(entries, j.testProperties.Test_suites) testSuiteComponent(entries, j.testProperties.Test_suites)
if j.testConfig != nil { if j.testConfig != nil {
entries.SetPath("LOCAL_FULL_TEST_CONFIG", j.testConfig) entries.SetPath("LOCAL_FULL_TEST_CONFIG", j.testConfig)
@ -180,7 +180,7 @@ func androidMkWriteExtraTestConfigs(extraTestConfigs android.Paths, entries *and
func (j *TestHelperLibrary) AndroidMkEntries() []android.AndroidMkEntries { func (j *TestHelperLibrary) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := j.Library.AndroidMkEntries() entriesList := j.Library.AndroidMkEntries()
entries := &entriesList[0] entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
testSuiteComponent(entries, j.testHelperLibraryProperties.Test_suites) testSuiteComponent(entries, j.testHelperLibraryProperties.Test_suites)
}) })
@ -198,7 +198,7 @@ func (prebuilt *Import) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile), OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", !Bool(prebuilt.properties.Installable)) entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", !Bool(prebuilt.properties.Installable))
if prebuilt.dexJarFile != nil { if prebuilt.dexJarFile != nil {
entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile) entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile)
@ -223,7 +223,7 @@ func (prebuilt *DexImport) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(prebuilt.maybeStrippedDexJarFile), OutputFile: android.OptionalPathForPath(prebuilt.maybeStrippedDexJarFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if prebuilt.dexJarFile != nil { if prebuilt.dexJarFile != nil {
entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile) entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile)
} }
@ -247,7 +247,7 @@ func (prebuilt *AARImport) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(prebuilt.classpathFile), OutputFile: android.OptionalPathForPath(prebuilt.classpathFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true) entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.classpathFile) entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.classpathFile)
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.classpathFile) entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.classpathFile)
@ -269,7 +269,7 @@ func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(binary.outputFile), OutputFile: android.OptionalPathForPath(binary.outputFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetPath("LOCAL_SOONG_HEADER_JAR", binary.headerJarFile) entries.SetPath("LOCAL_SOONG_HEADER_JAR", binary.headerJarFile)
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", binary.implementationAndResourcesJar) entries.SetPath("LOCAL_SOONG_CLASSES_JAR", binary.implementationAndResourcesJar)
if binary.dexJarFile != nil { if binary.dexJarFile != nil {
@ -291,7 +291,7 @@ func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries {
Class: "EXECUTABLES", Class: "EXECUTABLES",
OutputFile: android.OptionalPathForPath(binary.wrapperFile), OutputFile: android.OptionalPathForPath(binary.wrapperFile),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetBool("LOCAL_STRIP_MODULE", false) entries.SetBool("LOCAL_STRIP_MODULE", false)
}, },
}, },
@ -317,7 +317,7 @@ func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(app.outputFile), OutputFile: android.OptionalPathForPath(app.outputFile),
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
// App module names can be overridden. // App module names can be overridden.
entries.SetString("LOCAL_MODULE", app.installApkName) entries.SetString("LOCAL_MODULE", app.installApkName)
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", app.appProperties.PreventInstall) entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", app.appProperties.PreventInstall)
@ -432,7 +432,7 @@ func (a *AndroidApp) getOverriddenPackages() []string {
func (a *AndroidTest) AndroidMkEntries() []android.AndroidMkEntries { func (a *AndroidTest) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := a.AndroidApp.AndroidMkEntries() entriesList := a.AndroidApp.AndroidMkEntries()
entries := &entriesList[0] entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
testSuiteComponent(entries, a.testProperties.Test_suites) testSuiteComponent(entries, a.testProperties.Test_suites)
if a.testConfig != nil { if a.testConfig != nil {
entries.SetPath("LOCAL_FULL_TEST_CONFIG", a.testConfig) entries.SetPath("LOCAL_FULL_TEST_CONFIG", a.testConfig)
@ -448,7 +448,7 @@ func (a *AndroidTest) AndroidMkEntries() []android.AndroidMkEntries {
func (a *AndroidTestHelperApp) AndroidMkEntries() []android.AndroidMkEntries { func (a *AndroidTestHelperApp) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := a.AndroidApp.AndroidMkEntries() entriesList := a.AndroidApp.AndroidMkEntries()
entries := &entriesList[0] entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
testSuiteComponent(entries, a.appTestHelperAppProperties.Test_suites) testSuiteComponent(entries, a.appTestHelperAppProperties.Test_suites)
}) })
@ -464,7 +464,7 @@ func (a *AndroidLibrary) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := a.Library.AndroidMkEntries() entriesList := a.Library.AndroidMkEntries()
entries := &entriesList[0] entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if a.aarFile != nil { if a.aarFile != nil {
entries.SetPath("LOCAL_SOONG_AAR", a.aarFile) entries.SetPath("LOCAL_SOONG_AAR", a.aarFile)
} }
@ -492,7 +492,7 @@ func (jd *Javadoc) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(jd.stubsSrcJar), OutputFile: android.OptionalPathForPath(jd.stubsSrcJar),
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if BoolDefault(jd.properties.Installable, true) { if BoolDefault(jd.properties.Installable, true) {
entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", jd.docZip) entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", jd.docZip)
} }
@ -510,7 +510,7 @@ func (ddoc *Droiddoc) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(ddoc.Javadoc.docZip), OutputFile: android.OptionalPathForPath(ddoc.Javadoc.docZip),
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if ddoc.Javadoc.docZip != nil { if ddoc.Javadoc.docZip != nil {
entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", ddoc.Javadoc.docZip) entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", ddoc.Javadoc.docZip)
} }
@ -539,7 +539,7 @@ func (dstubs *Droidstubs) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: outputFile, OutputFile: outputFile,
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if dstubs.Javadoc.stubsSrcJar != nil { if dstubs.Javadoc.stubsSrcJar != nil {
entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", dstubs.Javadoc.stubsSrcJar) entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", dstubs.Javadoc.stubsSrcJar)
} }
@ -638,7 +638,7 @@ func (a *AndroidAppImport) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(a.outputFile), OutputFile: android.OptionalPathForPath(a.outputFile),
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", a.Privileged()) entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", a.Privileged())
entries.SetString("LOCAL_CERTIFICATE", a.certificate.AndroidMkString()) entries.SetString("LOCAL_CERTIFICATE", a.certificate.AndroidMkString())
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", a.properties.Overrides...) entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", a.properties.Overrides...)
@ -657,7 +657,7 @@ func (a *AndroidAppImport) AndroidMkEntries() []android.AndroidMkEntries {
func (a *AndroidTestImport) AndroidMkEntries() []android.AndroidMkEntries { func (a *AndroidTestImport) AndroidMkEntries() []android.AndroidMkEntries {
entriesList := a.AndroidAppImport.AndroidMkEntries() entriesList := a.AndroidAppImport.AndroidMkEntries()
entries := &entriesList[0] entries := &entriesList[0]
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
testSuiteComponent(entries, a.testProperties.Test_suites) testSuiteComponent(entries, a.testProperties.Test_suites)
androidMkWriteTestData(a.data, entries) androidMkWriteTestData(a.data, entries)
}) })
@ -678,7 +678,7 @@ func (r *RuntimeResourceOverlay) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(r.outputFile), OutputFile: android.OptionalPathForPath(r.outputFile),
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString()) entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString())
entries.SetPath("LOCAL_MODULE_PATH", r.installDir.ToMakePath()) entries.SetPath("LOCAL_MODULE_PATH", r.installDir.ToMakePath())
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", r.properties.Overrides...) entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", r.properties.Overrides...)
@ -694,7 +694,7 @@ func (apkSet *AndroidAppSet) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(apkSet.packedOutput), OutputFile: android.OptionalPathForPath(apkSet.packedOutput),
Include: "$(BUILD_SYSTEM)/soong_android_app_set.mk", Include: "$(BUILD_SYSTEM)/soong_android_app_set.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", apkSet.Privileged()) entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", apkSet.Privileged())
entries.SetString("LOCAL_APK_SET_INSTALL_FILE", apkSet.InstallFile()) entries.SetString("LOCAL_APK_SET_INSTALL_FILE", apkSet.InstallFile())
entries.SetPath("LOCAL_APKCERTS_FILE", apkSet.apkcertsFile) entries.SetPath("LOCAL_APKCERTS_FILE", apkSet.apkcertsFile)

View File

@ -22,7 +22,7 @@ import (
) )
func TestRequired(t *testing.T) { func TestRequired(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
java_library { java_library {
name: "foo", name: "foo",
srcs: ["a.java"], srcs: ["a.java"],
@ -31,7 +31,7 @@ func TestRequired(t *testing.T) {
`) `)
mod := ctx.ModuleForTests("foo", "android_common").Module() mod := ctx.ModuleForTests("foo", "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0] entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
expected := []string{"libfoo"} expected := []string{"libfoo"}
actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"] actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"]
@ -41,7 +41,7 @@ func TestRequired(t *testing.T) {
} }
func TestHostdex(t *testing.T) { func TestHostdex(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
java_library { java_library {
name: "foo", name: "foo",
srcs: ["a.java"], srcs: ["a.java"],
@ -50,7 +50,7 @@ func TestHostdex(t *testing.T) {
`) `)
mod := ctx.ModuleForTests("foo", "android_common").Module() mod := ctx.ModuleForTests("foo", "android_common").Module()
entriesList := android.AndroidMkEntriesForTest(t, config, "", mod) entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
if len(entriesList) != 2 { if len(entriesList) != 2 {
t.Errorf("two entries are expected, but got %d", len(entriesList)) t.Errorf("two entries are expected, but got %d", len(entriesList))
} }
@ -71,7 +71,7 @@ func TestHostdex(t *testing.T) {
} }
func TestHostdexRequired(t *testing.T) { func TestHostdexRequired(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
java_library { java_library {
name: "foo", name: "foo",
srcs: ["a.java"], srcs: ["a.java"],
@ -81,7 +81,7 @@ func TestHostdexRequired(t *testing.T) {
`) `)
mod := ctx.ModuleForTests("foo", "android_common").Module() mod := ctx.ModuleForTests("foo", "android_common").Module()
entriesList := android.AndroidMkEntriesForTest(t, config, "", mod) entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
if len(entriesList) != 2 { if len(entriesList) != 2 {
t.Errorf("two entries are expected, but got %d", len(entriesList)) t.Errorf("two entries are expected, but got %d", len(entriesList))
} }
@ -102,7 +102,7 @@ func TestHostdexRequired(t *testing.T) {
} }
func TestHostdexSpecificRequired(t *testing.T) { func TestHostdexSpecificRequired(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
java_library { java_library {
name: "foo", name: "foo",
srcs: ["a.java"], srcs: ["a.java"],
@ -116,7 +116,7 @@ func TestHostdexSpecificRequired(t *testing.T) {
`) `)
mod := ctx.ModuleForTests("foo", "android_common").Module() mod := ctx.ModuleForTests("foo", "android_common").Module()
entriesList := android.AndroidMkEntriesForTest(t, config, "", mod) entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
if len(entriesList) != 2 { if len(entriesList) != 2 {
t.Errorf("two entries are expected, but got %d", len(entriesList)) t.Errorf("two entries are expected, but got %d", len(entriesList))
} }
@ -135,7 +135,7 @@ func TestHostdexSpecificRequired(t *testing.T) {
} }
func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) { func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
java_sdk_library { java_sdk_library {
name: "foo-shared_library", name: "foo-shared_library",
srcs: ["a.java"], srcs: ["a.java"],
@ -159,7 +159,7 @@ func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
} }
for _, tc := range testCases { for _, tc := range testCases {
mod := ctx.ModuleForTests(tc.moduleName, "android_common").Module() mod := ctx.ModuleForTests(tc.moduleName, "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0] entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"] actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"]
if !reflect.DeepEqual(tc.expected, actual) { if !reflect.DeepEqual(tc.expected, actual) {
t.Errorf("Unexpected required modules - expected: %q, actual: %q", tc.expected, actual) t.Errorf("Unexpected required modules - expected: %q, actual: %q", tc.expected, actual)
@ -168,7 +168,7 @@ func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
} }
func TestImportSoongDexJar(t *testing.T) { func TestImportSoongDexJar(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
java_import { java_import {
name: "my-java-import", name: "my-java-import",
jars: ["a.jar"], jars: ["a.jar"],
@ -178,7 +178,7 @@ func TestImportSoongDexJar(t *testing.T) {
`) `)
mod := ctx.ModuleForTests("my-java-import", "android_common").Module() mod := ctx.ModuleForTests("my-java-import", "android_common").Module()
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0] entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
expectedSoongDexJar := buildDir + "/.intermediates/my-java-import/android_common/dex/my-java-import.jar" expectedSoongDexJar := buildDir + "/.intermediates/my-java-import/android_common/dex/my-java-import.jar"
actualSoongDexJar := entries.EntryMap["LOCAL_SOONG_DEX_JAR"] actualSoongDexJar := entries.EntryMap["LOCAL_SOONG_DEX_JAR"]

View File

@ -232,7 +232,7 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) {
} }
func TestAndroidAppImport_Filename(t *testing.T) { func TestAndroidAppImport_Filename(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
android_app_import { android_app_import {
name: "foo", name: "foo",
apk: "prebuilts/apk/app.apk", apk: "prebuilts/apk/app.apk",
@ -269,8 +269,7 @@ func TestAndroidAppImport_Filename(t *testing.T) {
a := variant.Module().(*AndroidAppImport) a := variant.Module().(*AndroidAppImport)
expectedValues := []string{test.expected} expectedValues := []string{test.expected}
actualValues := android.AndroidMkEntriesForTest( actualValues := android.AndroidMkEntriesForTest(t, ctx, a)[0].EntryMap["LOCAL_INSTALLED_MODULE_STEM"]
t, config, "", a)[0].EntryMap["LOCAL_INSTALLED_MODULE_STEM"]
if !reflect.DeepEqual(actualValues, expectedValues) { if !reflect.DeepEqual(actualValues, expectedValues) {
t.Errorf("Incorrect LOCAL_INSTALLED_MODULE_STEM value '%s', expected '%s'", t.Errorf("Incorrect LOCAL_INSTALLED_MODULE_STEM value '%s', expected '%s'",
actualValues, expectedValues) actualValues, expectedValues)
@ -394,7 +393,7 @@ func TestAndroidAppImport_overridesDisabledAndroidApp(t *testing.T) {
} }
func TestAndroidAppImport_frameworkRes(t *testing.T) { func TestAndroidAppImport_frameworkRes(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
android_app_import { android_app_import {
name: "framework-res", name: "framework-res",
certificate: "platform", certificate: "platform",
@ -424,7 +423,7 @@ func TestAndroidAppImport_frameworkRes(t *testing.T) {
} }
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0] entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
expectedPath := "." expectedPath := "."
// From apk property above, in the root of the source tree. // From apk property above, in the root of the source tree.
@ -457,7 +456,7 @@ func TestAndroidAppImport_frameworkRes(t *testing.T) {
} }
func TestAndroidTestImport(t *testing.T) { func TestAndroidTestImport(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
android_test_import { android_test_import {
name: "foo", name: "foo",
apk: "prebuilts/apk/app.apk", apk: "prebuilts/apk/app.apk",
@ -471,7 +470,7 @@ func TestAndroidTestImport(t *testing.T) {
test := ctx.ModuleForTests("foo", "android_common").Module().(*AndroidTestImport) test := ctx.ModuleForTests("foo", "android_common").Module().(*AndroidTestImport)
// Check android mks. // Check android mks.
entries := android.AndroidMkEntriesForTest(t, config, "", test)[0] entries := android.AndroidMkEntriesForTest(t, ctx, test)[0]
expected := []string{"tests"} expected := []string{"tests"}
actual := entries.EntryMap["LOCAL_MODULE_TAGS"] actual := entries.EntryMap["LOCAL_MODULE_TAGS"]
if !reflect.DeepEqual(expected, actual) { if !reflect.DeepEqual(expected, actual) {

View File

@ -22,7 +22,7 @@ import (
) )
func TestAndroidAppSet(t *testing.T) { func TestAndroidAppSet(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
android_app_set { android_app_set {
name: "foo", name: "foo",
set: "prebuilts/apks/app.apks", set: "prebuilts/apks/app.apks",
@ -40,7 +40,7 @@ func TestAndroidAppSet(t *testing.T) {
if s := params.Args["partition"]; s != "system" { if s := params.Args["partition"]; s != "system" {
t.Errorf("wrong partition value: '%s', expected 'system'", s) t.Errorf("wrong partition value: '%s', expected 'system'", s)
} }
mkEntries := android.AndroidMkEntriesForTest(t, config, "", module.Module())[0] mkEntries := android.AndroidMkEntriesForTest(t, ctx, module.Module())[0]
actualInstallFile := mkEntries.EntryMap["LOCAL_APK_SET_INSTALL_FILE"] actualInstallFile := mkEntries.EntryMap["LOCAL_APK_SET_INSTALL_FILE"]
expectedInstallFile := []string{"foo.apk"} expectedInstallFile := []string{"foo.apk"}
if !reflect.DeepEqual(actualInstallFile, expectedInstallFile) { if !reflect.DeepEqual(actualInstallFile, expectedInstallFile) {

View File

@ -2406,7 +2406,7 @@ func TestAidlFlagsArePassedToTheAidlCompiler(t *testing.T) {
} }
func TestDataNativeBinaries(t *testing.T) { func TestDataNativeBinaries(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
java_test_host { java_test_host {
name: "foo", name: "foo",
srcs: ["a.java"], srcs: ["a.java"],
@ -2422,7 +2422,7 @@ func TestDataNativeBinaries(t *testing.T) {
buildOS := android.BuildOs.String() buildOS := android.BuildOs.String()
test := ctx.ModuleForTests("foo", buildOS+"_common").Module().(*TestHost) test := ctx.ModuleForTests("foo", buildOS+"_common").Module().(*TestHost)
entries := android.AndroidMkEntriesForTest(t, config, "", test)[0] entries := android.AndroidMkEntriesForTest(t, ctx, test)[0]
expected := []string{buildDir + "/.intermediates/bin/" + buildOS + "_x86_64_PY3/bin:bin"} expected := []string{buildDir + "/.intermediates/bin/" + buildOS + "_x86_64_PY3/bin:bin"}
actual := entries.EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"] actual := entries.EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"]
if !reflect.DeepEqual(expected, actual) { if !reflect.DeepEqual(expected, actual) {

View File

@ -131,7 +131,7 @@ func (p *platformCompatConfig) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(p.configFile), OutputFile: android.OptionalPathForPath(p.configFile),
Include: "$(BUILD_PREBUILT)", Include: "$(BUILD_PREBUILT)",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String()) entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.configFile.Base()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.configFile.Base())
}, },

View File

@ -96,7 +96,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
if expected != signingFlag { if expected != signingFlag {
t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag) t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
} }
androidMkEntries := android.AndroidMkEntriesForTest(t, config, "", m.Module())[0] androidMkEntries := android.AndroidMkEntriesForTest(t, ctx, m.Module())[0]
path := androidMkEntries.EntryMap["LOCAL_CERTIFICATE"] path := androidMkEntries.EntryMap["LOCAL_CERTIFICATE"]
expectedPath := []string{"build/make/target/product/security/platform.x509.pem"} expectedPath := []string{"build/make/target/product/security/platform.x509.pem"}
if !reflect.DeepEqual(path, expectedPath) { if !reflect.DeepEqual(path, expectedPath) {
@ -112,7 +112,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
// A themed module has a different device location // A themed module has a different device location
m = ctx.ModuleForTests("foo_themed", "android_common") m = ctx.ModuleForTests("foo_themed", "android_common")
androidMkEntries = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0] androidMkEntries = android.AndroidMkEntriesForTest(t, ctx, m.Module())[0]
path = androidMkEntries.EntryMap["LOCAL_MODULE_PATH"] path = androidMkEntries.EntryMap["LOCAL_MODULE_PATH"]
expectedPath = []string{"/tmp/target/product/test_device/product/overlay/faza"} expectedPath = []string{"/tmp/target/product/test_device/product/overlay/faza"}
if !reflect.DeepEqual(path, expectedPath) { if !reflect.DeepEqual(path, expectedPath) {
@ -127,7 +127,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
} }
func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) { func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
ctx, config := testJava(t, ` ctx, _ := testJava(t, `
java_defaults { java_defaults {
name: "rro_defaults", name: "rro_defaults",
theme: "default_theme", theme: "default_theme",
@ -159,7 +159,7 @@ func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
} }
// Check device location. // Check device location.
path := android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"] path := android.AndroidMkEntriesForTest(t, ctx, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
expectedPath := []string{"/tmp/target/product/test_device/product/overlay/default_theme"} expectedPath := []string{"/tmp/target/product/test_device/product/overlay/default_theme"}
if !reflect.DeepEqual(path, expectedPath) { if !reflect.DeepEqual(path, expectedPath) {
t.Errorf("Unexpected LOCAL_MODULE_PATH value: %q, expected: %q", path, expectedPath) t.Errorf("Unexpected LOCAL_MODULE_PATH value: %q, expected: %q", path, expectedPath)
@ -178,7 +178,7 @@ func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
} }
// Check device location. // Check device location.
path = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"] path = android.AndroidMkEntriesForTest(t, ctx, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
expectedPath = []string{"/tmp/target/product/test_device/system/overlay"} expectedPath = []string{"/tmp/target/product/test_device/system/overlay"}
if !reflect.DeepEqual(path, expectedPath) { if !reflect.DeepEqual(path, expectedPath) {
t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath) t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)
@ -361,7 +361,7 @@ func TestEnforceRRO_propagatesToDependencies(t *testing.T) {
modules := []string{"foo", "bar"} modules := []string{"foo", "bar"}
for _, moduleName := range modules { for _, moduleName := range modules {
module := ctx.ModuleForTests(moduleName, "android_common") module := ctx.ModuleForTests(moduleName, "android_common")
mkEntries := android.AndroidMkEntriesForTest(t, config, "", module.Module())[0] mkEntries := android.AndroidMkEntriesForTest(t, ctx, module.Module())[0]
actualRRODirs := mkEntries.EntryMap["LOCAL_SOONG_PRODUCT_RRO_DIRS"] actualRRODirs := mkEntries.EntryMap["LOCAL_SOONG_PRODUCT_RRO_DIRS"]
if !reflect.DeepEqual(actualRRODirs, testCase.rroDirs[moduleName]) { if !reflect.DeepEqual(actualRRODirs, testCase.rroDirs[moduleName]) {
t.Errorf("exected %s LOCAL_SOONG_PRODUCT_RRO_DIRS entry: %v\ngot:%q", t.Errorf("exected %s LOCAL_SOONG_PRODUCT_RRO_DIRS entry: %v\ngot:%q",

View File

@ -2238,7 +2238,7 @@ func (module *sdkLibraryXml) AndroidMkEntries() []android.AndroidMkEntries {
Class: "ETC", Class: "ETC",
OutputFile: android.OptionalPathForPath(module.outputFilePath), OutputFile: android.OptionalPathForPath(module.outputFilePath),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_TAGS", "optional") entries.SetString("LOCAL_MODULE_TAGS", "optional")
entries.SetString("LOCAL_MODULE_PATH", module.installDirPath.ToMakePath().String()) entries.SetString("LOCAL_MODULE_PATH", module.installDirPath.ToMakePath().String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", module.outputFilePath.Base()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", module.outputFilePath.Base())

View File

@ -98,7 +98,7 @@ func (l *linkerConfig) AndroidMkEntries() []android.AndroidMkEntries {
Class: "ETC", Class: "ETC",
OutputFile: android.OptionalPathForPath(l.outputFilePath), OutputFile: android.OptionalPathForPath(l.outputFilePath),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_PATH", l.installDirPath.ToMakePath().String()) entries.SetString("LOCAL_MODULE_PATH", l.installDirPath.ToMakePath().String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", l.outputFilePath.Base()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", l.outputFilePath.Base())
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !installable) entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !installable)

View File

@ -47,7 +47,7 @@ func TestMain(m *testing.M) {
os.Exit(run()) os.Exit(run())
} }
func testContext(t *testing.T, bp string) (*android.TestContext, android.Config) { func testContext(t *testing.T, bp string) *android.TestContext {
t.Helper() t.Helper()
fs := map[string][]byte{ fs := map[string][]byte{
@ -65,11 +65,11 @@ func testContext(t *testing.T, bp string) (*android.TestContext, android.Config)
_, errs = ctx.PrepareBuildActions(config) _, errs = ctx.PrepareBuildActions(config)
android.FailIfErrored(t, errs) android.FailIfErrored(t, errs)
return ctx, config return ctx
} }
func TestBaseLinkerConfig(t *testing.T) { func TestBaseLinkerConfig(t *testing.T) {
ctx, config := testContext(t, ` ctx := testContext(t, `
linker_config { linker_config {
name: "linker-config-base", name: "linker-config-base",
src: "linker.config.json", src: "linker.config.json",
@ -88,7 +88,7 @@ func TestBaseLinkerConfig(t *testing.T) {
t.Errorf("expected linker.config.pb, got %q", p.outputFilePath.Base()) t.Errorf("expected linker.config.pb, got %q", p.outputFilePath.Base())
} }
entries := android.AndroidMkEntriesForTest(t, config, "", p)[0] entries := android.AndroidMkEntriesForTest(t, ctx, p)[0]
for k, expectedValue := range expected { for k, expectedValue := range expected {
if value, ok := entries.EntryMap[k]; ok { if value, ok := entries.EntryMap[k]; ok {
if !reflect.DeepEqual(value, expectedValue) { if !reflect.DeepEqual(value, expectedValue) {
@ -105,7 +105,7 @@ func TestBaseLinkerConfig(t *testing.T) {
} }
func TestUninstallableLinkerConfig(t *testing.T) { func TestUninstallableLinkerConfig(t *testing.T) {
ctx, config := testContext(t, ` ctx := testContext(t, `
linker_config { linker_config {
name: "linker-config-base", name: "linker-config-base",
src: "linker.config.json", src: "linker.config.json",
@ -116,7 +116,7 @@ func TestUninstallableLinkerConfig(t *testing.T) {
expected := []string{"true"} expected := []string{"true"}
p := ctx.ModuleForTests("linker-config-base", "android_arm64_armv8-a").Module().(*linkerConfig) p := ctx.ModuleForTests("linker-config-base", "android_arm64_armv8-a").Module().(*linkerConfig)
entries := android.AndroidMkEntriesForTest(t, config, "", p)[0] entries := android.AndroidMkEntriesForTest(t, ctx, p)[0]
if value, ok := entries.EntryMap["LOCAL_UNINSTALLABLE_MODULE"]; ok { if value, ok := entries.EntryMap["LOCAL_UNINSTALLABLE_MODULE"]; ok {
if !reflect.DeepEqual(value, expected) { if !reflect.DeepEqual(value, expected) {
t.Errorf("LOCAL_UNINSTALLABLE_MODULE is expected to be true but %s", value) t.Errorf("LOCAL_UNINSTALLABLE_MODULE is expected to be true but %s", value)

View File

@ -48,27 +48,29 @@ func (p *Module) AndroidMkEntries() []android.AndroidMkEntries {
func (p *binaryDecorator) AndroidMk(base *Module, entries *android.AndroidMkEntries) { func (p *binaryDecorator) AndroidMk(base *Module, entries *android.AndroidMkEntries) {
entries.Class = "EXECUTABLES" entries.Class = "EXECUTABLES"
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries,
entries.AddCompatibilityTestSuites(p.binaryProperties.Test_suites...) func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
}) entries.AddCompatibilityTestSuites(p.binaryProperties.Test_suites...)
})
base.subAndroidMk(entries, p.pythonInstaller) base.subAndroidMk(entries, p.pythonInstaller)
} }
func (p *testDecorator) AndroidMk(base *Module, entries *android.AndroidMkEntries) { func (p *testDecorator) AndroidMk(base *Module, entries *android.AndroidMkEntries) {
entries.Class = "NATIVE_TESTS" entries.Class = "NATIVE_TESTS"
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries,
entries.AddCompatibilityTestSuites(p.binaryDecorator.binaryProperties.Test_suites...) func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if p.testConfig != nil { entries.AddCompatibilityTestSuites(p.binaryDecorator.binaryProperties.Test_suites...)
entries.SetString("LOCAL_FULL_TEST_CONFIG", p.testConfig.String()) if p.testConfig != nil {
} entries.SetString("LOCAL_FULL_TEST_CONFIG", p.testConfig.String())
}
entries.SetBoolIfTrue("LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG", !BoolDefault(p.binaryProperties.Auto_gen_config, true)) entries.SetBoolIfTrue("LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG", !BoolDefault(p.binaryProperties.Auto_gen_config, true))
entries.AddStrings("LOCAL_TEST_DATA", android.AndroidMkDataPaths(p.data)...) entries.AddStrings("LOCAL_TEST_DATA", android.AndroidMkDataPaths(p.data)...)
entries.SetBoolIfTrue("LOCAL_IS_UNIT_TEST", Bool(p.testProperties.Test_options.Unit_test)) entries.SetBoolIfTrue("LOCAL_IS_UNIT_TEST", Bool(p.testProperties.Test_options.Unit_test))
}) })
base.subAndroidMk(entries, p.binaryDecorator.pythonInstaller) base.subAndroidMk(entries, p.binaryDecorator.pythonInstaller)
} }
@ -80,14 +82,15 @@ func (installer *pythonInstaller) AndroidMk(base *Module, entries *android.Andro
} }
entries.Required = append(entries.Required, "libc++") entries.Required = append(entries.Required, "libc++")
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.ExtraEntries = append(entries.ExtraEntries,
path, file := filepath.Split(installer.path.ToMakePath().String()) func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
stem := strings.TrimSuffix(file, filepath.Ext(file)) path, file := filepath.Split(installer.path.ToMakePath().String())
stem := strings.TrimSuffix(file, filepath.Ext(file))
entries.SetString("LOCAL_MODULE_SUFFIX", filepath.Ext(file)) entries.SetString("LOCAL_MODULE_SUFFIX", filepath.Ext(file))
entries.SetString("LOCAL_MODULE_PATH", path) entries.SetString("LOCAL_MODULE_PATH", path)
entries.SetString("LOCAL_MODULE_STEM", stem) entries.SetString("LOCAL_MODULE_STEM", stem)
entries.AddStrings("LOCAL_SHARED_LIBRARIES", installer.androidMkSharedLibs...) entries.AddStrings("LOCAL_SHARED_LIBRARIES", installer.androidMkSharedLibs...)
entries.SetBool("LOCAL_CHECK_ELF_FILES", false) entries.SetBool("LOCAL_CHECK_ELF_FILES", false)
}) })
} }

View File

@ -53,7 +53,7 @@ func (mod *Module) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: mod.outputFile, OutputFile: mod.outputFile,
Include: "$(BUILD_SYSTEM)/soong_rust_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_rust_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.AddStrings("LOCAL_RLIB_LIBRARIES", mod.Properties.AndroidMkRlibs...) entries.AddStrings("LOCAL_RLIB_LIBRARIES", mod.Properties.AndroidMkRlibs...)
entries.AddStrings("LOCAL_DYLIB_LIBRARIES", mod.Properties.AndroidMkDylibs...) entries.AddStrings("LOCAL_DYLIB_LIBRARIES", mod.Properties.AndroidMkDylibs...)
entries.AddStrings("LOCAL_PROC_MACRO_LIBRARIES", mod.Properties.AndroidMkProcMacroLibs...) entries.AddStrings("LOCAL_PROC_MACRO_LIBRARIES", mod.Properties.AndroidMkProcMacroLibs...)
@ -89,14 +89,15 @@ func (test *testDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidM
ctx.SubAndroidMk(ret, test.binaryDecorator) ctx.SubAndroidMk(ret, test.binaryDecorator)
ret.Class = "NATIVE_TESTS" ret.Class = "NATIVE_TESTS"
ret.ExtraEntries = append(ret.ExtraEntries, func(entries *android.AndroidMkEntries) { ret.ExtraEntries = append(ret.ExtraEntries,
entries.AddCompatibilityTestSuites(test.Properties.Test_suites...) func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if test.testConfig != nil { entries.AddCompatibilityTestSuites(test.Properties.Test_suites...)
entries.SetString("LOCAL_FULL_TEST_CONFIG", test.testConfig.String()) if test.testConfig != nil {
} entries.SetString("LOCAL_FULL_TEST_CONFIG", test.testConfig.String())
entries.SetBoolIfTrue("LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG", !BoolDefault(test.Properties.Auto_gen_config, true)) }
entries.SetBoolIfTrue("LOCAL_IS_UNIT_TEST", Bool(test.Properties.Test_options.Unit_test)) entries.SetBoolIfTrue("LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG", !BoolDefault(test.Properties.Auto_gen_config, true))
}) entries.SetBoolIfTrue("LOCAL_IS_UNIT_TEST", Bool(test.Properties.Test_options.Unit_test))
})
cc.AndroidMkWriteTestData(test.data, ret) cc.AndroidMkWriteTestData(test.data, ret)
} }
@ -134,13 +135,14 @@ func (sourceProvider *BaseSourceProvider) AndroidMk(ctx AndroidMkContext, ret *a
ret.Class = "ETC" ret.Class = "ETC"
ret.OutputFile = android.OptionalPathForPath(outFile) ret.OutputFile = android.OptionalPathForPath(outFile)
ret.SubName += sourceProvider.subName ret.SubName += sourceProvider.subName
ret.ExtraEntries = append(ret.ExtraEntries, func(entries *android.AndroidMkEntries) { ret.ExtraEntries = append(ret.ExtraEntries,
_, file := filepath.Split(outFile.String()) func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
stem, suffix, _ := android.SplitFileExt(file) _, file := filepath.Split(outFile.String())
entries.SetString("LOCAL_MODULE_SUFFIX", suffix) stem, suffix, _ := android.SplitFileExt(file)
entries.SetString("LOCAL_MODULE_STEM", stem) entries.SetString("LOCAL_MODULE_SUFFIX", suffix)
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true) entries.SetString("LOCAL_MODULE_STEM", stem)
}) entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
})
} }
func (bindgen *bindgenDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkEntries) { func (bindgen *bindgenDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkEntries) {
@ -165,12 +167,13 @@ func (compiler *baseCompiler) AndroidMk(ctx AndroidMkContext, ret *android.Andro
unstrippedOutputFile = ret.OutputFile unstrippedOutputFile = ret.OutputFile
ret.OutputFile = compiler.strippedOutputFile ret.OutputFile = compiler.strippedOutputFile
} }
ret.ExtraEntries = append(ret.ExtraEntries, func(entries *android.AndroidMkEntries) { ret.ExtraEntries = append(ret.ExtraEntries,
entries.SetOptionalPath("LOCAL_SOONG_UNSTRIPPED_BINARY", unstrippedOutputFile) func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
path, file := filepath.Split(compiler.path.ToMakePath().String()) entries.SetOptionalPath("LOCAL_SOONG_UNSTRIPPED_BINARY", unstrippedOutputFile)
stem, suffix, _ := android.SplitFileExt(file) path, file := filepath.Split(compiler.path.ToMakePath().String())
entries.SetString("LOCAL_MODULE_SUFFIX", suffix) stem, suffix, _ := android.SplitFileExt(file)
entries.SetString("LOCAL_MODULE_PATH", path) entries.SetString("LOCAL_MODULE_SUFFIX", suffix)
entries.SetString("LOCAL_MODULE_STEM", stem) entries.SetString("LOCAL_MODULE_PATH", path)
}) entries.SetString("LOCAL_MODULE_STEM", stem)
})
} }

View File

@ -246,7 +246,7 @@ func (s *ShBinary) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(s.outputFilePath), OutputFile: android.OptionalPathForPath(s.outputFilePath),
Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
s.customAndroidMkEntries(entries) s.customAndroidMkEntries(entries)
entries.SetString("LOCAL_MODULE_RELATIVE_PATH", proptools.String(s.properties.Sub_dir)) entries.SetString("LOCAL_MODULE_RELATIVE_PATH", proptools.String(s.properties.Sub_dir))
}, },
@ -395,7 +395,7 @@ func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(s.outputFilePath), OutputFile: android.OptionalPathForPath(s.outputFilePath),
Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
s.customAndroidMkEntries(entries) s.customAndroidMkEntries(entries)
entries.SetPath("LOCAL_MODULE_PATH", s.installDir.ToMakePath()) entries.SetPath("LOCAL_MODULE_PATH", s.installDir.ToMakePath())
entries.AddCompatibilityTestSuites(s.testProperties.Test_suites...) entries.AddCompatibilityTestSuites(s.testProperties.Test_suites...)

View File

@ -61,7 +61,7 @@ func testShBinary(t *testing.T, bp string) (*android.TestContext, android.Config
} }
func TestShTestSubDir(t *testing.T) { func TestShTestSubDir(t *testing.T) {
ctx, config := testShBinary(t, ` ctx, _ := testShBinary(t, `
sh_test { sh_test {
name: "foo", name: "foo",
src: "test.sh", src: "test.sh",
@ -71,7 +71,7 @@ func TestShTestSubDir(t *testing.T) {
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest) mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0] entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
expectedPath := "/tmp/target/product/test_device/data/nativetest64/foo_test" expectedPath := "/tmp/target/product/test_device/data/nativetest64/foo_test"
actualPath := entries.EntryMap["LOCAL_MODULE_PATH"][0] actualPath := entries.EntryMap["LOCAL_MODULE_PATH"][0]
@ -81,7 +81,7 @@ func TestShTestSubDir(t *testing.T) {
} }
func TestShTest(t *testing.T) { func TestShTest(t *testing.T) {
ctx, config := testShBinary(t, ` ctx, _ := testShBinary(t, `
sh_test { sh_test {
name: "foo", name: "foo",
src: "test.sh", src: "test.sh",
@ -95,7 +95,7 @@ func TestShTest(t *testing.T) {
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest) mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0] entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
expectedPath := "/tmp/target/product/test_device/data/nativetest64/foo" expectedPath := "/tmp/target/product/test_device/data/nativetest64/foo"
actualPath := entries.EntryMap["LOCAL_MODULE_PATH"][0] actualPath := entries.EntryMap["LOCAL_MODULE_PATH"][0]
@ -111,7 +111,7 @@ func TestShTest(t *testing.T) {
} }
func TestShTest_dataModules(t *testing.T) { func TestShTest_dataModules(t *testing.T) {
ctx, config := testShBinary(t, ` ctx, _ := testShBinary(t, `
sh_test { sh_test {
name: "foo", name: "foo",
src: "test.sh", src: "test.sh",
@ -157,7 +157,7 @@ func TestShTest_dataModules(t *testing.T) {
} }
mod := variant.Module().(*ShTest) mod := variant.Module().(*ShTest)
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0] entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
expectedData := []string{ expectedData := []string{
filepath.Join(buildDir, ".intermediates/bar", arch, ":bar"), filepath.Join(buildDir, ".intermediates/bar", arch, ":bar"),
filepath.Join(buildDir, ".intermediates/foo", arch, "relocated/:lib64/libbar"+libExt), filepath.Join(buildDir, ".intermediates/foo", arch, "relocated/:lib64/libbar"+libExt),
@ -190,7 +190,7 @@ func TestShTestHost(t *testing.T) {
} }
func TestShTestHost_dataDeviceModules(t *testing.T) { func TestShTestHost_dataDeviceModules(t *testing.T) {
ctx, config := testShBinary(t, ` ctx, _ := testShBinary(t, `
sh_test_host { sh_test_host {
name: "foo", name: "foo",
src: "test.sh", src: "test.sh",
@ -227,7 +227,7 @@ func TestShTestHost_dataDeviceModules(t *testing.T) {
} }
mod := variant.Module().(*ShTest) mod := variant.Module().(*ShTest)
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0] entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
expectedData := []string{ expectedData := []string{
filepath.Join(buildDir, ".intermediates/bar/android_arm64_armv8-a/:bar"), filepath.Join(buildDir, ".intermediates/bar/android_arm64_armv8-a/:bar"),
// libbar has been relocated, and so has a variant that matches the host arch. // libbar has been relocated, and so has a variant that matches the host arch.