Add an integration test for API export from another bazel package

This test ensures that API export works ok if the api file exists in a
different directory (precisely, package) than the *_api_contribution
target.

Test: tests/run_integration_tests.sh
Change-Id: I1ff171b93773b514a9a081f962606f4c28abe42e
This commit is contained in:
Spandan Das 2023-03-10 02:32:18 +00:00
parent 98cb85624c
commit 68bcbb588a

View file

@ -343,4 +343,29 @@ function test_api_bp2build_empty_build() {
run_bazel build --config=android --config=api_bp2build //:empty run_bazel build --config=android --config=api_bp2build //:empty
} }
# Verify that an *_api_contribution target can refer to an api file from
# another Bazel package.
function test_api_export_from_another_bazel_package() {
setup
# Parent dir Android.bp
mkdir -p foo
cat > foo/Android.bp << 'EOF'
cc_library {
name: "libfoo",
stubs: {
symbol_file: "api/libfoo.map.txt",
},
}
EOF
# Child dir Android.bp
mkdir -p foo/api
cat > foo/api/Android.bp << 'EOF'
package{}
EOF
touch foo/api/libfoo.map.txt
# Run test
run_soong api_bp2build
run_bazel build --config=android --config=api_bp2build //foo:libfoo.contribution
}
scan_and_run_tests scan_and_run_tests