Merge "Add ctx to AndroidMkExtraEntriesFunc" am: 277303f042
am: 5b72de988f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1360943 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I90ae8f53df60dd6bdbc9ae040c44a28a334017e3
This commit is contained in:
@@ -41,7 +41,7 @@ func (library *Library) AndroidMkEntriesHostDex() android.AndroidMkEntries {
|
||||
Required: library.deviceProperties.Target.Hostdex.Required,
|
||||
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
entries.SetBool("LOCAL_IS_HOST_MODULE", true)
|
||||
entries.SetPath("LOCAL_PREBUILT_MODULE_FILE", output)
|
||||
if library.dexJarFile != nil {
|
||||
@@ -74,7 +74,7 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(checkedModulePaths[0]),
|
||||
Include: "$(BUILD_PHONY_PACKAGE)",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
entries.AddStrings("LOCAL_ADDITIONAL_CHECKED_MODULE", checkedModulePaths.Strings()...)
|
||||
},
|
||||
},
|
||||
@@ -88,7 +88,7 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(library.outputFile),
|
||||
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
if len(library.logtagsSrcs) > 0 {
|
||||
var logtags []string
|
||||
for _, l := range library.logtagsSrcs {
|
||||
@@ -152,7 +152,7 @@ func testSuiteComponent(entries *android.AndroidMkEntries, test_suites []string)
|
||||
func (j *Test) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
entriesList := j.Library.AndroidMkEntries()
|
||||
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)
|
||||
if j.testConfig != nil {
|
||||
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 {
|
||||
entriesList := j.Library.AndroidMkEntries()
|
||||
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)
|
||||
})
|
||||
|
||||
@@ -198,7 +198,7 @@ func (prebuilt *Import) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile),
|
||||
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", !Bool(prebuilt.properties.Installable))
|
||||
if prebuilt.dexJarFile != nil {
|
||||
entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile)
|
||||
@@ -223,7 +223,7 @@ func (prebuilt *DexImport) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(prebuilt.maybeStrippedDexJarFile),
|
||||
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
if prebuilt.dexJarFile != nil {
|
||||
entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile)
|
||||
}
|
||||
@@ -247,7 +247,7 @@ func (prebuilt *AARImport) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(prebuilt.classpathFile),
|
||||
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
|
||||
entries.SetPath("LOCAL_SOONG_HEADER_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),
|
||||
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
||||
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_CLASSES_JAR", binary.implementationAndResourcesJar)
|
||||
if binary.dexJarFile != nil {
|
||||
@@ -291,7 +291,7 @@ func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
Class: "EXECUTABLES",
|
||||
OutputFile: android.OptionalPathForPath(binary.wrapperFile),
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
entries.SetBool("LOCAL_STRIP_MODULE", false)
|
||||
},
|
||||
},
|
||||
@@ -317,7 +317,7 @@ func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(app.outputFile),
|
||||
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
// App module names can be overridden.
|
||||
entries.SetString("LOCAL_MODULE", app.installApkName)
|
||||
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", app.appProperties.PreventInstall)
|
||||
@@ -432,7 +432,7 @@ func (a *AndroidApp) getOverriddenPackages() []string {
|
||||
func (a *AndroidTest) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
entriesList := a.AndroidApp.AndroidMkEntries()
|
||||
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)
|
||||
if a.testConfig != nil {
|
||||
entries.SetPath("LOCAL_FULL_TEST_CONFIG", a.testConfig)
|
||||
@@ -448,7 +448,7 @@ func (a *AndroidTest) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
func (a *AndroidTestHelperApp) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
entriesList := a.AndroidApp.AndroidMkEntries()
|
||||
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)
|
||||
})
|
||||
|
||||
@@ -464,7 +464,7 @@ func (a *AndroidLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
entriesList := a.Library.AndroidMkEntries()
|
||||
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 {
|
||||
entries.SetPath("LOCAL_SOONG_AAR", a.aarFile)
|
||||
}
|
||||
@@ -492,7 +492,7 @@ func (jd *Javadoc) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(jd.stubsSrcJar),
|
||||
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
if BoolDefault(jd.properties.Installable, true) {
|
||||
entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", jd.docZip)
|
||||
}
|
||||
@@ -510,7 +510,7 @@ func (ddoc *Droiddoc) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(ddoc.Javadoc.docZip),
|
||||
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
if ddoc.Javadoc.docZip != nil {
|
||||
entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", ddoc.Javadoc.docZip)
|
||||
}
|
||||
@@ -539,7 +539,7 @@ func (dstubs *Droidstubs) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: outputFile,
|
||||
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
if dstubs.Javadoc.stubsSrcJar != nil {
|
||||
entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", dstubs.Javadoc.stubsSrcJar)
|
||||
}
|
||||
@@ -638,7 +638,7 @@ func (a *AndroidAppImport) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(a.outputFile),
|
||||
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", a.Privileged())
|
||||
entries.SetString("LOCAL_CERTIFICATE", a.certificate.AndroidMkString())
|
||||
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", a.properties.Overrides...)
|
||||
@@ -657,7 +657,7 @@ func (a *AndroidAppImport) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
func (a *AndroidTestImport) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
entriesList := a.AndroidAppImport.AndroidMkEntries()
|
||||
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)
|
||||
androidMkWriteTestData(a.data, entries)
|
||||
})
|
||||
@@ -678,7 +678,7 @@ func (r *RuntimeResourceOverlay) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(r.outputFile),
|
||||
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString())
|
||||
entries.SetPath("LOCAL_MODULE_PATH", r.installDir.ToMakePath())
|
||||
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", r.properties.Overrides...)
|
||||
@@ -694,7 +694,7 @@ func (apkSet *AndroidAppSet) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(apkSet.packedOutput),
|
||||
Include: "$(BUILD_SYSTEM)/soong_android_app_set.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", apkSet.Privileged())
|
||||
entries.SetString("LOCAL_APK_SET_INSTALL_FILE", apkSet.InstallFile())
|
||||
entries.SetPath("LOCAL_APKCERTS_FILE", apkSet.apkcertsFile)
|
||||
|
@@ -22,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func TestRequired(t *testing.T) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
java_library {
|
||||
name: "foo",
|
||||
srcs: ["a.java"],
|
||||
@@ -31,7 +31,7 @@ func TestRequired(t *testing.T) {
|
||||
`)
|
||||
|
||||
mod := ctx.ModuleForTests("foo", "android_common").Module()
|
||||
entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
|
||||
entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
|
||||
|
||||
expected := []string{"libfoo"}
|
||||
actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"]
|
||||
@@ -41,7 +41,7 @@ func TestRequired(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHostdex(t *testing.T) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
java_library {
|
||||
name: "foo",
|
||||
srcs: ["a.java"],
|
||||
@@ -50,7 +50,7 @@ func TestHostdex(t *testing.T) {
|
||||
`)
|
||||
|
||||
mod := ctx.ModuleForTests("foo", "android_common").Module()
|
||||
entriesList := android.AndroidMkEntriesForTest(t, config, "", mod)
|
||||
entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
|
||||
if len(entriesList) != 2 {
|
||||
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) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
java_library {
|
||||
name: "foo",
|
||||
srcs: ["a.java"],
|
||||
@@ -81,7 +81,7 @@ func TestHostdexRequired(t *testing.T) {
|
||||
`)
|
||||
|
||||
mod := ctx.ModuleForTests("foo", "android_common").Module()
|
||||
entriesList := android.AndroidMkEntriesForTest(t, config, "", mod)
|
||||
entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
|
||||
if len(entriesList) != 2 {
|
||||
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) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
java_library {
|
||||
name: "foo",
|
||||
srcs: ["a.java"],
|
||||
@@ -116,7 +116,7 @@ func TestHostdexSpecificRequired(t *testing.T) {
|
||||
`)
|
||||
|
||||
mod := ctx.ModuleForTests("foo", "android_common").Module()
|
||||
entriesList := android.AndroidMkEntriesForTest(t, config, "", mod)
|
||||
entriesList := android.AndroidMkEntriesForTest(t, ctx, mod)
|
||||
if len(entriesList) != 2 {
|
||||
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) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
java_sdk_library {
|
||||
name: "foo-shared_library",
|
||||
srcs: ["a.java"],
|
||||
@@ -159,7 +159,7 @@ func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
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"]
|
||||
if !reflect.DeepEqual(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) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
java_import {
|
||||
name: "my-java-import",
|
||||
jars: ["a.jar"],
|
||||
@@ -178,7 +178,7 @@ func TestImportSoongDexJar(t *testing.T) {
|
||||
`)
|
||||
|
||||
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"
|
||||
actualSoongDexJar := entries.EntryMap["LOCAL_SOONG_DEX_JAR"]
|
||||
|
||||
|
@@ -232,7 +232,7 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAndroidAppImport_Filename(t *testing.T) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
android_app_import {
|
||||
name: "foo",
|
||||
apk: "prebuilts/apk/app.apk",
|
||||
@@ -269,8 +269,7 @@ func TestAndroidAppImport_Filename(t *testing.T) {
|
||||
|
||||
a := variant.Module().(*AndroidAppImport)
|
||||
expectedValues := []string{test.expected}
|
||||
actualValues := android.AndroidMkEntriesForTest(
|
||||
t, config, "", a)[0].EntryMap["LOCAL_INSTALLED_MODULE_STEM"]
|
||||
actualValues := android.AndroidMkEntriesForTest(t, ctx, a)[0].EntryMap["LOCAL_INSTALLED_MODULE_STEM"]
|
||||
if !reflect.DeepEqual(actualValues, expectedValues) {
|
||||
t.Errorf("Incorrect LOCAL_INSTALLED_MODULE_STEM value '%s', expected '%s'",
|
||||
actualValues, expectedValues)
|
||||
@@ -394,7 +393,7 @@ func TestAndroidAppImport_overridesDisabledAndroidApp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAndroidAppImport_frameworkRes(t *testing.T) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
android_app_import {
|
||||
name: "framework-res",
|
||||
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 := "."
|
||||
// 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) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
android_test_import {
|
||||
name: "foo",
|
||||
apk: "prebuilts/apk/app.apk",
|
||||
@@ -471,7 +470,7 @@ func TestAndroidTestImport(t *testing.T) {
|
||||
test := ctx.ModuleForTests("foo", "android_common").Module().(*AndroidTestImport)
|
||||
|
||||
// Check android mks.
|
||||
entries := android.AndroidMkEntriesForTest(t, config, "", test)[0]
|
||||
entries := android.AndroidMkEntriesForTest(t, ctx, test)[0]
|
||||
expected := []string{"tests"}
|
||||
actual := entries.EntryMap["LOCAL_MODULE_TAGS"]
|
||||
if !reflect.DeepEqual(expected, actual) {
|
||||
|
@@ -22,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func TestAndroidAppSet(t *testing.T) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
android_app_set {
|
||||
name: "foo",
|
||||
set: "prebuilts/apks/app.apks",
|
||||
@@ -40,7 +40,7 @@ func TestAndroidAppSet(t *testing.T) {
|
||||
if s := params.Args["partition"]; s != "system" {
|
||||
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"]
|
||||
expectedInstallFile := []string{"foo.apk"}
|
||||
if !reflect.DeepEqual(actualInstallFile, expectedInstallFile) {
|
||||
|
@@ -2509,7 +2509,7 @@ func TestAidlFlagsArePassedToTheAidlCompiler(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDataNativeBinaries(t *testing.T) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
java_test_host {
|
||||
name: "foo",
|
||||
srcs: ["a.java"],
|
||||
@@ -2525,7 +2525,7 @@ func TestDataNativeBinaries(t *testing.T) {
|
||||
buildOS := android.BuildOs.String()
|
||||
|
||||
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"}
|
||||
actual := entries.EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"]
|
||||
if !reflect.DeepEqual(expected, actual) {
|
||||
|
@@ -131,7 +131,7 @@ func (p *platformCompatConfig) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
OutputFile: android.OptionalPathForPath(p.configFile),
|
||||
Include: "$(BUILD_PREBUILT)",
|
||||
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_INSTALLED_MODULE_STEM", p.configFile.Base())
|
||||
},
|
||||
|
@@ -96,7 +96,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
|
||||
if 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"]
|
||||
expectedPath := []string{"build/make/target/product/security/platform.x509.pem"}
|
||||
if !reflect.DeepEqual(path, expectedPath) {
|
||||
@@ -112,7 +112,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
|
||||
|
||||
// A themed module has a different device location
|
||||
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"]
|
||||
expectedPath = []string{"/tmp/target/product/test_device/product/overlay/faza"}
|
||||
if !reflect.DeepEqual(path, expectedPath) {
|
||||
@@ -127,7 +127,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
|
||||
ctx, config := testJava(t, `
|
||||
ctx, _ := testJava(t, `
|
||||
java_defaults {
|
||||
name: "rro_defaults",
|
||||
theme: "default_theme",
|
||||
@@ -159,7 +159,7 @@ func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
|
||||
}
|
||||
|
||||
// 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"}
|
||||
if !reflect.DeepEqual(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.
|
||||
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"}
|
||||
if !reflect.DeepEqual(path, expectedPath) {
|
||||
t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)
|
||||
@@ -345,7 +345,7 @@ func TestEnforceRRO_propagatesToDependencies(t *testing.T) {
|
||||
modules := []string{"foo", "bar"}
|
||||
for _, moduleName := range modules {
|
||||
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"]
|
||||
if !reflect.DeepEqual(actualRRODirs, testCase.rroDirs[moduleName]) {
|
||||
t.Errorf("exected %s LOCAL_SOONG_PRODUCT_RRO_DIRS entry: %v\ngot:%q",
|
||||
|
@@ -2238,7 +2238,7 @@ func (module *sdkLibraryXml) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
Class: "ETC",
|
||||
OutputFile: android.OptionalPathForPath(module.outputFilePath),
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
entries.SetString("LOCAL_MODULE_TAGS", "optional")
|
||||
entries.SetString("LOCAL_MODULE_PATH", module.installDirPath.ToMakePath().String())
|
||||
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", module.outputFilePath.Base())
|
||||
|
Reference in New Issue
Block a user