Export Soong module type to LOCAL_SOONG_MODULE_TYPE to Make for SBOM generation.

Bug: 266726655
Test: CI

Change-Id: If5b1a77930a591b6061ca2749c9c5ad29b4491fb
This commit is contained in:
Wei Li
2023-01-04 17:12:24 -08:00
parent edec71adae
commit 598f92d704
8 changed files with 29 additions and 2 deletions

View File

@@ -363,11 +363,14 @@ func TestAndroidAppImport_Filename(t *testing.T) {
a := variant.Module().(*AndroidAppImport)
expectedValues := []string{test.expected}
actualValues := android.AndroidMkEntriesForTest(t, ctx, a)[0].EntryMap["LOCAL_INSTALLED_MODULE_STEM"]
entries := android.AndroidMkEntriesForTest(t, ctx, a)[0]
actualValues := entries.EntryMap["LOCAL_INSTALLED_MODULE_STEM"]
if !reflect.DeepEqual(actualValues, expectedValues) {
t.Errorf("Incorrect LOCAL_INSTALLED_MODULE_STEM value '%s', expected '%s'",
actualValues, expectedValues)
}
android.AssertStringEquals(t, "unexpected LOCAL_SOONG_MODULE_TYPE", "android_app_import", entries.EntryMap["LOCAL_SOONG_MODULE_TYPE"][0])
rule := variant.Rule("genProvenanceMetaData")
android.AssertStringEquals(t, "Invalid input", test.expectedArtifactPath, rule.Inputs[0].String())
android.AssertStringEquals(t, "Invalid output", test.expectedMetaDataPath, rule.Output.String())
@@ -560,6 +563,7 @@ func TestAndroidAppImport_frameworkRes(t *testing.T) {
} else if actualSoongResourceExportPackage[0] != expectedSoongResourceExportPackage {
t.Errorf("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE mismatch, actual: %s, expected: %s", actualSoongResourceExportPackage[0], expectedSoongResourceExportPackage)
}
android.AssertStringEquals(t, "unexpected LOCAL_SOONG_MODULE_TYPE", "android_app_import", entries.EntryMap["LOCAL_SOONG_MODULE_TYPE"][0])
}
func TestAndroidAppImport_relativeInstallPath(t *testing.T) {

View File

@@ -615,6 +615,13 @@ func TestPrebuilts(t *testing.T) {
android.AssertPathRelativeToTopEquals(t, "baz dex jar build path", expectedDexJar, bazDexJar)
ctx.ModuleForTests("qux", "android_common").Rule("Cp")
entries := android.AndroidMkEntriesForTest(t, ctx, fooModule.Module())[0]
android.AssertStringEquals(t, "unexpected LOCAL_SOONG_MODULE_TYPE", "java_library", entries.EntryMap["LOCAL_SOONG_MODULE_TYPE"][0])
entries = android.AndroidMkEntriesForTest(t, ctx, barModule.Module())[0]
android.AssertStringEquals(t, "unexpected LOCAL_SOONG_MODULE_TYPE", "java_import", entries.EntryMap["LOCAL_SOONG_MODULE_TYPE"][0])
entries = android.AndroidMkEntriesForTest(t, ctx, ctx.ModuleForTests("sdklib", "android_common").Module())[0]
android.AssertStringEquals(t, "unexpected LOCAL_SOONG_MODULE_TYPE", "java_sdk_library_import", entries.EntryMap["LOCAL_SOONG_MODULE_TYPE"][0])
}
func assertDeepEquals(t *testing.T, message string, expected interface{}, actual interface{}) {