Separate the files of bp2build and soong_build.
The following files are forked: - build-globs.ninja - The glob list files - .d files for the glob list files - The output file (build.ninja or the bp2build marker file) This makes bp2build and soong_build not overwrite each other's files they need for proper incrementality. Test: Presubmits. Change-Id: I69d192cbd36ecd9677f46f3fa095dfce6f872227
This commit is contained in:
@@ -144,7 +144,7 @@ EOF
|
||||
run_soong
|
||||
local ninja_mtime1=$(stat -c "%y" out/soong/build.ninja)
|
||||
|
||||
local glob_deps_file=out/soong/.primary/globs/0.d
|
||||
local glob_deps_file=out/soong/.bootstrap/globs/0.d
|
||||
|
||||
if [ -e "$glob_deps_file" ]; then
|
||||
fail "Glob deps file unexpectedly written on first build"
|
||||
@@ -526,18 +526,14 @@ function test_bp2build_smoke {
|
||||
[[ -e out/soong/workspace ]] || fail "Bazel workspace not created"
|
||||
}
|
||||
|
||||
function test_bp2build_generates_fake_ninja_file {
|
||||
function test_bp2build_generates_marker_file {
|
||||
setup
|
||||
create_mock_bazel
|
||||
|
||||
run_bp2build
|
||||
|
||||
if [[ ! -f "./out/soong/build.ninja" ]]; then
|
||||
fail "./out/soong/build.ninja was not generated"
|
||||
fi
|
||||
|
||||
if ! grep "build nothing: phony" "./out/soong/build.ninja"; then
|
||||
fail "missing phony nothing target in out/soong/build.ninja"
|
||||
if [[ ! -f "./out/soong/.bootstrap/bp2build_workspace_marker" ]]; then
|
||||
fail "Marker file was not generated"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -577,10 +573,10 @@ function test_bp2build_null_build {
|
||||
setup
|
||||
|
||||
GENERATE_BAZEL_FILES=1 run_soong
|
||||
local mtime1=$(stat -c "%y" out/soong/build.ninja)
|
||||
local mtime1=$(stat -c "%y" out/soong/.bootstrap/bp2build_workspace_marker)
|
||||
|
||||
GENERATE_BAZEL_FILES=1 run_soong
|
||||
local mtime2=$(stat -c "%y" out/soong/build.ninja)
|
||||
local mtime2=$(stat -c "%y" out/soong/.bootstrap/bp2build_workspace_marker)
|
||||
|
||||
if [[ "$mtime1" != "$mtime2" ]]; then
|
||||
fail "Output Ninja file changed on null build"
|
||||
@@ -712,6 +708,41 @@ EOF
|
||||
grep -q "b/${GENERATED_BUILD_FILE_NAME}' exist" "$MOCK_TOP/errors" || fail "Error for b/${GENERATED_BUILD_FILE_NAME} not found"
|
||||
}
|
||||
|
||||
function test_bp2build_back_and_forth_null_build {
|
||||
setup
|
||||
|
||||
run_soong
|
||||
local output_mtime1=$(stat -c "%y" out/soong/build.ninja)
|
||||
|
||||
GENERATE_BAZEL_FILES=1 run_soong
|
||||
local output_mtime2=$(stat -c "%y" out/soong/build.ninja)
|
||||
if [[ "$output_mtime1" != "$output_mtime2" ]]; then
|
||||
fail "Output Ninja file changed when switching to bp2build"
|
||||
fi
|
||||
|
||||
local marker_mtime1=$(stat -c "%y" out/soong/.bootstrap/bp2build_workspace_marker)
|
||||
|
||||
run_soong
|
||||
local output_mtime3=$(stat -c "%y" out/soong/build.ninja)
|
||||
local marker_mtime2=$(stat -c "%y" out/soong/.bootstrap/bp2build_workspace_marker)
|
||||
if [[ "$output_mtime1" != "$output_mtime3" ]]; then
|
||||
fail "Output Ninja file changed when switching to regular build from bp2build"
|
||||
fi
|
||||
if [[ "$marker_mtime1" != "$marker_mtime2" ]]; then
|
||||
fail "bp2build marker file changed when switching to regular build from bp2build"
|
||||
fi
|
||||
|
||||
GENERATE_BAZEL_FILES=1 run_soong
|
||||
local output_mtime4=$(stat -c "%y" out/soong/build.ninja)
|
||||
local marker_mtime3=$(stat -c "%y" out/soong/.bootstrap/bp2build_workspace_marker)
|
||||
if [[ "$output_mtime1" != "$output_mtime4" ]]; then
|
||||
fail "Output Ninja file changed when switching back to bp2build"
|
||||
fi
|
||||
if [[ "$marker_mtime1" != "$marker_mtime3" ]]; then
|
||||
fail "bp2build marker file changed when switching back to bp2build"
|
||||
fi
|
||||
}
|
||||
|
||||
test_smoke
|
||||
test_null_build
|
||||
test_null_build_after_docs
|
||||
@@ -727,8 +758,9 @@ test_soong_build_rerun_iff_environment_changes
|
||||
test_dump_json_module_graph
|
||||
test_write_to_source_tree
|
||||
test_bp2build_smoke
|
||||
test_bp2build_generates_fake_ninja_file
|
||||
test_bp2build_generates_marker_file
|
||||
test_bp2build_null_build
|
||||
test_bp2build_back_and_forth_null_build
|
||||
test_bp2build_add_android_bp
|
||||
test_bp2build_add_to_glob
|
||||
test_bp2build_bazel_workspace_structure
|
||||
|
@@ -48,60 +48,6 @@ EOF
|
||||
|
||||
test_bp2build_null_build_with_globs
|
||||
|
||||
function test_soong_after_bp2build_regenerates_build_globs_ninja() {
|
||||
setup
|
||||
|
||||
mkdir -p foo/bar
|
||||
cat > foo/bar/Android.bp <<'EOF'
|
||||
filegroup {
|
||||
name: "bp2build-files",
|
||||
srcs: ["bp2build.*"],
|
||||
bazel_module: { bp2build_available: true },
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "soong-files",
|
||||
srcs: ["soong.*"],
|
||||
}
|
||||
EOF
|
||||
touch foo/bar/bp2build.txt foo/bar/soong.txt
|
||||
|
||||
build_globs_file="out/soong/.bootstrap/build-globs.ninja"
|
||||
|
||||
# Test: the build-globs file for bp2build should only contain the bp2build-files
|
||||
# glob, whereas the build-globs file for soong should contain both bp2build-files
|
||||
# and soong-files globs.
|
||||
|
||||
run_bp2build
|
||||
local output_mtime1=$(stat -c "%y" "${build_globs_file}")
|
||||
|
||||
if ! grep "\"foo/bar/bp2build.*\"" "${build_globs_file}"; then
|
||||
fail "bp2build filegroup globs not found in bp2build's globs file"
|
||||
fi
|
||||
|
||||
if grep "\"foo/bar/soong.*\"" "${build_globs_file}"; then
|
||||
fail "soong filegroup globs unexpectedly found in bp2build's globs file"
|
||||
fi
|
||||
|
||||
run_soong
|
||||
local output_mtime2=$(stat -c "%y" "${build_globs_file}")
|
||||
|
||||
if [[ "$output_mtime1" == "$output_mtime2" ]]; then
|
||||
fail "Output build-globs.ninja file did not change"
|
||||
fi
|
||||
|
||||
if ! grep "\"foo/bar/bp2build.*\"" "${build_globs_file}"; then
|
||||
fail "bp2build filegroup globs not found in bp2build's globs file"
|
||||
fi
|
||||
|
||||
if ! grep "\"foo/bar/soong.*\"" "${build_globs_file}"; then
|
||||
fail "soong filegroup globs not found in bp2build's globs file"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
test_soong_after_bp2build_regenerates_build_globs_ninja
|
||||
|
||||
function test_bp2build_generates_all_buildfiles {
|
||||
setup
|
||||
create_mock_bazel
|
||||
|
Reference in New Issue
Block a user