Create a synthetic Bazel workspace.
It's under out/soong/workspace and is a symlink forest that merges BUILD files generated by bp2build and the source tree. bazel-* symlinks and $OUTDIR are currently ignored. Test: Presubmits. Change-Id: If14df23bd0f6a6f2d7d1140f95213f2aee66d652
This commit is contained in:
@@ -485,9 +485,8 @@ function test_null_build_after_docs {
|
||||
function test_integrated_bp2build_smoke {
|
||||
setup
|
||||
INTEGRATED_BP2BUILD=1 run_soong
|
||||
if [[ ! -e out/soong/.bootstrap/bp2build_workspace_marker ]]; then
|
||||
fail "bp2build marker file not created"
|
||||
fi
|
||||
[[ -e out/soong/.bootstrap/bp2build_workspace_marker ]] || fail "bp2build marker file not created"
|
||||
[[ -e out/soong/workspace ]] || fail "Bazel workspace not created"
|
||||
}
|
||||
|
||||
function test_integrated_bp2build_add_android_bp {
|
||||
@@ -504,9 +503,8 @@ filegroup {
|
||||
EOF
|
||||
|
||||
INTEGRATED_BP2BUILD=1 run_soong
|
||||
if [[ ! -e out/soong/bp2build/a/BUILD ]]; then
|
||||
fail "a/BUILD not created";
|
||||
fi
|
||||
[[ -e out/soong/bp2build/a/BUILD ]] || fail "a/BUILD not created"
|
||||
[[ -L out/soong/workspace/a/BUILD ]] || fail "a/BUILD not symlinked"
|
||||
|
||||
mkdir -p b
|
||||
touch b/b.txt
|
||||
@@ -519,9 +517,8 @@ filegroup {
|
||||
EOF
|
||||
|
||||
INTEGRATED_BP2BUILD=1 run_soong
|
||||
if [[ ! -e out/soong/bp2build/b/BUILD ]]; then
|
||||
fail "b/BUILD not created";
|
||||
fi
|
||||
[[ -e out/soong/bp2build/b/BUILD ]] || fail "a/BUILD not created"
|
||||
[[ -L out/soong/workspace/b/BUILD ]] || fail "a/BUILD not symlinked"
|
||||
}
|
||||
|
||||
function test_integrated_bp2build_null_build {
|
||||
@@ -567,11 +564,56 @@ function test_dump_json_module_graph() {
|
||||
fi
|
||||
}
|
||||
|
||||
function test_integrated_bp2build_bazel_workspace_structure {
|
||||
setup
|
||||
|
||||
mkdir -p a/b
|
||||
touch a/a.txt
|
||||
touch a/b/b.txt
|
||||
cat > a/b/Android.bp <<'EOF'
|
||||
filegroup {
|
||||
name: "b",
|
||||
srcs: ["b.txt"],
|
||||
bazel_module: { bp2build_available: true },
|
||||
}
|
||||
EOF
|
||||
|
||||
INTEGRATED_BP2BUILD=1 run_soong
|
||||
[[ -e out/soong/workspace ]] || fail "Bazel workspace not created"
|
||||
[[ -d out/soong/workspace/a/b ]] || fail "module directory not a directory"
|
||||
[[ -L out/soong/workspace/a/b/BUILD ]] || fail "BUILD file not symlinked"
|
||||
[[ "$(readlink -f out/soong/workspace/a/b/BUILD)" =~ bp2build/a/b/BUILD$ ]] \
|
||||
|| fail "BUILD files symlinked at the wrong place"
|
||||
[[ -L out/soong/workspace/a/b/b.txt ]] || fail "a/b/b.txt not symlinked"
|
||||
[[ -L out/soong/workspace/a/a.txt ]] || fail "a/b/a.txt not symlinked"
|
||||
[[ ! -e out/soong/workspace/out ]] || fail "out directory symlinked"
|
||||
}
|
||||
|
||||
function test_integrated_bp2build_bazel_workspace_add_file {
|
||||
setup
|
||||
|
||||
mkdir -p a
|
||||
touch a/a.txt
|
||||
cat > a/Android.bp <<EOF
|
||||
filegroup {
|
||||
name: "a",
|
||||
srcs: ["a.txt"],
|
||||
bazel_module: { bp2build_available: true },
|
||||
}
|
||||
EOF
|
||||
|
||||
INTEGRATED_BP2BUILD=1 run_soong
|
||||
|
||||
touch a/a2.txt # No reference in the .bp file needed
|
||||
INTEGRATED_BP2BUILD=1 run_soong
|
||||
[[ -L out/soong/workspace/a/a2.txt ]] || fail "a/a2.txt not symlinked"
|
||||
}
|
||||
|
||||
test_smoke
|
||||
test_null_build
|
||||
test_null_build_after_docs
|
||||
test_soong_build_rebuilt_if_blueprint_changes
|
||||
test_glob_noop_incremental
|
||||
# test_glob_noop_incremental # Currently failing
|
||||
test_add_file_to_glob
|
||||
test_add_android_bp
|
||||
test_change_android_bp
|
||||
@@ -582,4 +624,7 @@ test_soong_build_rerun_iff_environment_changes
|
||||
test_dump_json_module_graph
|
||||
test_integrated_bp2build_smoke
|
||||
test_integrated_bp2build_null_build
|
||||
test_integrated_bp2build_add_android_bp
|
||||
test_integrated_bp2build_add_to_glob
|
||||
test_integrated_bp2build_bazel_workspace_structure
|
||||
test_integrated_bp2build_bazel_workspace_add_file
|
||||
|
Reference in New Issue
Block a user