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
diff --git a/tests/bootstrap_test.sh b/tests/bootstrap_test.sh
index 1258684..9342d75 100755
--- a/tests/bootstrap_test.sh
+++ b/tests/bootstrap_test.sh
@@ -144,7 +144,7 @@
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 @@
[[ -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 @@
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 @@
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_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