Handle already existing targets of different name

In other words, if, in bp2build, module "foo" would generate "foo",
and "foo_two", and "foo_two" already exists in a build file,
bp2build should label "foo" as being unconvertible.

Fixes: 301321658
Fixes: 301312582
Bug: 285631638
Test: Unit tests
Test: Verified that `m bp2build` results in bit-for-bit identical
contents for out/soong/bp2build before and after this change.

Change-Id: Icbbdd69fce83579ec9b172d04b2bf1f294698f70
This commit is contained in:
Chris Parsons
2023-09-21 20:36:35 +00:00
parent 92c59496e0
commit 0c4de1f234
9 changed files with 86 additions and 79 deletions

View File

@@ -110,7 +110,7 @@ func TestConvertAndroidLibraryImport(t *testing.T) {
"import.aar": "",
"dep.aar": "",
},
StubbedBuildDefinitions: []string{"static_lib_dep", "prebuilt_static_import_dep"},
StubbedBuildDefinitions: []string{"static_lib_dep", "static_import_dep", "static_import_dep-neverlink"},
// Bazel's aar_import can only export *_import targets, so we expect
// only "static_import_dep" in exports, but both "static_lib_dep" and
// "static_import_dep" in deps
@@ -125,6 +125,7 @@ android_library_import {
// TODO: b/301007952 - This dep is needed because android_library_import must have aars set.
android_library_import {
name: "static_import_dep",
aars: ["import.aar"],
}
`,
ExpectedBazelTargets: []string{