Make change and version bump to AP4A.240828.001

Snap for 12283639 from 4586480c30 to 24Q4-release

Change-Id: I9d6e26af18c0f779700bfd95b5bac8627ca0081c
This commit is contained in:
Android Build Coastguard Worker
2024-08-27 23:00:58 +00:00
10 changed files with 105 additions and 96 deletions

View File

@@ -76,6 +76,7 @@ python_library_host {
srcs: [ srcs: [
"build_test_suites.py", "build_test_suites.py",
"optimized_targets.py", "optimized_targets.py",
"build_context.py",
], ],
} }

64
ci/build_context.py Normal file
View File

@@ -0,0 +1,64 @@
# 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.
"""Container class for build context with utility functions."""
import re
class BuildContext:
def __init__(self, build_context_dict: dict[str, any]):
self.enabled_build_features = set()
for opt in build_context_dict.get('enabledBuildFeatures', []):
self.enabled_build_features.add(opt.get('name'))
self.test_infos = set()
for test_info_dict in build_context_dict.get('testContext', dict()).get(
'testInfos', []
):
self.test_infos.add(self.TestInfo(test_info_dict))
def build_target_used(self, target: str) -> bool:
return any(test.build_target_used(target) for test in self.test_infos)
class TestInfo:
_DOWNLOAD_OPTS = {
'test-config-only-zip',
'test-zip-file-filter',
'extra-host-shared-lib-zip',
'sandbox-tests-zips',
'additional-files-filter',
'cts-package-name',
}
def __init__(self, test_info_dict: dict[str, any]):
self.is_test_mapping = False
self.test_mapping_test_groups = set()
self.file_download_options = set()
for opt in test_info_dict.get('extraOptions', []):
key = opt.get('key')
if key == 'test-mapping-test-group':
self.is_test_mapping = True
self.test_mapping_test_groups.update(opt.get('values', set()))
if key in self._DOWNLOAD_OPTS:
self.file_download_options.update(opt.get('values', set()))
def build_target_used(self, target: str) -> bool:
# For all of a targets' outputs, check if any of the regexes used by tests
# to download artifacts would match it. If any of them do then this target
# is necessary.
regex = r'\b(%s)\b' % re.escape(target)
return any(re.search(regex, opt) for opt in self.file_download_options)

View File

@@ -24,6 +24,7 @@ import re
import subprocess import subprocess
import sys import sys
from typing import Callable from typing import Callable
from build_context import BuildContext
import optimized_targets import optimized_targets
@@ -53,18 +54,9 @@ class BuildPlanner:
any output zip files needed by the build. any output zip files needed by the build.
""" """
_DOWNLOAD_OPTS = {
'test-config-only-zip',
'test-zip-file-filter',
'extra-host-shared-lib-zip',
'sandbox-tests-zips',
'additional-files-filter',
'cts-package-name',
}
def __init__( def __init__(
self, self,
build_context: dict[str, any], build_context: BuildContext,
args: argparse.Namespace, args: argparse.Namespace,
target_optimizations: dict[str, optimized_targets.OptimizedBuildTarget], target_optimizations: dict[str, optimized_targets.OptimizedBuildTarget],
): ):
@@ -74,18 +66,15 @@ class BuildPlanner:
def create_build_plan(self): def create_build_plan(self):
if 'optimized_build' not in self.build_context.get( if 'optimized_build' not in self.build_context.enabled_build_features:
'enabledBuildFeatures', []
):
return BuildPlan(set(self.args.extra_targets), set()) return BuildPlan(set(self.args.extra_targets), set())
build_targets = set() build_targets = set()
packaging_functions = set() packaging_functions = set()
self.file_download_options = self._aggregate_file_download_options()
for target in self.args.extra_targets: for target in self.args.extra_targets:
if self._unused_target_exclusion_enabled( if self._unused_target_exclusion_enabled(
target target
) and not self._build_target_used(target): ) and not self.build_context.build_target_used(target):
continue continue
target_optimizer_getter = self.target_optimizations.get(target, None) target_optimizer_getter = self.target_optimizations.get(target, None)
@@ -102,34 +91,11 @@ class BuildPlanner:
return BuildPlan(build_targets, packaging_functions) return BuildPlan(build_targets, packaging_functions)
def _unused_target_exclusion_enabled(self, target: str) -> bool: def _unused_target_exclusion_enabled(self, target: str) -> bool:
return f'{target}_unused_exclusion' in self.build_context.get( return (
'enabledBuildFeatures', [] f'{target}_unused_exclusion'
in self.build_context.enabled_build_features
) )
def _build_target_used(self, target: str) -> bool:
"""Determines whether this target's outputs are used by the test configurations listed in the build context."""
# For all of a targets' outputs, check if any of the regexes used by tests
# to download artifacts would match it. If any of them do then this target
# is necessary.
regex = r'\b(%s)\b' % re.escape(target)
return any(re.search(regex, opt) for opt in self.file_download_options)
def _aggregate_file_download_options(self) -> set[str]:
"""Lists out all test config options to specify targets to download.
These come in the form of regexes.
"""
all_options = set()
for test_info in self._get_test_infos():
for opt in test_info.get('extraOptions', []):
# check the known list of options for downloading files.
if opt.get('key') in self._DOWNLOAD_OPTS:
all_options.update(opt.get('values', []))
return all_options
def _get_test_infos(self):
return self.build_context.get('testContext', dict()).get('testInfos', [])
@dataclass(frozen=True) @dataclass(frozen=True)
class BuildPlan: class BuildPlan:
@@ -148,7 +114,7 @@ def build_test_suites(argv: list[str]) -> int:
""" """
args = parse_args(argv) args = parse_args(argv)
check_required_env() check_required_env()
build_context = load_build_context() build_context = BuildContext(load_build_context())
build_planner = BuildPlanner( build_planner = BuildPlanner(
build_context, args, optimized_targets.OPTIMIZED_BUILD_TARGETS build_context, args, optimized_targets.OPTIMIZED_BUILD_TARGETS
) )

View File

@@ -32,6 +32,7 @@ import time
from typing import Callable from typing import Callable
import unittest import unittest
from unittest import mock from unittest import mock
from build_context import BuildContext
import build_test_suites import build_test_suites
import ci_test_lib import ci_test_lib
import optimized_targets import optimized_targets
@@ -282,7 +283,7 @@ class BuildPlannerTest(unittest.TestCase):
build_planner = self.create_build_planner( build_planner = self.create_build_planner(
build_targets=build_targets, build_targets=build_targets,
build_context=self.create_build_context( build_context=self.create_build_context(
enabled_build_features={self.get_target_flag('target_1')} enabled_build_features=[{'name': self.get_target_flag('target_1')}]
), ),
) )
@@ -297,7 +298,7 @@ class BuildPlannerTest(unittest.TestCase):
build_planner = self.create_build_planner( build_planner = self.create_build_planner(
build_targets=build_targets, build_targets=build_targets,
build_context=self.create_build_context( build_context=self.create_build_context(
enabled_build_features={self.get_target_flag('target_1')}, enabled_build_features=[{'name': self.get_target_flag('target_1')}]
), ),
packaging_outputs=packaging_outputs, packaging_outputs=packaging_outputs,
) )
@@ -337,7 +338,7 @@ class BuildPlannerTest(unittest.TestCase):
build_targets={build_target}, build_targets={build_target},
build_context=self.create_build_context( build_context=self.create_build_context(
test_context=self.get_test_context(build_target), test_context=self.get_test_context(build_target),
enabled_build_features={'test_target_unused_exclusion'}, enabled_build_features=[{'name': 'test_target_unused_exclusion'}],
), ),
) )
@@ -356,7 +357,7 @@ class BuildPlannerTest(unittest.TestCase):
build_targets={build_target}, build_targets={build_target},
build_context=self.create_build_context( build_context=self.create_build_context(
test_context=test_context, test_context=test_context,
enabled_build_features={'test_target_unused_exclusion'}, enabled_build_features=[{'name': 'test_target_unused_exclusion'}],
), ),
) )
@@ -372,7 +373,7 @@ class BuildPlannerTest(unittest.TestCase):
build_targets={build_target}, build_targets={build_target},
build_context=self.create_build_context( build_context=self.create_build_context(
test_context=test_context, test_context=test_context,
enabled_build_features={'test_target_unused_exclusion'}, enabled_build_features=[{'name': 'test_target_unused_exclusion'}],
), ),
) )
@@ -391,7 +392,7 @@ class BuildPlannerTest(unittest.TestCase):
build_targets={build_target}, build_targets={build_target},
build_context=self.create_build_context( build_context=self.create_build_context(
test_context=test_context, test_context=test_context,
enabled_build_features={'test_target_unused_exclusion'}, enabled_build_features=[{'name': 'test_target_unused_exclusion'}],
), ),
) )
@@ -402,7 +403,7 @@ class BuildPlannerTest(unittest.TestCase):
def create_build_planner( def create_build_planner(
self, self,
build_targets: set[str], build_targets: set[str],
build_context: dict[str, any] = None, build_context: BuildContext = None,
args: argparse.Namespace = None, args: argparse.Namespace = None,
target_optimizations: dict[ target_optimizations: dict[
str, optimized_targets.OptimizedBuildTarget str, optimized_targets.OptimizedBuildTarget
@@ -426,15 +427,17 @@ class BuildPlannerTest(unittest.TestCase):
def create_build_context( def create_build_context(
self, self,
optimized_build_enabled: bool = True, optimized_build_enabled: bool = True,
enabled_build_features: set[str] = set(), enabled_build_features: list[dict[str, str]] = [],
test_context: dict[str, any] = {}, test_context: dict[str, any] = {},
) -> dict[str, any]: ) -> BuildContext:
build_context = {} build_context_dict = {}
build_context['enabledBuildFeatures'] = enabled_build_features build_context_dict['enabledBuildFeatures'] = enabled_build_features
if optimized_build_enabled: if optimized_build_enabled:
build_context['enabledBuildFeatures'].add('optimized_build') build_context_dict['enabledBuildFeatures'].append(
build_context['testContext'] = test_context {'name': 'optimized_build'}
return build_context )
build_context_dict['testContext'] = test_context
return BuildContext(build_context_dict)
def create_args( def create_args(
self, extra_build_targets: set[str] = set() self, extra_build_targets: set[str] = set()
@@ -445,7 +448,7 @@ class BuildPlannerTest(unittest.TestCase):
def create_target_optimizations( def create_target_optimizations(
self, self,
build_context: dict[str, any], build_context: BuildContext,
build_targets: set[str], build_targets: set[str],
packaging_outputs: set[str] = set(), packaging_outputs: set[str] = set(),
): ):

View File

@@ -14,9 +14,10 @@
# limitations under the License. # limitations under the License.
from abc import ABC from abc import ABC
from typing import Self
import argparse import argparse
import functools import functools
from typing import Self
from build_context import BuildContext
class OptimizedBuildTarget(ABC): class OptimizedBuildTarget(ABC):
@@ -30,7 +31,7 @@ class OptimizedBuildTarget(ABC):
def __init__( def __init__(
self, self,
target: str, target: str,
build_context: dict[str, any], build_context: BuildContext,
args: argparse.Namespace, args: argparse.Namespace,
): ):
self.target = target self.target = target
@@ -38,13 +39,13 @@ class OptimizedBuildTarget(ABC):
self.args = args self.args = args
def get_build_targets(self) -> set[str]: def get_build_targets(self) -> set[str]:
features = self.build_context.get('enabledBuildFeatures', []) features = self.build_context.enabled_build_features
if self.get_enabled_flag() in features: if self.get_enabled_flag() in features:
return self.get_build_targets_impl() return self.get_build_targets_impl()
return {self.target} return {self.target}
def package_outputs(self): def package_outputs(self):
features = self.build_context.get('enabledBuildFeatures', []) features = self.build_context.enabled_build_features
if self.get_enabled_flag() in features: if self.get_enabled_flag() in features:
return self.package_outputs_impl() return self.package_outputs_impl()

View File

@@ -3416,8 +3416,10 @@ endif # PRODUCT_FSVERITY_GENERATE_METADATA
# system image # system image
INSTALLED_FILES_OUTSIDE_IMAGES := $(filter-out $(TARGET_OUT)/%, $(INSTALLED_FILES_OUTSIDE_IMAGES)) INSTALLED_FILES_OUTSIDE_IMAGES := $(filter-out $(TARGET_OUT)/%, $(INSTALLED_FILES_OUTSIDE_IMAGES))
ifdef BUILDING_SYSTEM_IMAGE
INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \ INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \
$(ALL_DEFAULT_INSTALLED_MODULES))) $(ALL_DEFAULT_INSTALLED_MODULES)))
endif
# Create symlink /system/vendor to /vendor if necessary. # Create symlink /system/vendor to /vendor if necessary.
ifdef BOARD_USES_VENDORIMAGE ifdef BOARD_USES_VENDORIMAGE
@@ -3674,10 +3676,10 @@ platform-java:
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# data partition image # data partition image
INSTALLED_FILES_OUTSIDE_IMAGES := $(filter-out $(TARGET_OUT_DATA)/%, $(INSTALLED_FILES_OUTSIDE_IMAGES)) INSTALLED_FILES_OUTSIDE_IMAGES := $(filter-out $(TARGET_OUT_DATA)/%, $(INSTALLED_FILES_OUTSIDE_IMAGES))
ifdef BUILDING_USERDATA_IMAGE
INTERNAL_USERDATAIMAGE_FILES := \ INTERNAL_USERDATAIMAGE_FILES := \
$(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES)) $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
ifdef BUILDING_USERDATA_IMAGE
userdataimage_intermediates := \ userdataimage_intermediates := \
$(call intermediates-dir-for,PACKAGING,userdata) $(call intermediates-dir-for,PACKAGING,userdata)
BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img

View File

@@ -18,4 +18,4 @@
# (like "CRB01"). It must be a single word, and is # (like "CRB01"). It must be a single word, and is
# capitalized by convention. # capitalized by convention.
BUILD_ID=AP4A.240827.002 BUILD_ID=AP4A.240828.001

View File

@@ -1860,6 +1860,11 @@ ifndef INSTALLED_RECOVERYIMAGE_TARGET
filter_out_files += $(PRODUCT_OUT)/recovery/% filter_out_files += $(PRODUCT_OUT)/recovery/%
endif endif
# userdata.img
ifndef BUILDING_USERDATA_IMAGE
filter_out_files += $(PRODUCT_OUT)/data/%
endif
installed_files := $(sort $(filter-out $(filter_out_files),$(filter $(PRODUCT_OUT)/%,$(modules_to_install)))) installed_files := $(sort $(filter-out $(filter_out_files),$(filter $(PRODUCT_OUT)/%,$(modules_to_install))))
else else
installed_files := $(apps_only_installed_files) installed_files := $(apps_only_installed_files)

View File

@@ -356,11 +356,6 @@ _config_enable_uffd_gc := \
$(call add_json_str, EnableUffdGc, $(_config_enable_uffd_gc)) $(call add_json_str, EnableUffdGc, $(_config_enable_uffd_gc))
_config_enable_uffd_gc := _config_enable_uffd_gc :=
$(call add_json_list, DeviceFrameworkCompatibilityMatrixFile, $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE))
$(call add_json_list, DeviceProductCompatibilityMatrixFile, $(DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE))
$(call add_json_list, BoardAvbSystemAddHashtreeFooterArgs, $(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS))
$(call add_json_bool, BoardAvbEnable, $(filter true,$(BOARD_AVB_ENABLE)))
$(call json_end) $(call json_end)
$(file >$(SOONG_VARIABLES).tmp,$(json_contents)) $(file >$(SOONG_VARIABLES).tmp,$(json_contents))

View File

@@ -22,34 +22,6 @@ etc/vintf/compatibility_matrix.7.xml
etc/vintf/compatibility_matrix.8.xml etc/vintf/compatibility_matrix.8.xml
etc/vintf/compatibility_matrix.device.xml etc/vintf/compatibility_matrix.device.xml
etc/vintf/manifest.xml etc/vintf/manifest.xml
framework/boot-apache-xml.vdex
framework/boot-apache-xml.vdex.fsv_meta
framework/boot-bouncycastle.vdex
framework/boot-bouncycastle.vdex.fsv_meta
framework/boot-core-icu4j.vdex
framework/boot-core-icu4j.vdex.fsv_meta
framework/boot-core-libart.vdex
framework/boot-core-libart.vdex.fsv_meta
framework/boot-ext.vdex
framework/boot-ext.vdex.fsv_meta
framework/boot-framework-adservices.vdex
framework/boot-framework-adservices.vdex.fsv_meta
framework/boot-framework-graphics.vdex
framework/boot-framework-graphics.vdex.fsv_meta
framework/boot-framework-location.vdex
framework/boot-framework-location.vdex.fsv_meta
framework/boot-framework.vdex
framework/boot-framework.vdex.fsv_meta
framework/boot-ims-common.vdex
framework/boot-ims-common.vdex.fsv_meta
framework/boot-okhttp.vdex
framework/boot-okhttp.vdex.fsv_meta
framework/boot-telephony-common.vdex
framework/boot-telephony-common.vdex.fsv_meta
framework/boot-voip-common.vdex
framework/boot-voip-common.vdex.fsv_meta
framework/boot.vdex
framework/boot.vdex.fsv_meta
framework/oat/x86_64/apex@com.android.compos@javalib@service-compos.jar@classes.odex framework/oat/x86_64/apex@com.android.compos@javalib@service-compos.jar@classes.odex
framework/oat/x86_64/apex@com.android.compos@javalib@service-compos.jar@classes.odex.fsv_meta framework/oat/x86_64/apex@com.android.compos@javalib@service-compos.jar@classes.odex.fsv_meta
framework/oat/x86_64/apex@com.android.compos@javalib@service-compos.jar@classes.vdex framework/oat/x86_64/apex@com.android.compos@javalib@service-compos.jar@classes.vdex