Add imports property to py_library rules

This is to avoid having it hardcoded in a fork of the
py_library rule.

Most import attributes should just be set to ".", but
our previous solution always hardcoded it to ".." instead,
for ndkstubgen. ndkstubgen uses pkg_path: "ndkstubgen",
i.e., it set pkg_path to the name of the folder that
contained the Android.bp file. In this specific scenario,
imports = ".." works. Recreate that behavior here as well,
because we don't handle pkg_path properly yet.

Fixes: 233081071
Test: build/bazel/ci/bp2build.sh
Change-Id: Ib5e6a8edf428c74d4b5947f0ec53a2151001367a
This commit is contained in:
Cole Faust
2022-05-18 10:57:33 -07:00
parent 53c6c67cbb
commit b09da7e863
4 changed files with 109 additions and 7 deletions

View File

@@ -119,8 +119,8 @@ func runBp2BuildTestCase(t *testing.T, registerModuleTypes func(ctx android.Regi
return
}
errs := append(parseErrs, resolveDepsErrs...)
if tc.expectedErr != nil && checkError(t, errs, tc.expectedErr) {
parseAndResolveErrs := append(parseErrs, resolveDepsErrs...)
if tc.expectedErr != nil && checkError(t, parseAndResolveErrs, tc.expectedErr) {
return
}
@@ -135,7 +135,7 @@ func runBp2BuildTestCase(t *testing.T, registerModuleTypes func(ctx android.Regi
if checkError(t, errs, tc.expectedErr) {
return
} else {
t.Errorf("Expected error: %q, got: %q", tc.expectedErr, errs)
t.Errorf("Expected error: %q, got: %q and %q", tc.expectedErr, errs, parseAndResolveErrs)
}
} else {
android.FailIfErrored(t, errs)