Merge "Move the creation of the root structure to build/core/main.mk" into main
diff --git a/Changes.md b/Changes.md
index fc15e60..9f2449c 100644
--- a/Changes.md
+++ b/Changes.md
@@ -43,14 +43,9 @@
The path set when running builds now makes the `python` executable point to python 3,
whereas on previous versions it pointed to python 2. If you still have python 2 scripts,
you can change the shebang line to use `python2` explicitly. This only applies for
-scripts run directly from makefiles, or from soong genrules. This behavior can be
-temporarily overridden by setting the `BUILD_BROKEN_PYTHON_IS_PYTHON2` environment
-variable to `true`. It's only an environment variable and not a product config variable
-because product config sometimes calls python code.
+scripts run directly from makefiles, or from soong genrules.
-In addition, `python_*` soong modules no longer allow python 2. This can be temporarily
-overridden by setting the `BUILD_BROKEN_USES_SOONG_PYTHON2_MODULES` product configuration
-variable to `true`.
+In addition, `python_*` soong modules no longer allow python 2.
Python 2 is slated for complete removal in V.
diff --git a/ci/buildbot.py b/ci/buildbot.py
new file mode 100644
index 0000000..97097be
--- /dev/null
+++ b/ci/buildbot.py
@@ -0,0 +1,43 @@
+# Copyright 2024, 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.
+
+"""Utilities for interacting with buildbot, with a simulation in a local environment"""
+
+import os
+import sys
+
+# Check that the script is running from the root of the tree. Prevents subtle
+# errors later, and CI always runs from the root of the tree.
+if not os.path.exists("build/make/ci/buildbot.py"):
+ raise Exception("CI script must be run from the root of the tree instead of: "
+ + os.getcwd())
+
+# Check that we are using the hermetic interpreter
+if "prebuilts/build-tools/" not in sys.executable:
+ raise Exception("CI script must be run using the hermetic interpreter from "
+ + "prebuilts/build-tools instead of: " + sys.executable)
+
+
+def OutDir():
+ "Get the out directory. Will create it if needed."
+ result = os.environ.get("OUT_DIR", "out")
+ os.makedirs(result, exist_ok=True)
+ return result
+
+def DistDir():
+ "Get the dist directory. Will create it if needed."
+ result = os.environ.get("DIST_DIR", os.path.join(OutDir(), "dist"))
+ os.makedirs(result, exist_ok=True)
+ return result
+
diff --git a/ci/dump_product_config b/ci/dump_product_config
new file mode 100755
index 0000000..77b51dd
--- /dev/null
+++ b/ci/dump_product_config
@@ -0,0 +1,353 @@
+#!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");
+# 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.
+
+"""Script to collect all of the make variables from all product config combos.
+
+This script must be run from the root of the source tree.
+
+See GetArgs() below or run dump_product_config for more information.
+"""
+
+import argparse
+import asyncio
+import contextlib
+import csv
+import dataclasses
+import json
+import multiprocessing
+import os
+import subprocess
+import sys
+import time
+from typing import List, Dict, Tuple, Optional
+
+import buildbot
+
+# We have some BIG variables
+csv.field_size_limit(sys.maxsize)
+
+
+class DataclassJSONEncoder(json.JSONEncoder):
+ """JSONEncoder for our custom types."""
+ def default(self, o):
+ if dataclasses.is_dataclass(o):
+ return dataclasses.asdict(o)
+ return super().default(o)
+
+
+def GetProducts():
+ """Get the all of the available TARGET_PRODUCT values."""
+ try:
+ stdout = subprocess.check_output(["build/soong/bin/list_products"], text=True)
+ except subprocess.CalledProcessError:
+ sys.exit(1)
+ return [s.strip() for s in stdout.splitlines() if s.strip()]
+
+
+def GetReleases(product):
+ """For a given product, get the release configs available to it."""
+ if True:
+ # Hard code the list
+ mainline_products = [
+ "module_arm",
+ "module_x86",
+ "module_arm64",
+ "module_riscv64",
+ "module_x86_64",
+ "module_arm64only",
+ "module_x86_64only",
+ ]
+ if product in mainline_products:
+ return ["trunk_staging", "trunk", "mainline"]
+ else:
+ return ["trunk_staging", "trunk", "next"]
+ else:
+ # Get it from the build system
+ try:
+ stdout = subprocess.check_output(["build/soong/bin/list_releases", product], text=True)
+ except subprocess.CalledProcessError:
+ sys.exit(1)
+ return [s.strip() for s in stdout.splitlines() if s.strip()]
+
+
+def GenerateAllLunchTargets():
+ """Generate the full list of lunch targets."""
+ for product in GetProducts():
+ for release in GetReleases(product):
+ for variant in ["user", "userdebug", "eng"]:
+ yield (product, release, variant)
+
+
+async def ParallelExec(parallelism, tasks):
+ '''
+ ParallelExec takes a parallelism number, and an iterator of tasks to run.
+ Then it will run all the tasks, but a maximum of parallelism will be run at
+ any given time. The tasks must be async functions that accept one argument,
+ which will be an integer id of the worker that they're running on.
+ '''
+ tasks = iter(tasks)
+
+ overall_start = time.monotonic()
+ # lists so they can be modified from the inner function
+ total_duration = [0]
+ count = [0]
+ async def dispatch(worker):
+ while True:
+ try:
+ task = next(tasks)
+ item_start = time.monotonic()
+ await task(worker)
+ now = time.monotonic()
+ item_duration = now - item_start
+ count[0] += 1
+ total_duration[0] += item_duration
+ sys.stderr.write(f"Timing: Items processed: {count[0]}, Wall time: {now-overall_start:0.1f} sec, Throughput: {(now-overall_start)/count[0]:0.3f} sec per item, Average duration: {total_duration[0]/count[0]:0.1f} sec\n")
+ except StopIteration:
+ return
+
+ await asyncio.gather(*[dispatch(worker) for worker in range(parallelism)])
+
+
+async def DumpProductConfigs(out, generator, out_dir):
+ """Collects all of the product config data and store it in file."""
+ # Write the outer json list by hand so we can stream it
+ out.write("[")
+ try:
+ first_result = [True] # a list so it can be modified from the inner function
+ def run(lunch):
+ async def curried(worker):
+ sys.stderr.write(f"running: {'-'.join(lunch)}\n")
+ result = await DumpOneProductConfig(lunch, os.path.join(out_dir, f"lunchable_{worker}"))
+ if first_result[0]:
+ out.write("\n")
+ first_result[0] = False
+ else:
+ out.write(",\n")
+ result.dumpToFile(out)
+ sys.stderr.write(f"finished: {'-'.join(lunch)}\n")
+ return curried
+
+ await ParallelExec(multiprocessing.cpu_count(), (run(lunch) for lunch in generator))
+ finally:
+ # Close the json regardless of how we exit
+ out.write("\n]\n")
+
+
+@dataclasses.dataclass(frozen=True)
+class Variable:
+ """A variable name, value and where it was set."""
+ name: str
+ value: str
+ location: str
+
+
+@dataclasses.dataclass(frozen=True)
+class ProductResult:
+ product: str
+ release: str
+ variant: str
+ board_includes: List[str]
+ product_includes: Dict[str, List[str]]
+ product_graph: List[Tuple[str, str]]
+ board_vars: List[Variable]
+ product_vars: List[Variable]
+
+ def dumpToFile(self, f):
+ json.dump(self, f, sort_keys=True, indent=2, cls=DataclassJSONEncoder)
+
+
+@dataclasses.dataclass(frozen=True)
+class ProductError:
+ product: str
+ release: str
+ variant: str
+ error: str
+
+ def dumpToFile(self, f):
+ json.dump(self, f, sort_keys=True, indent=2, cls=DataclassJSONEncoder)
+
+
+def NormalizeInheritGraph(lists):
+ """Flatten the inheritance graph to a simple list for easier querying."""
+ result = set()
+ for item in lists:
+ for i in range(len(item)):
+ result.add((item[i+1] if i < len(item)-1 else "", item[i]))
+ return sorted(list(result))
+
+
+def ParseDump(lunch, filename) -> ProductResult:
+ """Parses the csv and returns a tuple of the data."""
+ def diff(initial, final):
+ return [after for after in final.values() if
+ initial.get(after.name, Variable(after.name, "", "<unset>")).value != after.value]
+ product_initial = {}
+ product_final = {}
+ board_initial = {}
+ board_final = {}
+ inherit_product = [] # The stack of inherit-product calls
+ product_includes = {} # Other files included by each of the properly imported files
+ board_includes = [] # Files included by boardconfig
+ with open(filename) as f:
+ phase = ""
+ for line in csv.reader(f):
+ if line[0] == "phase":
+ phase = line[1]
+ elif line[0] == "val":
+ # TOOD: We should skip these somewhere else.
+ if line[3].startswith("_ALL_RELEASE_FLAGS"):
+ continue
+ if line[3].startswith("PRODUCTS."):
+ continue
+ if phase == "PRODUCTS":
+ if line[2] == "initial":
+ product_initial[line[3]] = Variable(line[3], line[4], line[5])
+ if phase == "PRODUCT-EXPAND":
+ if line[2] == "final":
+ product_final[line[3]] = Variable(line[3], line[4], line[5])
+ if phase == "BOARD":
+ if line[2] == "initial":
+ board_initial[line[3]] = Variable(line[3], line[4], line[5])
+ if line[2] == "final":
+ board_final[line[3]] = Variable(line[3], line[4], line[5])
+ elif line[0] == "imported":
+ imports = [s.strip() for s in line[1].split()]
+ if imports:
+ inherit_product.append(imports)
+ inc = [s.strip() for s in line[2].split()]
+ for f in inc:
+ product_includes.setdefault(imports[0], []).append(f)
+ elif line[0] == "board_config_files":
+ board_includes += [s.strip() for s in line[1].split()]
+ return ProductResult(
+ product = lunch[0],
+ release = lunch[1],
+ variant = lunch[2],
+ product_vars = diff(product_initial, product_final),
+ board_vars = diff(board_initial, board_final),
+ product_graph = NormalizeInheritGraph(inherit_product),
+ product_includes = product_includes,
+ board_includes = board_includes
+ )
+
+
+async def DumpOneProductConfig(lunch, out_dir) -> ProductResult | ProductError:
+ """Print a single config's lunch info to stdout."""
+ product, release, variant = lunch
+
+ dumpconfig_file = os.path.join(out_dir, f"{product}-{release}-{variant}.csv")
+
+ # Run get_build_var to bootstrap soong_ui for this target
+ env = dict(os.environ)
+ env["TARGET_PRODUCT"] = product
+ env["TARGET_RELEASE"] = release
+ env["TARGET_BUILD_VARIANT"] = variant
+ env["OUT_DIR"] = out_dir
+ process = await asyncio.create_subprocess_exec(
+ "build/soong/bin/get_build_var",
+ "TARGET_PRODUCT",
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ env=env
+ )
+ stdout, _ = await process.communicate()
+ stdout = stdout.decode()
+
+ if process.returncode != 0:
+ return ProductError(
+ product = product,
+ release = release,
+ variant = variant,
+ error = stdout
+ )
+ else:
+ # Run kati to extract the data
+ process = await asyncio.create_subprocess_exec(
+ "prebuilts/build-tools/linux-x86/bin/ckati",
+ "-f",
+ "build/make/core/dumpconfig.mk",
+ f"TARGET_PRODUCT={product}",
+ f"TARGET_RELEASE={release}",
+ f"TARGET_BUILD_VARIANT={variant}",
+ f"DUMPCONFIG_FILE={dumpconfig_file}",
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ env=env
+ )
+ stdout, _ = await process.communicate()
+ if process.returncode != 0:
+ stdout = stdout.decode()
+ return ProductError(
+ product = product,
+ release = release,
+ variant = variant,
+ error = stdout
+ )
+ else:
+ # Parse and record the output
+ return ParseDump(lunch, dumpconfig_file)
+
+
+def GetArgs():
+ """Parse command line arguments."""
+ parser = argparse.ArgumentParser(
+ description="Collect all of the make variables from product config.",
+ epilog="NOTE: This script must be run from the root of the source tree.")
+ parser.add_argument("--lunch", nargs="*")
+ parser.add_argument("--dist", action="store_true")
+
+ return parser.parse_args()
+
+
+async def main():
+ args = GetArgs()
+
+ out_dir = buildbot.OutDir()
+
+ if args.dist:
+ cm = open(os.path.join(buildbot.DistDir(), "all_product_config.json"), "w")
+ else:
+ cm = contextlib.nullcontext(sys.stdout)
+
+
+ with cm as out:
+ if args.lunch:
+ lunches = [lunch.split("-") for lunch in args.lunch]
+ fail = False
+ for i in range(len(lunches)):
+ if len(lunches[i]) != 3:
+ sys.stderr.write(f"Malformed lunch targets: {args.lunch[i]}\n")
+ fail = True
+ if fail:
+ sys.exit(1)
+ if len(lunches) == 1:
+ result = await DumpOneProductConfig(lunches[0], out_dir)
+ result.dumpToFile(out)
+ out.write("\n")
+ else:
+ await DumpProductConfigs(out, lunches, out_dir)
+ else:
+ # All configs mode. This will exec single config mode in parallel
+ # for each lunch combo. Write output to $DIST_DIR.
+ await DumpProductConfigs(out, GenerateAllLunchTargets(), out_dir)
+
+
+if __name__ == "__main__":
+ asyncio.run(main())
+
+
+# vim: set syntax=python ts=4 sw=4 sts=4:
+
diff --git a/core/config.mk b/core/config.mk
index a294223..192c8b2 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -173,6 +173,7 @@
$(KATI_obsolete_var BUILDING_PVMFW_IMAGE,BUILDING_PVMFW_IMAGE is no longer used)
$(KATI_obsolete_var BOARD_BUILD_SYSTEM_ROOT_IMAGE)
$(KATI_obsolete_var FS_GET_STATS)
+$(KATI_obsolete_var BUILD_BROKEN_USES_SOONG_PYTHON2_MODULES)
# Used to force goals to build. Only use for conditionally defined goals.
.PHONY: FORCE
@@ -363,8 +364,7 @@
# configs, generally for cross-cutting features.
# Build broken variables that should be treated as booleans
-_build_broken_bool_vars := \
- BUILD_BROKEN_USES_SOONG_PYTHON2_MODULES \
+_build_broken_bool_vars :=
# Build broken variables that should be treated as lists
_build_broken_list_vars := \
@@ -1207,6 +1207,11 @@
APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)
+# Add BUILD_NUMBER to apps if PRODUCT_BUILD_APPS_WITH_BUILD_NUMBER is defined.
+ifeq ($(PRODUCT_BUILD_APPS_WITH_BUILD_NUMBER),true)
+ APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)-$(BUILD_NUMBER_FROM_FILE)
+endif
+
# ANDROID_WARNING_ALLOWED_PROJECTS is generated by build/soong.
define find_warning_allowed_projects
$(filter $(ANDROID_WARNING_ALLOWED_PROJECTS),$(1)/)
diff --git a/core/product.mk b/core/product.mk
index 8d86d92..4c23e5d 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -493,6 +493,9 @@
# by this flag.
_product_single_value_vars += PRODUCT_NOT_DEBUGGABLE_IN_USERDEBUG
+# If set, the default value of the versionName of apps will include the build number.
+_product_single_value_vars += PRODUCT_BUILD_APPS_WITH_BUILD_NUMBER
+
# If set, build would generate system image from Soong-defined module.
_product_single_value_vars += PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE
diff --git a/core/soong_config.mk b/core/soong_config.mk
index a018c9b..fddb500 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -286,7 +286,6 @@
$(call add_json_bool, GenruleSandboxing, $(if $(GENRULE_SANDBOXING),$(filter true,$(GENRULE_SANDBOXING)),$(if $(filter true,$(BUILD_BROKEN_GENRULE_SANDBOXING)),,true)))
$(call add_json_bool, BuildBrokenEnforceSyspropOwner, $(filter true,$(BUILD_BROKEN_ENFORCE_SYSPROP_OWNER)))
$(call add_json_bool, BuildBrokenTrebleSyspropNeverallow, $(filter true,$(BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW)))
-$(call add_json_bool, BuildBrokenUsesSoongPython2Modules, $(filter true,$(BUILD_BROKEN_USES_SOONG_PYTHON2_MODULES)))
$(call add_json_bool, BuildBrokenVendorPropertyNamespace, $(filter true,$(BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE)))
$(call add_json_bool, BuildBrokenIncorrectPartitionImages, $(filter true,$(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES)))
$(call add_json_list, BuildBrokenInputDirModules, $(BUILD_BROKEN_INPUT_DIR_MODULES))
diff --git a/core/tasks/tools/compatibility.mk b/core/tasks/tools/compatibility.mk
index 86c23f8..9189c2d 100644
--- a/core/tasks/tools/compatibility.mk
+++ b/core/tasks/tools/compatibility.mk
@@ -29,7 +29,9 @@
special_mts_test_suites :=
special_mts_test_suites += mcts
special_mts_test_suites += $(mts_modules)
-ifneq ($(filter $(special_mts_test_suites),$(subst -, ,$(test_suite_name))),)
+ifneq ($(filter $(special_mts_test_suites),$(patsubst mcts-%,%,$(test_suite_name))),)
+ test_suite_subdir := android-mts
+else ifneq ($(filter $(special_mts_test_suites),$(patsubst mts-%,%,$(test_suite_name))),)
test_suite_subdir := android-mts
else
test_suite_subdir := android-$(test_suite_name)
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 9e34538..d806c06 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -83,7 +83,6 @@
CtsShimPrivPrebuilt \
debuggerd\
device_config \
- DeviceDiagnostics \
dmctl \
dnsmasq \
dmesgd \
@@ -533,3 +532,4 @@
$(call soong_config_set, bionic, large_system_property_node, $(RELEASE_LARGE_SYSTEM_PROPERTY_NODE))
$(call soong_config_set, Aconfig, read_from_new_storage, $(RELEASE_READ_FROM_NEW_STORAGE))
+$(call soong_config_set, SettingsLib, legacy_avatar_picker_app_enabled, $(if $(RELEASE_AVATAR_PICKER_APP),,true))
diff --git a/target/product/go_defaults.mk b/target/product/go_defaults.mk
index 4627fde..c928530 100644
--- a/target/product/go_defaults.mk
+++ b/target/product/go_defaults.mk
@@ -17,7 +17,8 @@
# Inherit common Android Go defaults.
$(call inherit-product, build/make/target/product/go_defaults_common.mk)
-PRODUCT_RELEASE_CONFIG_MAPS += $(wildcard vendor/google_shared/build/release/go_devices/release_config_map.textproto)
+# Product config map to toggle between sources and prebuilts of required mainline modules
+PRODUCT_RELEASE_CONFIG_MAPS += $(wildcard vendor/google_shared/build/release/gms_mainline_go/required/release_config_map.textproto)
# Add the system properties.
TARGET_SYSTEM_PROP += \
diff --git a/target/product/handheld_system.mk b/target/product/handheld_system.mk
index 3f3bd01..546bbe7 100644
--- a/target/product/handheld_system.mk
+++ b/target/product/handheld_system.mk
@@ -46,6 +46,7 @@
CertInstaller \
CredentialManager \
DeviceAsWebcam \
+ DeviceDiagnostics \
DocumentsUI \
DownloadProviderUi \
EasterEgg \
diff --git a/target/product/media_system_ext.mk b/target/product/media_system_ext.mk
index 2e20af3..30dd2e2 100644
--- a/target/product/media_system_ext.mk
+++ b/target/product/media_system_ext.mk
@@ -23,3 +23,6 @@
# /system_ext packages
PRODUCT_PACKAGES += \
vndk_apex_snapshot_package \
+
+# Window Extensions
+$(call inherit-product, $(SRC_TARGET_DIR)/product/window_extensions_base.mk)
diff --git a/target/product/window_extensions.mk b/target/product/window_extensions.mk
index 5f5431f..d27a613 100644
--- a/target/product/window_extensions.mk
+++ b/target/product/window_extensions.mk
@@ -14,11 +14,14 @@
# limitations under the License.
#
-# /system_ext packages
-PRODUCT_PACKAGES += \
- androidx.window.extensions \
- androidx.window.sidecar
-
-# properties
+# Extension of window_extensions_base.mk to enable the activity embedding
+# feature for all apps by default. All large screen devices must inherit
+# this in build. Optional for other form factors.
+#
+# Indicated whether the Activity Embedding feature should be guarded by
+# Android 15 to avoid app compat impact.
+# If true (or not set), the feature is only enabled for apps with target
+# SDK of Android 15 or above.
+# If false, the feature is enabled for all apps.
PRODUCT_PRODUCT_PROPERTIES += \
- persist.wm.extensions.enabled=true
+ persist.wm.extensions.activity_embedding_guard_with_android_15=false
diff --git a/target/product/window_extensions_base.mk b/target/product/window_extensions_base.mk
new file mode 100644
index 0000000..ee0e5e7
--- /dev/null
+++ b/target/product/window_extensions_base.mk
@@ -0,0 +1,33 @@
+#
+# Copyright (C) 2024 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.
+#
+
+# The base version of window_extensions.mk to be included on all non-wearable
+# devices. Devices that don't support multi-window can choose to drop this.
+#
+# Note: by default the Activity Embedding feature is guarded by app's
+# targetSDK on Android 15 to avoid app compat impact.
+#
+# Large screen devices must inherit window_extensions.mk to enable the
+# Activity Embedding feature for all apps.
+
+# /system_ext packages
+PRODUCT_PACKAGES += \
+ androidx.window.extensions \
+ androidx.window.sidecar
+
+# properties
+PRODUCT_PRODUCT_PROPERTIES += \
+ persist.wm.extensions.enabled=true
diff --git a/tools/filelistdiff/Android.bp b/tools/filelistdiff/Android.bp
index 632ada3..ab766d6 100644
--- a/tools/filelistdiff/Android.bp
+++ b/tools/filelistdiff/Android.bp
@@ -24,4 +24,4 @@
prebuilt_etc_host {
name: "system_image_diff_allowlist",
src: "allowlist",
-}
+}
\ No newline at end of file
diff --git a/tools/filelistdiff/allowlist b/tools/filelistdiff/allowlist
index 073a8de..c4a464d 100644
--- a/tools/filelistdiff/allowlist
+++ b/tools/filelistdiff/allowlist
@@ -34,4 +34,16 @@
# Known diffs only in the Soong system image
lib/libhidcommand_jni.so
-lib/libuinputcommand_jni.so
\ No newline at end of file
+lib/libuinputcommand_jni.so
+
+# Known diffs in internal source
+bin/uprobestats
+etc/aconfig/flag.map
+etc/aconfig/flag.val
+etc/aconfig/package.map
+etc/bpf/uprobestats/BitmapAllocation.o
+etc/bpf/uprobestats/GenericInstrumentation.o
+etc/init/UprobeStats.rc
+lib/libuprobestats_client.so
+lib64/libuprobestats_client.so
+priv-app/DeviceDiagnostics/DeviceDiagnostics.apk
\ No newline at end of file
diff --git a/tools/finalization/README.md b/tools/finalization/README.md
index d0aed69..5e2aecd 100644
--- a/tools/finalization/README.md
+++ b/tools/finalization/README.md
@@ -19,3 +19,8 @@
## Utility:
[Full cleanup](./cleanup.sh). Remove all local changes and switch each project into head-less state. This is the best state to sync/rebase/finalize the branch.
+
+## Dry run:
+[Full cleanup](./dryrun-cleanup.sh). Remove all local changes and switch each project into head-less state. Also removes "DryRun" branches.
+[SDK](./dryrun-step-1.sh). Perform SDK finalization and upload the CLs to Gerrit.
+[SDK and REL](./dryrun-step-1-and-2.sh). Perform SDK finalization, plus all necessary changes to switch configuration to REL, and upload the CLs to Gerrit.
\ No newline at end of file
diff --git a/tools/finalization/build-step-1-and-m.sh b/tools/finalization/build-step-1-and-m.sh
index 0e7129f..88bb347 100755
--- a/tools/finalization/build-step-1-and-m.sh
+++ b/tools/finalization/build-step-1-and-m.sh
@@ -9,10 +9,9 @@
local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
# This command tests:
- # The release state for AIDL.
# ABI difference between user and userdebug builds.
# Resource/SDK finalization.
- AIDL_FROZEN_REL=true $m
+ $m
}
finalize_main_step1_and_m
diff --git a/tools/finalization/cleanup.sh b/tools/finalization/cleanup.sh
index cd87b1d..e2a0592 100755
--- a/tools/finalization/cleanup.sh
+++ b/tools/finalization/cleanup.sh
@@ -14,8 +14,8 @@
repo forall -c '\
git checkout . ; git revert --abort ; git clean -fdx ;\
- git checkout @ ; git branch fina-step1 -D ; git reset --hard; \
- repo start fina-step1 ; git checkout @ ; git b fina-step1 -D ;'
+ git checkout @ --detach ; git branch fina-step1 -D ; git reset --hard; \
+ repo start fina-step1 ; git checkout @ --detach ; git b fina-step1 -D ;'
}
finalize_revert_local_changes_main
diff --git a/tools/finalization/command-line-options.sh b/tools/finalization/command-line-options.sh
new file mode 100644
index 0000000..d9397c2
--- /dev/null
+++ b/tools/finalization/command-line-options.sh
@@ -0,0 +1,8 @@
+ARGV=$(getopt --options '' --long dry-run -- "$@")
+eval set -- "$ARGV"
+while true; do
+ case "$1" in
+ --dry-run) repo_upload_dry_run_arg="--dry-run"; repo_branch="finalization-dry-run"; shift ;;
+ *) break
+ esac
+done
diff --git a/tools/finalization/dryrun-cleanup.sh b/tools/finalization/dryrun-cleanup.sh
new file mode 100755
index 0000000..ddaffae
--- /dev/null
+++ b/tools/finalization/dryrun-cleanup.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# Brings local repository to a remote head state. Also removes all dryrun branches.
+
+# set -ex
+
+function finalize_revert_local_changes_main() {
+ local top="$(dirname "$0")"/../../../..
+ source $top/build/make/tools/finalization/environment.sh
+
+ local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+
+ # remove the out folder
+ $m clobber
+
+ repo selfupdate
+
+ repo forall -c '\
+ git checkout . ; git revert --abort ; git clean -fdx ;\
+ git checkout @ --detach ; git branch fina-step1 -D ; git reset --hard; \
+ repo start fina-step1 ; git checkout @ --detach ; git b fina-step1 -D ; \
+ git b $FINAL_PLATFORM_CODENAME-SDK-Finalization-DryRun -D; \
+ git b $FINAL_PLATFORM_CODENAME-SDK-Finalization-DryRun-Rel -D; '
+}
+
+finalize_revert_local_changes_main
diff --git a/tools/finalization/dryrun-step-1-and-2.sh b/tools/finalization/dryrun-step-1-and-2.sh
new file mode 100755
index 0000000..f883bca
--- /dev/null
+++ b/tools/finalization/dryrun-step-1-and-2.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# Script to perform 1st and 2nd step of Android Finalization, create CLs and upload to Gerrit.
+
+function commit_step_2_changes() {
+ repo forall -c '\
+ if [[ $(git status --short) ]]; then
+ repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization-DryRun-Rel" ;
+ git add -A . ;
+ git commit -m "$FINAL_PLATFORM_CODENAME/$FINAL_PLATFORM_SDK_VERSION is now REL" \
+ -m "Ignore-AOSP-First: $FINAL_PLATFORM_CODENAME Finalization
+Bug: $FINAL_BUG_ID
+Test: build";
+
+ repo upload --cbr --no-verify -o nokeycheck -t -y . ;
+ fi'
+}
+
+function finalize_step_2_main() {
+ local top="$(dirname "$0")"/../../../..
+ source $top/build/make/tools/finalization/environment.sh
+
+ source $top/build/make/tools/finalization/finalize-sdk-resources.sh
+
+ source $top/build/make/tools/finalization/localonly-steps.sh
+
+ source $top/build/make/tools/finalization/finalize-sdk-rel.sh
+
+ # move all changes to finalization branch/topic and upload to gerrit
+ commit_step_2_changes
+
+ # build to confirm everything is OK
+ local m_next="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ $m_next
+
+ local m_fina="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=fina_2 TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ $m_fina
+}
+
+finalize_step_2_main
diff --git a/tools/finalization/dryrun-step-1.sh b/tools/finalization/dryrun-step-1.sh
new file mode 100755
index 0000000..0f2bc63
--- /dev/null
+++ b/tools/finalization/dryrun-step-1.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# Script to perform a dry run of step 1 of Android Finalization, create CLs and upload to Gerrit.
+
+function commit_step_1_changes() {
+ repo forall -c '\
+ if [[ $(git status --short) ]]; then
+ repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization-DryRun" ;
+ git add -A . ;
+ git commit -m "$FINAL_PLATFORM_CODENAME is now $FINAL_PLATFORM_SDK_VERSION" \
+ -m "Ignore-AOSP-First: $FINAL_PLATFORM_CODENAME Finalization
+Bug: $FINAL_BUG_ID
+Test: build";
+
+ repo upload --cbr --no-verify -o nokeycheck -t -y . ;
+ fi'
+}
+
+function finalize_step_1_main() {
+ local top="$(dirname "$0")"/../../../..
+ source $top/build/make/tools/finalization/environment.sh
+
+ source $top/build/make/tools/finalization/finalize-sdk-resources.sh
+
+ # move all changes to finalization branch/topic and upload to gerrit
+ commit_step_1_changes
+
+ # build to confirm everything is OK
+ local m_next="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ $m_next
+
+ local m_fina="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=fina_1 TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ $m_fina
+}
+
+finalize_step_1_main
diff --git a/tools/finalization/environment.sh b/tools/finalization/environment.sh
index 7961e8b..f68a68b 100755
--- a/tools/finalization/environment.sh
+++ b/tools/finalization/environment.sh
@@ -15,14 +15,14 @@
# We might or might not fix this in future, but for now let's keep it +1.
export FINAL_PLATFORM_SDK_VERSION='35'
# Feel free to randomize once in a while to detect buggy version detection code.
-export FINAL_MAINLINE_EXTENSION='58'
+export FINAL_MAINLINE_EXTENSION='13'
# Options:
# 'unfinalized' - branch is in development state,
# 'vintf' - VINTF is finalized
# 'sdk' - VINTF and SDK/API are finalized
# 'rel' - branch is finalized, switched to REL
-export FINAL_STATE='vintf'
+export FINAL_STATE='rel'
export BUILD_FROM_SOURCE_STUB=true
diff --git a/tools/finalization/finalize-sdk-rel.sh b/tools/finalization/finalize-sdk-rel.sh
index 59fe28c..c49f974 100755
--- a/tools/finalization/finalize-sdk-rel.sh
+++ b/tools/finalization/finalize-sdk-rel.sh
@@ -8,12 +8,6 @@
fi
}
-function revert_resources_sdk_int_fix() {
- if grep -q 'public static final int RESOURCES_SDK_INT = SDK_INT;' "$top/frameworks/base/core/java/android/os/Build.java" ; then
- patch --strip=1 --no-backup-if-mismatch --directory="$top/frameworks/base" --input=../../build/make/tools/finalization/frameworks_base.revert_resource_sdk_int.diff
- fi
-}
-
function apply_prerelease_sdk_hack() {
if ! grep -q 'STOPSHIP: hack for the pre-release SDK' "$top/frameworks/base/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java" ; then
patch --strip=1 --no-backup-if-mismatch --directory="$top/frameworks/base" --input=../../build/make/tools/finalization/frameworks_base.apply_hack.diff
@@ -30,25 +24,18 @@
# let the apps built with pre-release SDK parse
apply_prerelease_sdk_hack
- # in REL mode, resources would correctly set the resources_sdk_int, no fix required
- revert_resources_sdk_int_fix
-
# cts
- echo "$FINAL_PLATFORM_VERSION" > "$top/cts/tests/tests/os/assets/platform_versions.txt"
+ if ! grep -q "${FINAL_PLATFORM_VERSION}" "$top/cts/tests/tests/os/assets/platform_versions.txt" ; then
+ echo ${FINAL_PLATFORM_VERSION} >> "$top/cts/tests/tests/os/assets/platform_versions.txt"
+ fi
if [ "$FINAL_PLATFORM_CODENAME" != "$CURRENT_PLATFORM_CODENAME" ]; then
echo "$CURRENT_PLATFORM_CODENAME" >> "./cts/tests/tests/os/assets/platform_versions.txt"
fi
git -C "$top/cts" mv hostsidetests/theme/assets/${FINAL_PLATFORM_CODENAME} hostsidetests/theme/assets/${FINAL_PLATFORM_SDK_VERSION}
# prebuilts/abi-dumps/platform
- mkdir -p "$top/prebuilts/abi-dumps/platform/$FINAL_PLATFORM_SDK_VERSION"
- cp -r "$top/prebuilts/abi-dumps/platform/current/64/" "$top/prebuilts/abi-dumps/platform/$FINAL_PLATFORM_SDK_VERSION/"
-
- # TODO(b/309880485)
- # uncomment and update
- # prebuilts/abi-dumps/ndk
- #mkdir -p "$top/prebuilts/abi-dumps/ndk/$FINAL_PLATFORM_SDK_VERSION"
- #cp -r "$top/prebuilts/abi-dumps/ndk/current/64/" "$top/prebuilts/abi-dumps/ndk/$FINAL_PLATFORM_SDK_VERSION/"
+ "$top/build/soong/soong_ui.bash" --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug create_reference_dumps
+ ANDROID_BUILD_TOP="$top" "$top/out/host/linux-x86/bin/create_reference_dumps" -release next --build-variant userdebug --lib-variant APEX
}
finalize_sdk_rel
diff --git a/tools/finalization/finalize-sdk-resources.sh b/tools/finalization/finalize-sdk-resources.sh
index 596f803..10266ed 100755
--- a/tools/finalization/finalize-sdk-resources.sh
+++ b/tools/finalization/finalize-sdk-resources.sh
@@ -9,13 +9,6 @@
fi
}
-function apply_resources_sdk_int_fix() {
- if ! grep -q 'public static final int RESOURCES_SDK_INT = SDK_INT;' "$top/frameworks/base/core/java/android/os/Build.java" ; then
- local base_git_root="$(readlink -f $top/frameworks/base)"
- patch --strip=1 --no-backup-if-mismatch --directory="$base_git_root" --input=../../build/make/tools/finalization/frameworks_base.apply_resource_sdk_int.diff
- fi
-}
-
function finalize_bionic_ndk() {
# Adding __ANDROID_API_<>__.
# If this hasn't done then it's not used and not really needed. Still, let's check and add this.
@@ -41,7 +34,8 @@
echo " /** Checks if the device is running on a release version of Android $FINAL_PLATFORM_CODENAME or newer */
@ChecksSdkIntAtLeast(api = $FINAL_PLATFORM_SDK_VERSION /* BUILD_VERSION_CODES.$FINAL_PLATFORM_CODENAME */)
public static boolean isAtLeast${FINAL_PLATFORM_CODENAME:0:1}() {
- return SDK_INT >= $FINAL_PLATFORM_SDK_VERSION;
+ return SDK_INT >= $FINAL_PLATFORM_SDK_VERSION ||
+ (SDK_INT == $(($FINAL_PLATFORM_SDK_VERSION - 1)) && isAtLeastPreReleaseCodename(\"$FINAL_PLATFORM_CODENAME\"));
}" > "$tmpfile"
local javaFuncRegex='\/\*\*[^{]*isAtLeast'"${shortCodename}"'() {[^{}]*}'
@@ -55,7 +49,11 @@
d}' $javaSdkLevel
echo "// Checks if the device is running on release version of Android ${FINAL_PLATFORM_CODENAME:0:1} or newer.
-inline bool IsAtLeast${FINAL_PLATFORM_CODENAME:0:1}() { return android_get_device_api_level() >= $FINAL_PLATFORM_SDK_VERSION; }" > "$tmpfile"
+inline bool IsAtLeast${FINAL_PLATFORM_CODENAME:0:1}() {
+ return android_get_device_api_level() >= $FINAL_PLATFORM_SDK_VERSION ||
+ (android_get_device_api_level() == $(($FINAL_PLATFORM_SDK_VERSION - 1)) &&
+ detail::IsAtLeastPreReleaseCodename(\"$FINAL_PLATFORM_CODENAME\"));
+}" > "$tmpfile"
local cppFuncRegex='\/\/[^{]*IsAtLeast'"${shortCodename}"'() {[^{}]*}'
local cppFuncReplace="N;N;N;N;N;N; s/$cppFuncRegex/$methodPlaceholder/; /$cppFuncRegex/!{P;D};"
@@ -123,14 +121,18 @@
sed -i -e 's/Pkg\.Revision.*/Pkg\.Revision=${PLATFORM_SDK_VERSION}.0.0/g' $build_tools_source
# build/soong
- local codename_version="\"${FINAL_PLATFORM_CODENAME}\": ${FINAL_PLATFORM_SDK_VERSION}"
+ local codename_version="\"${FINAL_PLATFORM_CODENAME}\": ${FINAL_PLATFORM_SDK_VERSION}"
if ! grep -q "$codename_version" "$top/build/soong/android/api_levels.go" ; then
sed -i -e "/:.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\\t\t$codename_version," "$top/build/soong/android/api_levels.go"
fi
# cts
- echo ${FINAL_PLATFORM_VERSION} > "$top/cts/tests/tests/os/assets/platform_releases.txt"
- sed -i -e "s/EXPECTED_SDK = $((${FINAL_PLATFORM_SDK_VERSION}-1))/EXPECTED_SDK = ${FINAL_PLATFORM_SDK_VERSION}/g" "$top/cts/tests/tests/os/src/android/os/cts/BuildVersionTest.java"
+ if ! grep -q "${FINAL_PLATFORM_VERSION}" "$top/cts/tests/tests/os/assets/platform_releases.txt" ; then
+ echo ${FINAL_PLATFORM_VERSION} >> "$top/cts/tests/tests/os/assets/platform_releases.txt"
+ fi
+ if ! grep -q "$((${FINAL_PLATFORM_SDK_VERSION}-1)), ${FINAL_PLATFORM_VERSION}" "$top/cts/tests/tests/os/src/android/os/cts/BuildVersionTest.java" ; then
+ sed -i -e "s/.*EXPECTED_SDKS = List.of(.*$((${FINAL_PLATFORM_SDK_VERSION}-1))/&, $FINAL_PLATFORM_SDK_VERSION/" "$top/cts/tests/tests/os/src/android/os/cts/BuildVersionTest.java"
+ fi
# libcore
sed -i "s%$SDK_CODENAME%$SDK_VERSION%g" "$top/libcore/dalvik/src/main/java/dalvik/annotation/compat/VersionCodes.java"
@@ -153,7 +155,6 @@
# frameworks/base
sed -i "s%$SDK_CODENAME%$SDK_VERSION%g" "$top/frameworks/base/core/java/android/os/Build.java"
- apply_resources_sdk_int_fix
sed -i -e "/=.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\ SDK_${FINAL_PLATFORM_CODENAME_JAVA} = ${FINAL_PLATFORM_SDK_VERSION}," "$top/frameworks/base/tools/aapt/SdkConstants.h"
sed -i -e "/=.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\ SDK_${FINAL_PLATFORM_CODENAME_JAVA} = ${FINAL_PLATFORM_SDK_VERSION}," "$top/frameworks/base/tools/aapt2/SdkConstants.h"
diff --git a/tools/finalization/finalize-vintf-resources.sh b/tools/finalization/finalize-vintf-resources.sh
index a55d8e1..d532b25 100755
--- a/tools/finalization/finalize-vintf-resources.sh
+++ b/tools/finalization/finalize-vintf-resources.sh
@@ -16,8 +16,6 @@
export TARGET_RELEASE=fina_0
export TARGET_PRODUCT=aosp_arm64
- # TODO(b/314010764): finalize LL_NDK
-
# system/sepolicy
"$top/system/sepolicy/tools/finalize-vintf-resources.sh" "$top" "$FINAL_BOARD_API_LEVEL"
@@ -25,7 +23,11 @@
# pre-finalization build target (trunk)
local aidl_m="$top/build/soong/soong_ui.bash --make-mode"
- AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api
+ AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api create_reference_dumps
+
+ # Generate LLNDK ABI dumps
+ # This command depends on ANDROID_BUILD_TOP
+ "$ANDROID_HOST_OUT/bin/create_reference_dumps" -release "$TARGET_RELEASE" --build-variant "$TARGET_BUILD_VARIANT" --lib-variant LLNDK
}
function create_new_compat_matrix_and_kernel_configs() {
diff --git a/tools/finalization/frameworks_base.apply_resource_sdk_int.diff b/tools/finalization/frameworks_base.apply_resource_sdk_int.diff
deleted file mode 100644
index f0576d0..0000000
--- a/tools/finalization/frameworks_base.apply_resource_sdk_int.diff
+++ /dev/null
@@ -1,24 +0,0 @@
-From cdb47fc90b8d6860ec1dc5efada1f9ccd471618b Mon Sep 17 00:00:00 2001
-From: Alex Buynytskyy <alexbuy@google.com>
-Date: Tue, 11 Apr 2023 22:12:44 +0000
-Subject: [PATCH] Don't force +1 for resource resolution.
-
-Bug: 277674088
-Fixes: 277674088
-Test: boots, no crashes
-Change-Id: I17e743a0f1cf6f98fddd40c358dea5a8b9cc7723
----
-
-diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
-index eb47170..4d3e92b 100755
---- a/core/java/android/os/Build.java
-+++ b/core/java/android/os/Build.java
-@@ -493,7 +493,7 @@
- * @hide
- */
- @TestApi
-- public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length;
-+ public static final int RESOURCES_SDK_INT = SDK_INT;
-
- /**
- * The current lowest supported value of app target SDK. Applications targeting
diff --git a/tools/finalization/frameworks_base.revert_resource_sdk_int.diff b/tools/finalization/frameworks_base.revert_resource_sdk_int.diff
deleted file mode 100644
index 2ade499..0000000
--- a/tools/finalization/frameworks_base.revert_resource_sdk_int.diff
+++ /dev/null
@@ -1,27 +0,0 @@
-From c7e460bb19071d867cd7ca04282ce42694f4f358 Mon Sep 17 00:00:00 2001
-From: Alex Buynytskyy <alexbuy@google.com>
-Date: Wed, 12 Apr 2023 01:06:26 +0000
-Subject: [PATCH] Revert "Don't force +1 for resource resolution."
-
-It's not required for master.
-
-This reverts commit f1cb683988f81579a76ddbf9993848a4a06dd28c.
-
-Bug: 277674088
-Test: boots, no crashes
-Change-Id: Ia1692548f26496fdc6f1e4f0557213c7996d6823
----
-
-diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
-index 4d3e92b..eb47170 100755
---- a/core/java/android/os/Build.java
-+++ b/core/java/android/os/Build.java
-@@ -493,7 +493,7 @@
- * @hide
- */
- @TestApi
-- public static final int RESOURCES_SDK_INT = SDK_INT;
-+ public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length;
-
- /**
- * The current lowest supported value of app target SDK. Applications targeting
diff --git a/tools/finalization/localonly-steps.sh b/tools/finalization/localonly-steps.sh
index bebd563..94ee368 100755
--- a/tools/finalization/localonly-steps.sh
+++ b/tools/finalization/localonly-steps.sh
@@ -10,14 +10,15 @@
local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_RELEASE=fina_1 TARGET_BUILD_VARIANT=userdebug DIST_DIR=out/dist"
# adb keys
- $m adb
- LOGNAME=android-eng HOSTNAME=google.com "$top/out/host/linux-x86/bin/adb" keygen "$top/vendor/google/security/adb/${FINAL_PLATFORM_VERSION}.adb_key"
+ # The keys are already generated for Android 15. Keeping the command (commented out) for future reference.
+ # $m adb
+ # LOGNAME=android-eng HOSTNAME=google.com "$top/out/host/linux-x86/bin/adb" keygen "$top/vendor/google/security/adb/${FINAL_PLATFORM_VERSION}.adb_key"
# Build Platform SDKs.
$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=sdk TARGET_RELEASE=fina_1 TARGET_BUILD_VARIANT=userdebug sdk dist sdk_repo DIST_DIR=out/dist
# Build Modules SDKs.
- TARGET_RELEASE=fina_1 TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true DIST_DIR=out/dist "$top/vendor/google/build/mainline_modules_sdks.sh" --build-release=latest
+ TARGET_RELEASE=fina_1 TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true DIST_DIR=out/dist "$top/vendor/google/build/mainline_modules_sdks.sh" --build-release=next
# Update prebuilts.
"$top/prebuilts/build-tools/path/linux-x86/python3" -W ignore::DeprecationWarning "$top/prebuilts/sdk/update_prebuilts.py" --local_mode -f ${FINAL_PLATFORM_SDK_VERSION} -e ${FINAL_MAINLINE_EXTENSION} --bug 1 1
diff --git a/tools/finalization/step-0.sh b/tools/finalization/step-0.sh
index e61c644..2087f6e 100755
--- a/tools/finalization/step-0.sh
+++ b/tools/finalization/step-0.sh
@@ -9,19 +9,21 @@
set +e
repo forall -c '\
if [[ $(git status --short) ]]; then
- repo start "VINTF-$FINAL_BOARD_API_LEVEL-Finalization" ;
+ repo start "'$repo_branch'" ;
git add -A . ;
git commit -m "Vendor API level $FINAL_BOARD_API_LEVEL is now frozen" \
-m "Ignore-AOSP-First: VINTF $FINAL_BOARD_API_LEVEL Finalization
Bug: $FINAL_BUG_ID
Test: build";
- repo upload --cbr --no-verify -o nokeycheck -t -y . ;
+ repo upload '"$repo_upload_dry_run_arg"' --cbr --no-verify -o nokeycheck -t -y . ;
fi'
}
function finalize_step_0_main() {
local top="$(dirname "$0")"/../../../..
source $top/build/make/tools/finalization/environment.sh
+ local repo_branch="VINTF-$FINAL_BOARD_API_LEVEL-Finalization"
+ source $top/build/make/tools/finalization/command-line-options.sh
local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
@@ -34,4 +36,4 @@
AIDL_FROZEN_REL=true $m
}
-finalize_step_0_main
+finalize_step_0_main $@
diff --git a/tools/finalization/step-1.sh b/tools/finalization/step-1.sh
index 0e483d5..736d641 100755
--- a/tools/finalization/step-1.sh
+++ b/tools/finalization/step-1.sh
@@ -7,21 +7,21 @@
set +e
repo forall -c '\
if [[ $(git status --short) ]]; then
- repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization" ;
+ repo start "'$repo_branch'" ;
git add -A . ;
git commit -m "$FINAL_PLATFORM_CODENAME is now $FINAL_PLATFORM_SDK_VERSION and extension version $FINAL_MAINLINE_EXTENSION" \
-m "Ignore-AOSP-First: $FINAL_PLATFORM_CODENAME Finalization
Bug: $FINAL_BUG_ID
Test: build";
- repo upload --cbr --no-verify -o nokeycheck -t -y . ;
+ repo upload '"$repo_upload_dry_run_arg"' --cbr --no-verify -o nokeycheck -t -y . ;
fi'
}
function finalize_step_1_main() {
local top="$(dirname "$0")"/../../../..
source $top/build/make/tools/finalization/environment.sh
-
- local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ local repo_branch="$FINAL_PLATFORM_CODENAME-SDK-Finalization"
+ source $top/build/make/tools/finalization/command-line-options.sh
source $top/build/make/tools/finalization/finalize-sdk-resources.sh
@@ -29,7 +29,11 @@
commit_step_1_changes
# build to confirm everything is OK
- AIDL_FROZEN_REL=true $m
+ local m_next="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ $m_next
+
+ local m_fina="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=fina_1 TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ $m_fina
}
-finalize_step_1_main
+finalize_step_1_main $@
diff --git a/tools/finalization/step-2.sh b/tools/finalization/step-2.sh
index 356cad0..52e3887 100755
--- a/tools/finalization/step-2.sh
+++ b/tools/finalization/step-2.sh
@@ -4,22 +4,22 @@
function commit_step_2_changes() {
repo forall -c '\
if [[ $(git status --short) ]]; then
- repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization-Rel" ;
+ repo start "'$repo_branch'" ;
git add -A . ;
git commit -m "$FINAL_PLATFORM_CODENAME/$FINAL_PLATFORM_SDK_VERSION is now REL" \
-m "Ignore-AOSP-First: $FINAL_PLATFORM_CODENAME Finalization
Bug: $FINAL_BUG_ID
Test: build";
- repo upload --cbr --no-verify -o nokeycheck -t -y . ;
+ repo upload '"$repo_upload_dry_run_arg"' --cbr --no-verify -o nokeycheck -t -y . ;
fi'
}
function finalize_step_2_main() {
local top="$(dirname "$0")"/../../../..
source $top/build/make/tools/finalization/environment.sh
-
- local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ local repo_branch="$FINAL_PLATFORM_CODENAME-SDK-Finalization-Rel"
+ source $top/build/make/tools/finalization/command-line-options.sh
# prebuilts etc
source $top/build/make/tools/finalization/finalize-sdk-rel.sh
@@ -28,7 +28,11 @@
commit_step_2_changes
# build to confirm everything is OK
- AIDL_FROZEN_REL=true $m
+ local m_next="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ $m_next
+
+ local m_fina="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=fina_2 TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ $m_fina
}
-finalize_step_2_main
+finalize_step_2_main $@
diff --git a/tools/releasetools/Android.bp b/tools/releasetools/Android.bp
index 806e192..8c71044 100644
--- a/tools/releasetools/Android.bp
+++ b/tools/releasetools/Android.bp
@@ -368,6 +368,9 @@
libs: [
"ota_utils_lib",
],
+ required: [
+ "signapk",
+ ],
}
python_binary_host {
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index b39a82c..c25ff27 100644
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -464,6 +464,7 @@
dtbo_prebuilt_path = os.path.join(
OPTIONS.input_tmp, "PREBUILT_IMAGES", "dtbo.img")
assert os.path.exists(dtbo_prebuilt_path)
+ os.makedirs(os.path.dirname(img.name), exist_ok=True)
shutil.copy(dtbo_prebuilt_path, img.name)
# AVB-sign the image as needed.
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index edd4366..f04dfb7 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -3238,7 +3238,9 @@
return t
def WriteToDir(self, d):
- with open(os.path.join(d, self.name), "wb") as fp:
+ output_path = os.path.join(d, self.name)
+ os.makedirs(os.path.dirname(output_path), exist_ok=True)
+ with open(output_path, "wb") as fp:
fp.write(self.data)
def AddToZip(self, z, compression=None):
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 8e89c87..a72342f 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -591,6 +591,7 @@
else:
common.UnzipToDir(input_tf_zip.filename, OPTIONS.input_tmp, files_to_unzip)
unzip_dir = OPTIONS.input_tmp
+ os.makedirs(os.path.join(unzip_dir, "IMAGES"), exist_ok=True)
boot_image = common.GetBootableImage(
"IMAGES/boot.img", "boot.img", unzip_dir, "BOOT", misc_info)