Skip to content

Commit

Permalink
Merge tag 'android-14.0.0_r29' into staging/lineage-21.0_merge-androi…
Browse files Browse the repository at this point in the history
…d-14.0.0_r29

Android 14.0.0 release 29

# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCZeZWvgAKCRDorT+BmrEO
# ePd2AJ9htACMoS+nNDu9IpJB05WiR/NyHQCfUzBaEyDH9yCqHQo7CPiXkHtOqks=
# =iWeA
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Mar  5 01:18:22 2024 EET
# gpg:                using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <[email protected]>" [marginal]
# gpg: [email protected]: Verified 2332 signatures in the past
#      2 years.  Encrypted 4 messages in the past 2 years.
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 4340 D135 70EF 945E 8381  0964 E8AD 3F81 9AB1 0E78

# By Android Build Coastguard Worker (175) and others
# Via Automerger Merge Worker (5473) and others
* tag 'android-14.0.0_r29': (1001 commits)
  Version bump to AP1A.240305.019.A1 [core/build_id.mk]
  Version bump to AP1A.240305.019 [core/build_id.mk]
  Version bump to AP1A.240305.018.X1 [core/build_id.mk]
  Version bump to AP1A.240305.018 [core/build_id.mk]
  Version bump to AP1A.240305.017 [core/build_id.mk]
  Version bump to AP1A.240305.016 [core/build_id.mk]
  Version bump to AP1A.240305.015 [core/build_id.mk]
  Version bump to AP1A.240305.014 [core/build_id.mk]
  Version bump to AP1A.240305.013 [core/build_id.mk]
  Version bump to AP1A.240305.012 [core/build_id.mk]
  Version bump to AP1A.240305.011 [core/build_id.mk]
  Version bump to AP1A.240305.010 [core/build_id.mk]
  Version bump to AP1A.240305.009 [core/build_id.mk]
  Move RELEASE_PLATFORM_VERSION_KNOWN_CODENAMES out to release configs.
  Version bump to AP1A.240305.007.X1 [core/build_id.mk]
  Version bump to AP1A.240305.007 [core/build_id.mk]
  Version bump to AP1A.240305.006 [core/build_id.mk]
  Version bump to AP1A.240305.005.Y1 [core/build_id.mk]
  Version bump to AP1A.240305.005.X1 [core/build_id.mk]
  Version bump to AP1A.240305.005 [core/build_id.mk]
  ...

 Conflicts:
	core/Makefile
	core/build_id.mk
	core/soong_config.mk
	core/sysprop.mk
	core/version_defaults.mk
	envsetup.sh
	target/board/BoardConfigEmuCommon.mk
	tools/releasetools/common.py
	tools/releasetools/ota_from_target_files.py

Change-Id: I3794e958f4f4231120fdd866fa68c27ef872d279
  • Loading branch information
mikeNG committed Mar 8, 2024
2 parents 6d7f37d + c2bd3c9 commit b854cd1
Show file tree
Hide file tree
Showing 335 changed files with 14,399 additions and 4,723 deletions.
58 changes: 57 additions & 1 deletion Changes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
# Build System Changes for Android.mk Writers
# Build System Changes for Android.mk/Android.bp Writers

## Soong genrules are now sandboxed

Previously, soong genrules could access any files in the source tree, without specifying them as
inputs. This makes them incorrect in incremental builds, and incompatible with RBE and Bazel.

Now, genrules are sandboxed so they can only access their listed srcs. Modules denylisted in
genrule/allowlists.go are exempt from this. You can also set `BUILD_BROKEN_GENRULE_SANDBOXING`
in board config to disable this behavior.

## Partitions are no longer affected by previous builds

Partition builds used to include everything in their staging directories, and building an
individual module will install it to the staging directory. Thus, previously, `m mymodule` followed
by `m` would cause `mymodule` to be presinstalled on the device, even if it wasn't listed in
`PRODUCT_PACKAGES`.

This behavior has been changed, and now the partition images only include what they'd have if you
did a clean build. This behavior can be disabled by setting the
`BUILD_BROKEN_INCORRECT_PARTITION_IMAGES` environment variable or board config variable.

Manually adding make rules that build to the staging directories without going through the make
module system will not be compatible with this change. This includes many usages of
`LOCAL_POST_INSTALL_CMD`.

## Perform validation of Soong plugins

Each Soong plugin will require manual work to migrate to Bazel. In order to
minimize the manual work outside of build/soong, we are restricting plugins to
those that exist today and those in vendor or hardware directories.

If you need to extend the build system via a plugin, please reach out to the
build team via email [email protected] (external) for any
questions, or see [go/soong](http://go/soong) (internal).

To omit the validation, `BUILD_BROKEN_PLUGIN_VALIDATION` expects a
space-separated list of plugins to omit from the validation. This must be set
within a product configuration .mk file, board config .mk file, or buildspec.mk.

## Python 2 to 3 migration

Expand Down Expand Up @@ -493,6 +531,24 @@ $(call dist-for-goals,foo,bar/baz)

will copy `bar/baz` into `$DIST_DIR/baz` when `m foo dist` is run.

#### FILE_NAME_TAG {#FILE_NAME_TAG}

To embed the `BUILD_NUMBER` (or for local builds, `eng.${USER}`), include
`FILE_NAME_TAG_PLACEHOLDER` in the destination:

``` make
# you can use dist-for-goals-with-filenametag function
$(call dist-for-goals-with-filenametag,foo,bar.zip)
# or use FILE_NAME_TAG_PLACEHOLDER manually
$(call dist-for-goals,foo,bar.zip:baz-FILE_NAME_TAG_PLACEHOLDER.zip)
```

Which will produce `$DIST_DIR/baz-1234567.zip` on build servers which set
`BUILD_NUMBER=1234567`, or `$DIST_DIR/baz-eng.builder.zip` for local builds.
If you just want to append `BUILD_NUMBER` at the end of basename, use
`dist-for-goals-with-filenametag` instead of `dist-for-goals`.
#### Renames during copy
Instead of specifying just a file, a destination name can be specified,
Expand Down
6 changes: 6 additions & 0 deletions CleanSpec.mk
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,12 @@ $(call add-clean-step, rm -rf $(SOONG_HOST_OUT))
# Don't use SOONG_HOST_OUT, it is now an alias for HOST_OUT.
$(call add-clean-step, rm -rf $(OUT_DIR)/soong/host)

# Clear out tools/metalava Bazel output dir
$(call add-clean-step, rm -rf $(OUT_DIR)/bazel/output/execroot/__main__/bazel-out/mixed_builds_product-*/bin/tools/metalava)

# Clear out rustc compiler intermediates after reverting rust compiler/linker split.
$(call add-clean-step, find $(OUT_DIR) -name "*.rsp.whole.a" -print0 | xargs -0 /bin/bash -c 'rm -f $$$${@}; rm -f $$$${@/.rsp.whole.a/.rsp.a}; rm -f $$$${@/.rsp.whole.a/.rsp}')

# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
4 changes: 2 additions & 2 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ include platform/build/soong:/OWNERS

# Since this file affects all Android developers, lock it down. There is still
# round the world timzeone coverage.
per-file envsetup.sh = [email protected], [email protected], [email protected]
per-file shell_utils.sh = [email protected], [email protected], [email protected]
per-file envsetup.sh = [email protected], [email protected]
per-file shell_utils.sh = [email protected], [email protected]

92 changes: 92 additions & 0 deletions cogsetup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#
# Copyright (C) 2023 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# This file is executed by build/envsetup.sh, and can use anything
# defined in envsetup.sh.
function _create_out_symlink_for_cog() {
if [[ "${OUT_DIR}" == "" ]]; then
OUT_DIR="out"
fi

if [[ -L "${OUT_DIR}" ]]; then
return
fi
if [ -d "${OUT_DIR}" ]; then
echo -e "\tOutput directory ${OUT_DIR} cannot be present in a Cog workspace."
echo -e "\tDelete \"${OUT_DIR}\" or create a symlink from \"${OUT_DIR}\" to a directory outside your workspace."
return 1
fi

DEFAULT_OUTPUT_DIR="${HOME}/.cog/android-build-out"
mkdir -p ${DEFAULT_OUTPUT_DIR}
ln -s ${DEFAULT_OUTPUT_DIR} `pwd`/out
}

# This function moves the reclient binaries into a directory that exists in a
# non-cog part of the overall filesystem. This is to workaround the problem
# described in b/289391270.
function _copy_reclient_binaries_from_cog() {
if [[ "${OUT_DIR}" == "" ]]; then
OUT_DIR="out"
fi
local RECLIENT_VERSION=`readlink prebuilts/remoteexecution-client/live`

local NONCOG_RECLIENT_BIN_DIR_BASE="${OUT_DIR}/.reclient"
local NONCOG_RECLIENT_BIN_DIR="${NONCOG_RECLIENT_BIN_DIR_BASE}/${RECLIENT_VERSION}"

# Create the non cog directory and setup live symlink.
mkdir -p ${NONCOG_RECLIENT_BIN_DIR}

if [ `ls ${NONCOG_RECLIENT_BIN_DIR} | wc -l` -lt 8 ]; then
# Not all binaries exist, copy them from the Cog directory.
local TOP=$(gettop)
cp ${TOP}/prebuilts/remoteexecution-client/live/* ${NONCOG_RECLIENT_BIN_DIR}
fi

ln -sfn ${RECLIENT_VERSION} ${NONCOG_RECLIENT_BIN_DIR_BASE}/live
export RBE_DIR="${NONCOG_RECLIENT_BIN_DIR_BASE}/live"
}

# This function sets up the build environment to be appropriate for Cog.
function _setup_cog_env() {
_create_out_symlink_for_cog
if [ "$?" -eq "1" ]; then
echo -e "\e[0;33mWARNING:\e[00m Cog environment setup failed!"
return 1
fi
_copy_reclient_binaries_from_cog

export ANDROID_BUILD_ENVIRONMENT_CONFIG="googler-cog"

# Running repo command within Cog workspaces is not supported, so override
# it with this function. If the user is running repo within a Cog workspace,
# we'll fail with an error, otherwise, we run the original repo command with
# the given args.
ORIG_REPO_PATH=`which repo`
function repo {
if [[ "${PWD}" == /google/cog/* ]]; then
echo "\e[01;31mERROR:\e[0mrepo command is disallowed within Cog workspaces."
return 1
fi
${ORIG_REPO_PATH} "$@"
}
}

if [[ "${PWD}" != /google/cog/* ]]; then
echo -e "\e[01;31mERROR:\e[0m This script must be run from a Cog workspace."
fi

_setup_cog_env
120 changes: 113 additions & 7 deletions common/math.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ __MATH_POS_NUMBERS := 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 \
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
__MATH_NUMBERS := 0 $(__MATH_POS_NUMBERS)
__MATH_ONE_NUMBERS := 0 1 2 3 4 5 6 7 8 9

math-error = $(call pretty-error,$(1))
math-expect :=
Expand All @@ -36,6 +37,10 @@ math-expect-error :=
# make -f ${ANDROID_BUILD_TOP}/build/make/common/math.mk RUN_MATH_TESTS=true
# $(get_build_var CKATI) -f ${ANDROID_BUILD_TOP}//build/make/common/math.mk RUN_MATH_TESTS=true
ifdef RUN_MATH_TESTS
ifndef empty
empty :=
space := $(empty) $(empty)
endif
MATH_TEST_FAILURE :=
MATH_TEST_ERROR :=
math-error = $(if $(MATH_TEST_ERROR),,$(eval MATH_TEST_ERROR:=$(1)))
Expand All @@ -61,13 +66,29 @@ ifdef RUN_MATH_TESTS
endif

# Returns true if $(1) is a non-negative integer <= 100, otherwise returns nothing.
define math_is_number
define math_is_number_in_100
$(strip \
$(if $(1),,$(call math-error,Argument missing)) \
$(if $(word 2,$(1)),$(call math-error,Multiple words in a single argument: $(1))) \
$(if $(filter $(1),$(__MATH_NUMBERS)),true))
endef

# Same with math_is_number_in_100, but no limit.
define _math_ext_is_number
$(strip \
$(if $(1),,$(call math-error,Argument missing)) \
$(if $(word 2,$(1)),$(call math-error,Multiple words in a single argument: $(1))) \
$(eval should_empty:=$(1)) \
$(foreach num,$(__MATH_ONE_NUMBERS),\
$(eval should_empty:=$(subst $(num),$(empty),$(should_empty)))) \
$(if $(should_empty),,true))
endef

# Returns true if $(1) is a non-negative integer.
define math_is_number
$(strip $(if $(call math_is_number_in_100,$(1)),true,$(call _math_ext_is_number,$(1))))
endef

define math_is_zero
$(strip \
$(if $(word 2,$(1)),$(call math-error,Multiple words in a single argument: $(1))) \
Expand All @@ -76,6 +97,7 @@ endef

$(call math-expect-true,(call math_is_number,0))
$(call math-expect-true,(call math_is_number,2))
$(call math-expect-true,(call math_is_number,202412))
$(call math-expect-false,(call math_is_number,foo))
$(call math-expect-false,(call math_is_number,-1))
$(call math-expect-error,(call math_is_number,1 2),Multiple words in a single argument: 1 2)
Expand All @@ -88,7 +110,7 @@ $(call math-expect-error,(call math_is_zero,1 2),Multiple words in a single argu
$(call math-expect-error,(call math_is_zero,no 2),Multiple words in a single argument: no 2)

define _math_check_valid
$(if $(call math_is_number,$(1)),,$(call math-error,Only non-negative integers <= 100 are supported (not $(1))))
$(if $(call math_is_number_in_100,$(1)),,$(call math-error,Only non-negative integers <= 100 are supported (not $(1))))
endef

$(call math-expect,(call _math_check_valid,0))
Expand All @@ -113,18 +135,81 @@ $(call math-expect,(call int_range_list,1,2),1 2)
$(call math-expect,(call int_range_list,2,1),)
$(call math-expect-error,(call int_range_list,1,101),Only non-negative integers <= 100 are supported (not 101))

# Split an integer into a list of digits
define _math_number_to_list
$(strip \
$(if $(call _math_ext_is_number,$(1)),,\
$(call math-error,Only non-negative integers are supported (not $(1)))) \
$(eval num_list:=$(1)) \
$(foreach num,$(__MATH_ONE_NUMBERS),\
$(eval num_list:=$(subst $(num),$(space)$(num),$(num_list)))) \
$(if $(filter $(words $(num_list)),$(__MATH_ONE_NUMBERS)),,\
$(call math-error,Only non-negative integers with less than 9 digits are supported (not $(1)))) \
$(if $(filter 0,$(word 1,$(num_list))),\
$(call math-error,Only non-negative integers without leading zeros are supported (not $(1)))) \
$(num_list))
endef

$(call math-expect,(call _math_number_to_list,123),1 2 3)
$(call math-expect-error,(call _math_number_to_list,123 456),Multiple words in a single argument: 123 456)
$(call math-expect-error,(call _math_number_to_list,-123),Only non-negative integers are supported (not -123))
$(call math-expect-error,(call _math_number_to_list,002),Only non-negative integers without leading zeros are supported (not 002))
$(call math-expect-error,(call _math_number_to_list,1234567890),Only non-negative integers with less than 9 digits are supported (not 1234567890))

# Compare 1-digit integer $(1) and $(2).
# Returns 1 if $(1) > $(2), -1 if $(1) < $(2), nothing if equals.
define _math_1digit_comp
$(strip \
$(if $(filter $(1),$(2)),,\
$(if $(filter $(1),$(firstword $(filter $(1) $(2),$(__MATH_ONE_NUMBERS)))),-1,1)))
endef

$(call math-expect,(call _math_1digit_comp,1,1))
$(call math-expect,(call _math_1digit_comp,0,9),-1)
$(call math-expect,(call _math_1digit_comp,3,1),1)

# Compare the same $(3)-digit-length integers $(1) and $(2) that are split into a list of digits.
# Returns 1 if $(1) > $(2), -1 if $(1) < $(2), nothing if equals.
define _math_list_comp
$(strip \
$(eval ans:=) \
$(foreach num,$(call int_range_list,1,$(3)),\
$(if $(ans),,$(eval ans:=$(call _math_1digit_comp,$(word $(num),$(1)),$(word $(num),$(2)))))) \
$(ans))
endef

# Compare any two non-negative integers $(1) and $(2).
# Returns 1 if $(1) > $(2), -1 if $(1) < $(2), nothing if equals.
define _math_ext_comp
$(strip \
$(eval num_list1:=$(call _math_number_to_list,$(1))) \
$(eval len1:=$(words $(num_list1))) \
$(eval num_list2:=$(call _math_number_to_list,$(2))) \
$(eval len2:=$(words $(num_list2))) \
$(eval comp:=$(call _math_1digit_comp,$(len1),$(len2))) \
$(if $(comp),$(comp),$(call _math_list_comp,$(num_list1),$(num_list2),$(len1))))
endef

$(call math-expect,(call _math_ext_comp,5,10),-1)
$(call math-expect,(call _math_ext_comp,12345,12345))
$(call math-expect,(call _math_ext_comp,500,5),1)
$(call math-expect,(call _math_ext_comp,202404,202504),-1)

# Returns the greater of $1 or $2.
# If $1 or $2 is not a positive integer <= 100, then an error is generated.
# If $1 or $2 is not a positive integer, then an error is generated.
define math_max
$(strip $(call _math_check_valid,$(1)) $(call _math_check_valid,$(2)) \
$(lastword $(filter $(1) $(2),$(__MATH_NUMBERS))))
$(strip \
$(if $(filter truetrue,$(call math_is_number_in_100,$(1))$(call math_is_number_in_100,$(2))),\
$(lastword $(filter $(1) $(2),$(__MATH_NUMBERS))),\
$(if $(filter 1,$(call _math_ext_comp,$(1),$(2))),$(1),$(2))))
endef

# Returns the lesser of $1 or $2.
define math_min
$(strip $(call _math_check_valid,$(1)) $(call _math_check_valid,$(2)) \
$(firstword $(filter $(1) $(2),$(__MATH_NUMBERS))))
$(strip \
$(if $(filter truetrue,$(call math_is_number_in_100,$(1))$(call math_is_number_in_100,$(2))),\
$(firstword $(filter $(1) $(2),$(__MATH_NUMBERS))),\
$(if $(filter -1,$(call _math_ext_comp,$(1),$(2))),$(1),$(2))))
endef

$(call math-expect-error,(call math_max),Argument missing)
Expand All @@ -142,6 +227,15 @@ $(call math-expect,(call math_min,1,1),1)
$(call math-expect,(call math_min,7,32),7)
$(call math-expect,(call math_min,32,7),7)

$(call math-expect,(call math_max,32759,7),32759)
$(call math-expect,(call math_max,7,32759),32759)
$(call math-expect,(call math_max,202404,202505),202505)
$(call math-expect,(call math_max,202404,202404),202404)
$(call math-expect,(call math_min,8908527,32),32)
$(call math-expect,(call math_min,32,8908527),32)
$(call math-expect,(call math_min,202404,202505),202404)
$(call math-expect,(call math_min,202404,202404),202404)

define math_gt_or_eq
$(if $(filter $(1),$(call math_max,$(1),$(2))),true)
endef
Expand All @@ -150,6 +244,10 @@ define math_gt
$(if $(call math_gt_or_eq,$(2),$(1)),,true)
endef

define math_lt_or_eq
$(if $(call math_gt_or_eq,$(2),$(1)),true)
endef

define math_lt
$(if $(call math_gt_or_eq,$(1),$(2)),,true)
endef
Expand All @@ -160,10 +258,17 @@ $(call math-expect-false,(call math_gt_or_eq, 1, 2))
$(call math-expect-true,(call math_gt, 4, 3))
$(call math-expect-false,(call math_gt, 5, 5))
$(call math-expect-false,(call math_gt, 6, 7))
$(call math-expect-true,(call math_lt_or_eq, 11, 11))
$(call math-expect-false,(call math_lt_or_eq, 25, 15))
$(call math-expect-true,(call math_lt_or_eq, 9, 16))
$(call math-expect-false,(call math_lt, 1, 0))
$(call math-expect-false,(call math_lt, 8, 8))
$(call math-expect-true,(call math_lt, 10, 11))

$(call math-expect-true,(call math_gt_or_eq, 2573904, 2573900))
$(call math-expect-true,(call math_gt_or_eq, 12345, 12345))
$(call math-expect-false,(call math_gt_or_eq, 56, 2780))

# $1 is the variable name to increment
define inc_and_print
$(strip $(eval $(1) := $($(1)) .)$(words $($(1))))
Expand Down Expand Up @@ -192,6 +297,7 @@ $(call math-expect,(call numbers_less_than,2,0 2 1 3),0 1)
$(call math-expect,(call numbers_less_than,3,0 2 1 3),0 2 1)
$(call math-expect,(call numbers_less_than,4,0 2 1 3),0 2 1 3)
$(call math-expect,(call numbers_less_than,3,0 2 1 3 2),0 2 1 2)
$(call math-expect,(call numbers_less_than,100,0 1000 50 101 100),0 50)

# Returns the words in $2 that are numbers and are greater or equal to $1
define numbers_greater_or_equal_to
Expand Down
Loading

0 comments on commit b854cd1

Please sign in to comment.