Merge "Assert BOARD_BUILD_SYSTEM_ROOT_IMAGE is not true"
diff --git a/core/Makefile b/core/Makefile
index 0e50f49..9c61495 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -6951,14 +6951,17 @@
.PHONY: haiku
haiku: $(SOONG_FUZZ_PACKAGING_ARCH_MODULES) $(ALL_FUZZ_TARGETS)
$(call dist-for-goals,haiku,$(SOONG_FUZZ_PACKAGING_ARCH_MODULES))
+$(call dist-for-goals,haiku,$(PRODUCT_OUT)/module-info.json)
.PHONY: haiku-java
haiku-java: $(SOONG_JAVA_FUZZ_PACKAGING_ARCH_MODULES) $(ALL_JAVA_FUZZ_TARGETS)
$(call dist-for-goals,haiku-java,$(SOONG_JAVA_FUZZ_PACKAGING_ARCH_MODULES))
+$(call dist-for-goals,haiku-java,$(PRODUCT_OUT)/module-info.json)
.PHONY: haiku-rust
haiku-rust: $(SOONG_RUST_FUZZ_PACKAGING_ARCH_MODULES) $(ALL_RUST_FUZZ_TARGETS)
$(call dist-for-goals,haiku-rust,$(SOONG_RUST_FUZZ_PACKAGING_ARCH_MODULES))
+$(call dist-for-goals,haiku-rust,$(PRODUCT_OUT)/module-info.json)
# -----------------------------------------------------------------
# Extract platform fonts used in Layoutlib
diff --git a/envsetup.sh b/envsetup.sh
index 8b0865d..eee7dbc 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -38,6 +38,7 @@
- godir: Go to the directory containing a file.
- allmod: List all modules.
- gomod: Go to the directory containing a module.
+- bmod: Get the Bazel label of a Soong module if it is converted with bp2build.
- pathmod: Get the directory containing a module.
- outmod: Gets the location of a module's installed outputs with a certain extension.
- dirmods: Gets the modules defined in a given directory.
@@ -392,6 +393,7 @@
complete -F _complete_android_module_names gomod
complete -F _complete_android_module_names outmod
complete -F _complete_android_module_names installmod
+ complete -F _complete_android_module_names bmod
complete -F _complete_android_module_names m
}
@@ -1570,6 +1572,43 @@
python3 -c "import json; print('\n'.join(sorted(json.load(open('$ANDROID_PRODUCT_OUT/module-info.json')).keys())))"
}
+# Return the Bazel label of a Soong module if it is converted with bp2build.
+function bmod()
+(
+ if [ $# -ne 1 ]; then
+ echo "usage: bmod <module>" >&2
+ return 1
+ fi
+
+ # We could run bp2build here, but it might trigger bp2build invalidation
+ # when used with `b` (e.g. --run_soong_tests) and/or add unnecessary waiting
+ # time overhead.
+ #
+ # For a snappy result, use the latest generated version in soong_injection,
+ # and ask users to run m bp2build if it doesn't exist.
+ converted_json="out/soong/soong_injection/metrics/converted_modules_path_map.json"
+
+ if [ ! -f $(gettop)/${converted_json} ]; then
+ echo "bp2build files not found. Have you ran 'm bp2build'?" >&2
+ return 1
+ fi
+
+ local target_label=$(python3 -c "import json
+module = '$1'
+converted_json='$converted_json'
+bp2build_converted_map = json.load(open(converted_json))
+if module not in bp2build_converted_map:
+ exit(1)
+print(bp2build_converted_map[module] + ':' + module)")
+
+ if [ -z "${target_label}" ]; then
+ echo "$1 is not converted to Bazel." >&2
+ return 1
+ else
+ echo "${target_label}"
+ fi
+)
+
# Get the path of a specific module in the android tree, as cached in module-info.json.
# If any build change is made, and it should be reflected in the output, you should run
# 'refreshmod' first. Note: This is the inverse of dirmods.
@@ -1821,8 +1860,10 @@
skip_tests=""
fi
done
+
# Generate BUILD, bzl files into the synthetic Bazel workspace (out/soong/workspace).
- _trigger_build "all-modules" bp2build $skip_tests USE_BAZEL_ANALYSIS= || return 1
+ # RBE is disabled because it's not used with b builds and adds overhead: b/251441524
+ USE_RBE=false _trigger_build "all-modules" bp2build $skip_tests USE_BAZEL_ANALYSIS= || return 1
# Then, run Bazel using the synthetic workspace as the --package_path.
if [[ -z "$bazel_args" ]]; then
# If there are no args, show help and exit.
diff --git a/finalize-aidl-vndk-sdk-resources.sh b/finalize-aidl-vndk-sdk-resources.sh
index 5d4fbe3..e74ba71 100755
--- a/finalize-aidl-vndk-sdk-resources.sh
+++ b/finalize-aidl-vndk-sdk-resources.sh
@@ -39,7 +39,8 @@
sed -i "s%$sdk_codename%$sdk_version%g" $sdk_build
- # Update the current.txt
+ # Force update current.txt
+ $m clobber
$m update-api
}
diff --git a/finalize-cleanup.sh b/finalize-cleanup.sh
new file mode 100755
index 0000000..efa2707
--- /dev/null
+++ b/finalize-cleanup.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Brings local repository to a remote head state.
+
+# set -ex
+
+function finalize_revert_local_changes_main() {
+ local top="$(dirname "$0")"/../..
+
+ repo selfupdate
+
+ repo forall -c '\
+ git checkout . ; git clean -fdx ;\
+ git checkout @ ; git b fina-step1 -D ; git reset --hard; \
+ repo start fina-step1 ; git checkout @ ; git b fina-step1 -D ;'
+}
+
+finalize_revert_local_changes_main
diff --git a/tests/b_tests.sh b/tests/b_tests.sh
index 6bc6519..f4e043c 100755
--- a/tests/b_tests.sh
+++ b/tests/b_tests.sh
@@ -26,3 +26,8 @@
b --run-soong-tests build "$test_target"
b cquery 'kind(test, //build/bazel/examples/android_app/...)' --config=android
b run $test_target -- --help >/dev/null
+
+# Workflow tests for bmod
+bmod libm
+b run $(bmod fastboot) -- help
+b build $(bmod libm) $(bmod libcutils) --config=android