Merge "Revert "Convert BuildIgnoreApexContritbutions variable to a boolean"" into main
diff --git a/ci/build_test_suites b/ci/build_test_suites
index 89ecefe..03f6731 100755
--- a/ci/build_test_suites
+++ b/ci/build_test_suites
@@ -1,4 +1,4 @@
-#!prebuilts/build-tools/linux-x86/bin/py3-cmd
+#!prebuilts/build-tools/linux-x86/bin/py3-cmd -B
# Copyright 2024, The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,10 +14,6 @@
# limitations under the License.
import sys
-
import build_test_suites
-if __name__ == '__main__':
- sys.dont_write_bytecode = True
-
- build_test_suites.main(sys.argv)
+build_test_suites.main(sys.argv)
diff --git a/ci/build_test_suites.py b/ci/build_test_suites.py
index 5798f2b..23e896d 100644
--- a/ci/build_test_suites.py
+++ b/ci/build_test_suites.py
@@ -39,13 +39,12 @@
def build_test_suites(argv):
args = parse_args(argv)
- if not os.environ.get('BUILD_NUMBER')[0] == 'P':
+ if is_optimization_enabled():
+ # Call the class to map changed files to modules to build.
+ # TODO(lucafarsi): Move this into a replaceable class.
+ build_affected_modules(args)
+ else:
build_everything(args)
- return
-
- # Call the class to map changed files to modules to build.
- # TODO(lucafarsi): Move this into a replaceable class.
- build_affected_modules(args)
def parse_args(argv):
@@ -60,13 +59,20 @@
)
argparser.add_argument('--dist_dir')
argparser.add_argument('--change_info', nargs='?')
- argparser.add_argument('--extra_required_modules', nargs='*')
return argparser.parse_args()
+def is_optimization_enabled() -> bool:
+ # TODO(lucafarsi): switch back to building only affected general-tests modules
+ # in presubmit once ready.
+ # if os.environ.get('BUILD_NUMBER')[0] == 'P':
+ # return True
+ return False
+
+
def build_everything(args: argparse.Namespace):
- build_command = base_build_command(args)
+ build_command = base_build_command(args, args.extra_targets)
build_command.append('general-tests')
run_command(build_command, print_output=True)
@@ -78,7 +84,7 @@
)
# Call the build command with everything.
- build_command = base_build_command(args)
+ build_command = base_build_command(args, args.extra_targets)
build_command.extend(modules_to_build)
# When not building general-tests we also have to build the general tests
# shared libs.
@@ -89,7 +95,7 @@
zip_build_outputs(modules_to_build, args.dist_dir, args.target_release)
-def base_build_command(args: argparse.Namespace) -> list:
+def base_build_command(args: argparse.Namespace, extra_targets: set[str]) -> list:
build_command = []
build_command.append('time')
build_command.append('./build/soong/soong_ui.bash')
@@ -100,7 +106,7 @@
build_command.append('TARGET_RELEASE=' + args.target_release)
if args.with_dexpreopt_boot_img_and_system_server_only:
build_command.append('WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true')
- build_command.extend(args.extra_targets)
+ build_command.extend(extra_targets)
return build_command
@@ -405,4 +411,4 @@
def main(argv):
- build_test_suites(sys.argv)
+ build_test_suites(argv)
diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk
index ac586c5..ca87417 100644
--- a/core/android_soong_config_vars.mk
+++ b/core/android_soong_config_vars.mk
@@ -128,13 +128,25 @@
# are controlled by the MODULE_BUILD_FROM_SOURCE environment variable by
# default.
INDIVIDUALLY_TOGGLEABLE_PREBUILT_MODULES := \
+ adservices \
+ appsearch \
btservices \
devicelock \
+ configinfrastructure \
+ conscrypt \
+ healthfitness \
+ ipsec \
+ media \
+ mediaprovider \
+ ondevicepersonalization \
permission \
rkpd \
+ scheduling \
+ sdkext \
+ statsd \
+ tethering \
uwb \
wifi \
- mediaprovider \
$(foreach m, $(INDIVIDUALLY_TOGGLEABLE_PREBUILT_MODULES),\
$(if $(call soong_config_get,$(m)_module,source_build),,\
diff --git a/core/config.mk b/core/config.mk
index c9f752d..d7516d3 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -680,11 +680,6 @@
else
MKBOOTIMG := $(BOARD_CUSTOM_MKBOOTIMG)
endif
-ifeq (,$(strip $(BOARD_CUSTOM_BPTTOOL)))
-BPTTOOL := $(HOST_OUT_EXECUTABLES)/bpttool$(HOST_EXECUTABLE_SUFFIX)
-else
-BPTTOOL := $(BOARD_CUSTOM_BPTTOOL)
-endif
ifeq (,$(strip $(BOARD_CUSTOM_AVBTOOL)))
AVBTOOL := $(HOST_OUT_EXECUTABLES)/avbtool$(HOST_EXECUTABLE_SUFFIX)
else
diff --git a/core/release_config.mk b/core/release_config.mk
index 36882bb..a7b5b3f 100644
--- a/core/release_config.mk
+++ b/core/release_config.mk
@@ -133,6 +133,18 @@
)
FLAG_DECLARATION_FILES :=
+# Verify that all inherited/overridden release configs are declared.
+$(foreach config,$(_all_release_configs),\
+ $(foreach r,$(all_release_configs.$(r).OVERRIDES),\
+ $(if $(strip $(_all_release_configs.$(r).FILES)$(_all_release_configs.$(r).OVERRIDES)),,\
+ $(error Release config $(config) [declared in: $(_all_release_configs.$(r).DECLARED_IN)] inherits from non-existent $(r).)\
+)))
+# Verify that alias configs do not have config files.
+$(foreach r,$(_all_release_configs),\
+ $(if $(_all_release_configs.$(r).ALIAS),$(if $(_all_release_configs.$(r).FILES),\
+ $(error Alias release config "$(r)" may not specify release config files $(_all_release_configs.$(r).FILES))\
+)))
+
ifeq ($(TARGET_RELEASE),)
# We allow some internal paths to explicitly set TARGET_RELEASE to the
# empty string. For the most part, 'make' treats unset and empty string as
@@ -148,8 +160,12 @@
TARGET_RELEASE = trunk_staging
endif
-ifeq ($(filter $(_all_release_configs), $(TARGET_RELEASE)),)
- $(error No release config found for TARGET_RELEASE: $(TARGET_RELEASE). Available releases are: $(_all_release_configs))
+# During pass 1 of product config, using a non-existent release config is not an error.
+# We can safely assume that we are doing pass 1 if DUMP_MANY_VARS=="PRODUCT_RELEASE_CONFIG_MAPS".
+ifneq (PRODUCT_RELEASE_CONFIG_MAPS,$(DUMP_MANY_VARS))
+ ifeq ($(filter $(_all_release_configs), $(TARGET_RELEASE)),)
+ $(error No release config found for TARGET_RELEASE: $(TARGET_RELEASE). Available releases are: $(_all_release_configs))
+ endif
endif
# Choose flag files
@@ -177,7 +193,7 @@
define declare-release-config
$(error declare-release-config can only be called from inside release_config_map.mk files)
endef
-define apply-release-config-overrides
+define _apply-release-config-overrides
$(error invalid use of apply-release-config-overrides)
endef
@@ -192,12 +208,6 @@
endif
.KATI_READONLY := TARGET_RELEASE
-# Verify that alias configs do not have config files.
-$(foreach r,$(_all_release_configs),\
- $(if $(_all_release_configs.$(r).ALIAS),$(if $(_all_release_configs.$(r).FILES),\
- $(error Alias release config "$(r)" may not specify release config files $(_all_release_configs.$(r).FILES))\
-)))
-
$(foreach config, $(_all_release_configs), \
$(eval _all_release_configs.$(config).DECLARED_IN:= ) \
$(eval _all_release_configs.$(config).FILES:= ) \
diff --git a/core/release_config.scl b/core/release_config.scl
index 629e223..728fc1b 100644
--- a/core/release_config.scl
+++ b/core/release_config.scl
@@ -53,6 +53,7 @@
for t in _valid_types
],
},
+ "origin": {"type": "string"},
"declared_in": {"type": "string"},
},
"optional_keys": {
@@ -80,13 +81,14 @@
},
}
-def flag(name, partitions, default, *, appends = False):
+def flag(name, partitions, default, *, origin = "Unknown", appends = False):
"""Declare a flag.
Args:
name: name of the flag
partitions: the partitions where this should be recorded.
default: the default value of the flag.
+ origin: The origin of this flag.
appends: Whether new values should be append (not replace) the old.
Returns:
@@ -112,6 +114,7 @@
"partitions": partitions,
"default": default,
"appends": appends,
+ "origin": origin,
}
def value(name, value):
@@ -158,7 +161,10 @@
for key in "name", "partitions", "default", "appends":
if flag[key] != other[key]:
return False
- return True
+ # For now, allow Unknown to match any other origin.
+ if flag["origin"] == "Unknown" or other["origin"] == "Unknown":
+ return True
+ return flag["origin"] == other["origin"]
def release_config(all_flags, all_values):
"""Return the make variables that should be set for this release config.
@@ -234,5 +240,6 @@
result["_ALL_RELEASE_FLAGS." + flag["name"] + ".VALUE"] = val
result["_ALL_RELEASE_FLAGS." + flag["name"] + ".DECLARED_IN"] = flag["declared_in"]
result["_ALL_RELEASE_FLAGS." + flag["name"] + ".SET_IN"] = set_in
+ result["_ALL_RELEASE_FLAGS." + flag["name"] + ".ORIGIN"] = flag["origin"]
return result
diff --git a/envsetup.sh b/envsetup.sh
index db21188..74cfbbd 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1084,8 +1084,21 @@
echo "can't find Android.mk"
}
+# Ensure that we're always using the adb in the tree. This works around the fact
+# that bash caches $PATH lookups, so if you use adb before lunching/building the
+# one in your tree, you'll continue to get /usr/bin/adb or whatever even after
+# you have the one from your current tree on your path. Historically this would
+# cause confusion because glinux had adb in /usr/bin/ by default, though that
+# doesn't appear to be the case on my rodete hosts; it is however still the case
+# that my Mac has /usr/local/bin/adb installed by default and on the default
+# path.
function adb() {
- command adb "${@}"
+ local ADB=$(which adb)
+ if [ -z "$ADB" ]; then
+ echo "Command adb not found; try lunch (and building) first?"
+ return 1
+ fi
+ $ADB "${@}"
}
# simplified version of ps; output in the form
diff --git a/tools/aconfig/aconfig_storage_read_api/aconfig_storage_read_api.cpp b/tools/aconfig/aconfig_storage_read_api/aconfig_storage_read_api.cpp
index 131dc9d..b5bcf7d 100644
--- a/tools/aconfig/aconfig_storage_read_api/aconfig_storage_read_api.cpp
+++ b/tools/aconfig/aconfig_storage_read_api/aconfig_storage_read_api.cpp
@@ -18,7 +18,7 @@
/// Storage location pb file
static constexpr char kAvailableStorageRecordsPb[] =
- "/metadata/aconfig/available_storage_file_records.pb";
+ "/metadata/aconfig/boot/available_storage_file_records.pb";
/// Read aconfig storage records pb file
static Result<storage_records_pb> read_storage_records_pb(std::string const& pb_file) {
diff --git a/tools/aconfig/aconfig_storage_read_api/src/lib.rs b/tools/aconfig/aconfig_storage_read_api/src/lib.rs
index 647ca55..ea45f5d 100644
--- a/tools/aconfig/aconfig_storage_read_api/src/lib.rs
+++ b/tools/aconfig/aconfig_storage_read_api/src/lib.rs
@@ -57,7 +57,7 @@
use std::io::Read;
/// Storage file location pb file
-pub const STORAGE_LOCATION_FILE: &str = "/metadata/aconfig/available_storage_file_records.pb";
+pub const STORAGE_LOCATION_FILE: &str = "/metadata/aconfig/boot/available_storage_file_records.pb";
/// Get read only mapped storage files.
///
diff --git a/tools/ide_query/cc_analyzer/analyzer.cc b/tools/ide_query/cc_analyzer/analyzer.cc
index 8cc07e8..bb7ca0b 100644
--- a/tools/ide_query/cc_analyzer/analyzer.cc
+++ b/tools/ide_query/cc_analyzer/analyzer.cc
@@ -117,7 +117,7 @@
result.mutable_status()->set_code(::ide_query::Status::FAILURE);
result.mutable_status()->set_message("Command working dir " +
working_dir.str() +
- "outside repository " + repo_dir);
+ " outside repository " + repo_dir);
continue;
}
working_dir = working_dir.ltrim('/');
diff --git a/tools/ide_query/ide_query.go b/tools/ide_query/ide_query.go
index 9602ac8..50264fd 100644
--- a/tools/ide_query/ide_query.go
+++ b/tools/ide_query/ide_query.go
@@ -121,7 +121,7 @@
log.Fatalf("Failed to query cc targets: %v", *status.Message)
}
toMake = append(toMake, ccTargets...)
- fmt.Printf("Running make for modules: %v\n", strings.Join(toMake, ", "))
+ fmt.Fprintf(os.Stderr, "Running make for modules: %v\n", strings.Join(toMake, ", "))
if err := runMake(ctx, env, toMake...); err != nil {
log.Printf("Building deps failed: %v", err)
}
@@ -136,13 +136,13 @@
log.Fatalf("Failed to marshal result proto: %v", err)
}
- err = os.WriteFile(path.Join(env.RepoDir, env.OutDir, "ide_query.pb"), data, 0644)
+ _, err = os.Stdout.Write(data)
if err != nil {
log.Fatalf("Failed to write result proto: %v", err)
}
for _, s := range res.Sources {
- fmt.Printf("%s: %v (Deps: %d, Generated: %d)\n", s.GetPath(), s.GetStatus(), len(s.GetDeps()), len(s.GetGenerated()))
+ fmt.Fprintf(os.Stderr, "%s: %v (Deps: %d, Generated: %d)\n", s.GetPath(), s.GetStatus(), len(s.GetDeps()), len(s.GetGenerated()))
}
}
@@ -312,7 +312,7 @@
args = append(args, modules...)
cmd := exec.CommandContext(ctx, "build/soong/soong_ui.bash", args...)
cmd.Dir = env.RepoDir
- cmd.Stdout = os.Stdout
+ cmd.Stdout = os.Stderr
cmd.Stderr = os.Stderr
return cmd.Run()
}
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index a7b1d8c..464ad9b 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -294,7 +294,7 @@
build_command = [prop_dict["ext_mkuserimg"]]
if "extfs_sparse_flag" in prop_dict and not disable_sparse:
build_command.append(prop_dict["extfs_sparse_flag"])
- run_e2fsck = RunE2fsck
+ run_fsck = RunE2fsck
build_command.extend([in_dir, out_file, fs_type,
prop_dict["mount_point"]])
build_command.append(prop_dict["image_size"])
diff --git a/tools/releasetools/create_brick_ota.py b/tools/releasetools/create_brick_ota.py
index f290323..9e040a5 100644
--- a/tools/releasetools/create_brick_ota.py
+++ b/tools/releasetools/create_brick_ota.py
@@ -45,13 +45,17 @@
partitions_to_wipe = PARTITIONS_TO_WIPE
if extra_wipe_partitions is not None:
partitions_to_wipe = PARTITIONS_TO_WIPE + extra_wipe_partitions.split(",")
+ ota_metadata = ["ota-type=BRICK", "post-timestamp=9999999999",
+ "pre-device=" + product_name]
+ if serialno is not None:
+ ota_metadata.append("serialno=" + serialno)
# recovery requiers product name to be a | separated list
product_name = product_name.replace(",", "|")
with zipfile.ZipFile(output_path, "w") as zfp:
zfp.writestr("recovery.wipe", "\n".join(partitions_to_wipe))
zfp.writestr("payload.bin", "")
zfp.writestr("META-INF/com/android/metadata", "\n".join(
- ["ota-type=BRICK", "post-timestamp=9999999999", "pre-device=" + product_name, "serialno=" + serialno]))
+ ota_metadata))
def main(argv):