Support multiple sources for prebuilt_etc

Keep the Src attribute for compatibility. The new attribute (Srcs) is
mutually exclusive with Src.

Keep SourceFilePath and OutputFile for compatibility with other modules.
These can be removed in a follow up change.

Bug: 328313691
Test: presubmit
Test: m blueprint_tests
Test: prebuilts/build-tools/build-prebuilts.sh (on build-tools branch)
Change-Id: I5d5b2657715a7180a829c7ed0f501872d561b662
This commit is contained in:
Thiébaud Weksteen
2024-03-18 14:06:00 +11:00
parent 64342427b8
commit 00e8b31ee6
4 changed files with 168 additions and 83 deletions

View File

@@ -96,7 +96,7 @@ func TestPrebuiltEtcOutputPath(t *testing.T) {
`)
p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
android.AssertStringEquals(t, "output file path", "foo.installed.conf", p.outputFilePath.Base())
android.AssertStringEquals(t, "output file path", "foo.installed.conf", p.outputFilePaths[0].Base())
}
func TestPrebuiltEtcGlob(t *testing.T) {
@@ -113,10 +113,24 @@ func TestPrebuiltEtcGlob(t *testing.T) {
`)
p := result.Module("my_foo", "android_arm64_armv8-a").(*PrebuiltEtc)
android.AssertStringEquals(t, "my_foo output file path", "my_foo", p.outputFilePath.Base())
android.AssertStringEquals(t, "my_foo output file path", "my_foo", p.outputFilePaths[0].Base())
p = result.Module("my_bar", "android_arm64_armv8-a").(*PrebuiltEtc)
android.AssertStringEquals(t, "my_bar output file path", "bar.conf", p.outputFilePath.Base())
android.AssertStringEquals(t, "my_bar output file path", "bar.conf", p.outputFilePaths[0].Base())
}
func TestPrebuiltEtcMultipleSrcs(t *testing.T) {
result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
prebuilt_etc {
name: "foo",
srcs: ["*.conf"],
}
`)
p := result.Module("foo", "android_arm64_armv8-a").(*PrebuiltEtc)
android.AssertStringEquals(t, "output file path", "bar.conf", p.outputFilePaths[0].Base())
android.AssertStringEquals(t, "output file path", "baz.conf", p.outputFilePaths[1].Base())
android.AssertStringEquals(t, "output file path", "foo.conf", p.outputFilePaths[2].Base())
}
func TestPrebuiltEtcAndroidMk(t *testing.T) {