From aa2555387d214fc0292406d10714558054d794f3 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 3 Jul 2020 13:18:24 -0700 Subject: 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 --- sh/sh_binary.go | 4 ++-- sh/sh_binary_test.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'sh') diff --git a/sh/sh_binary.go b/sh/sh_binary.go index 54dfc2467..58f8cf69e 100644 --- a/sh/sh_binary.go +++ b/sh/sh_binary.go @@ -246,7 +246,7 @@ func (s *ShBinary) AndroidMkEntries() []android.AndroidMkEntries { OutputFile: android.OptionalPathForPath(s.outputFilePath), Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk", ExtraEntries: []android.AndroidMkExtraEntriesFunc{ - func(entries *android.AndroidMkEntries) { + func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { s.customAndroidMkEntries(entries) 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), Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk", ExtraEntries: []android.AndroidMkExtraEntriesFunc{ - func(entries *android.AndroidMkEntries) { + func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { s.customAndroidMkEntries(entries) entries.SetPath("LOCAL_MODULE_PATH", s.installDir.ToMakePath()) entries.AddCompatibilityTestSuites(s.testProperties.Test_suites...) diff --git a/sh/sh_binary_test.go b/sh/sh_binary_test.go index c664461a9..fb7ab1358 100644 --- a/sh/sh_binary_test.go +++ b/sh/sh_binary_test.go @@ -61,7 +61,7 @@ func testShBinary(t *testing.T, bp string) (*android.TestContext, android.Config } func TestShTestSubDir(t *testing.T) { - ctx, config := testShBinary(t, ` + ctx, _ := testShBinary(t, ` sh_test { name: "foo", src: "test.sh", @@ -71,7 +71,7 @@ func TestShTestSubDir(t *testing.T) { 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" actualPath := entries.EntryMap["LOCAL_MODULE_PATH"][0] @@ -81,7 +81,7 @@ func TestShTestSubDir(t *testing.T) { } func TestShTest(t *testing.T) { - ctx, config := testShBinary(t, ` + ctx, _ := testShBinary(t, ` sh_test { name: "foo", src: "test.sh", @@ -95,7 +95,7 @@ func TestShTest(t *testing.T) { 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" actualPath := entries.EntryMap["LOCAL_MODULE_PATH"][0] @@ -111,7 +111,7 @@ func TestShTest(t *testing.T) { } func TestShTest_dataModules(t *testing.T) { - ctx, config := testShBinary(t, ` + ctx, _ := testShBinary(t, ` sh_test { name: "foo", src: "test.sh", @@ -157,7 +157,7 @@ func TestShTest_dataModules(t *testing.T) { } mod := variant.Module().(*ShTest) - entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0] + entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0] expectedData := []string{ filepath.Join(buildDir, ".intermediates/bar", arch, ":bar"), 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) { - ctx, config := testShBinary(t, ` + ctx, _ := testShBinary(t, ` sh_test_host { name: "foo", src: "test.sh", @@ -227,7 +227,7 @@ func TestShTestHost_dataDeviceModules(t *testing.T) { } mod := variant.Module().(*ShTest) - entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0] + entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0] expectedData := []string{ filepath.Join(buildDir, ".intermediates/bar/android_arm64_armv8-a/:bar"), // libbar has been relocated, and so has a variant that matches the host arch. -- cgit v1.2.3