aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-03-30 01:52:51 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-03-30 01:52:51 +0000
commitfa132704c313c5b2f800e3be4ba96e1bffd82fcc (patch)
tree4487739029780a9b6c73a46d55193f23b36a8bef
parent7233850051f21b547bd4c9cbae2580c87f33b6d3 (diff)
parentfdd0d17562bcb291960b2bfdfe4a359950f28663 (diff)
downloadcommon-aml_tet_331820050.tar.gz
Snap for 9847046 from fdd0d17562bcb291960b2bfdfe4a359950f28663 to mainline-tethering-releaseaml_tet_331820050android13-mainline-tethering-release
Change-Id: I34a05d93f1ddef5ea29ed2b406108b9a57137ef7
-rw-r--r--MODULES_OWNERS2
-rw-r--r--OWNERS2
-rw-r--r--build/allowed_deps.txt10
-rwxr-xr-xbuild/build_unbundled_mainline_module.sh2
-rwxr-xr-xbuild/mainline_modules_sdks.py102
-rw-r--r--build/mainline_modules_sdks_test.py88
-rw-r--r--build/mainline_modules_sdks_test_data/OWNERS2
-rw-r--r--build/mainline_modules_sdks_test_data/ipsec_tiramisu_Android.bp.additional.expected79
-rw-r--r--javatests/com/android/modules/updatablesharedlibs/OWNERS2
-rw-r--r--sdk/ModuleDefaults.bp6
-rwxr-xr-xtools/finalize_sdk.py1
11 files changed, 253 insertions, 43 deletions
diff --git a/MODULES_OWNERS b/MODULES_OWNERS
index d04cb101..cbc1dc6b 100644
--- a/MODULES_OWNERS
+++ b/MODULES_OWNERS
@@ -8,7 +8,7 @@
# See go/mainline-owners-policy for more details.
hansson@google.com #{LAST_RESORT_SUGGESTION}
-satayev@google.com #{LAST_RESORT_SUGGESTION}
+robertogil@google.com #{LAST_RESORT_SUGGESTION}
# backup:
dariofreni@google.com #{LAST_RESORT_SUGGESTION}
diff --git a/OWNERS b/OWNERS
index 6008ec02..460cfa12 100644
--- a/OWNERS
+++ b/OWNERS
@@ -6,7 +6,7 @@ gurpreetgs@google.com
hansson@google.com
paulduffin@google.com
pedroql@google.com
-satayev@google.com
+robertogil@google.com
# Escalations
jham@google.com \ No newline at end of file
diff --git a/build/allowed_deps.txt b/build/allowed_deps.txt
index 7faac3c0..71edf984 100644
--- a/build/allowed_deps.txt
+++ b/build/allowed_deps.txt
@@ -116,6 +116,7 @@ android.system.suspend.control-V1-ndk(minSdkVersion:30)
android_checker_annotation_stubs(minSdkVersion:current)
android_downloader_lib(minSdkVersion:30)
androidx-constraintlayout_constraintlayout(minSdkVersion:14)
+androidx-constraintlayout_constraintlayout-core(minSdkVersion:24)
androidx-constraintlayout_constraintlayout-solver(minSdkVersion:24)
androidx.activity_activity(minSdkVersion:14)
androidx.activity_activity-ktx(minSdkVersion:14)
@@ -124,6 +125,8 @@ androidx.annotation_annotation-experimental(minSdkVersion:14)
androidx.annotation_annotation-jvm(minSdkVersion:24)
androidx.appcompat_appcompat(minSdkVersion:14)
androidx.appcompat_appcompat-resources(minSdkVersion:14)
+androidx.appsearch_appsearch(minSdkVersion:14)
+androidx.appsearch_appsearch-platform-storage(minSdkVersion:14)
androidx.arch.core_core-common(minSdkVersion:24)
androidx.arch.core_core-runtime(minSdkVersion:14)
androidx.asynclayoutinflater_asynclayoutinflater(minSdkVersion:14)
@@ -184,6 +187,7 @@ androidx.navigation_navigation-ui(minSdkVersion:14)
androidx.navigation_navigation-ui-ktx(minSdkVersion:14)
androidx.preference_preference(minSdkVersion:14)
androidx.print_print(minSdkVersion:14)
+androidx.profileinstaller_profileinstaller(minSdkVersion:14)
androidx.recyclerview_recyclerview(minSdkVersion:14)
androidx.recyclerview_recyclerview-selection(minSdkVersion:14)
androidx.resourceinspection_resourceinspection-annotation(minSdkVersion:24)
@@ -665,6 +669,7 @@ libprotobuf-cpp-lite-ndk(minSdkVersion:33)
libprotobuf-java-lite(minSdkVersion:current)
libprotobuf-java-micro(minSdkVersion:8)
libprotobuf-java-nano(minSdkVersion:9)
+libprotobuf_deprecated(minSdkVersion:29)
libprotoutil(minSdkVersion:(no version))
libprotoutil(minSdkVersion:30)
libqemu_pipe(minSdkVersion:(no version))
@@ -855,6 +860,7 @@ networkstack-aidl-interfaces-V13-java(minSdkVersion:29)
networkstack-aidl-interfaces-V14-java(minSdkVersion:29)
networkstack-aidl-interfaces-V15-java(minSdkVersion:29)
networkstack-aidl-interfaces-V16-java(minSdkVersion:29)
+networkstack-aidl-interfaces-V17-java(minSdkVersion:29)
networkstack-aidl-latest(minSdkVersion:29)
networkstack-client(minSdkVersion:29)
NetworkStackApi29Shims(minSdkVersion:29)
@@ -895,6 +901,7 @@ philox_random(minSdkVersion:30)
philox_random_headers(minSdkVersion:(no version))
philox_random_headers(minSdkVersion:30)
PlatformProperties(minSdkVersion:current)
+prebuilt_androidx-constraintlayout_constraintlayout-core-nodeps(minSdkVersion:29)
prebuilt_androidx-constraintlayout_constraintlayout-nodeps(minSdkVersion:(no version))
prebuilt_androidx-constraintlayout_constraintlayout-nodeps(minSdkVersion:14)
prebuilt_androidx-constraintlayout_constraintlayout-solver-nodeps(minSdkVersion:24)
@@ -913,6 +920,8 @@ prebuilt_androidx.appcompat_appcompat-nodeps(minSdkVersion:(no version))
prebuilt_androidx.appcompat_appcompat-nodeps(minSdkVersion:14)
prebuilt_androidx.appcompat_appcompat-resources-nodeps(minSdkVersion:(no version))
prebuilt_androidx.appcompat_appcompat-resources-nodeps(minSdkVersion:14)
+prebuilt_androidx.appsearch_appsearch-nodeps(minSdkVersion:14)
+prebuilt_androidx.appsearch_appsearch-platform-storage-nodeps(minSdkVersion:14)
prebuilt_androidx.arch.core_core-common-nodeps(minSdkVersion:24)
prebuilt_androidx.arch.core_core-common-nodeps(minSdkVersion:30)
prebuilt_androidx.arch.core_core-common-nodeps(minSdkVersion:current)
@@ -1026,6 +1035,7 @@ prebuilt_androidx.preference_preference-nodeps(minSdkVersion:(no version))
prebuilt_androidx.preference_preference-nodeps(minSdkVersion:14)
prebuilt_androidx.print_print-nodeps(minSdkVersion:(no version))
prebuilt_androidx.print_print-nodeps(minSdkVersion:14)
+prebuilt_androidx.profileinstaller_profileinstaller-nodeps(minSdkVersion:14)
prebuilt_androidx.recyclerview_recyclerview-nodeps(minSdkVersion:(no version))
prebuilt_androidx.recyclerview_recyclerview-nodeps(minSdkVersion:14)
prebuilt_androidx.recyclerview_recyclerview-selection-nodeps(minSdkVersion:(no version))
diff --git a/build/build_unbundled_mainline_module.sh b/build/build_unbundled_mainline_module.sh
index df01639e..34c8ff72 100755
--- a/build/build_unbundled_mainline_module.sh
+++ b/build/build_unbundled_mainline_module.sh
@@ -128,11 +128,9 @@ function init() {
function build_modules() {
- #TODO(b/263406837) remove BUILD_BROKEN_DISABLE_BAZEL, which will enable Bazel builds with --bazel-mode by default
build/soong/soong_ui.bash --make-mode "$@" \
ALWAYS_EMBED_NOTICES=true \
MODULE_BUILD_FROM_SOURCE=true \
- BUILD_BROKEN_DISABLE_BAZEL=true \
${extra_build_params} \
"${RUN_ERROR_PRONE:+"RUN_ERROR_PRONE=true"}" \
apps_only \
diff --git a/build/mainline_modules_sdks.py b/build/mainline_modules_sdks.py
index 55c24d7c..169c515c 100755
--- a/build/mainline_modules_sdks.py
+++ b/build/mainline_modules_sdks.py
@@ -72,12 +72,12 @@ class FileTransformation:
# The path of the file within the SDK snapshot zip file.
path: str
- def apply(self, producer, path):
+ def apply(self, producer, path, build_release):
"""Apply the transformation to the path; changing it in place."""
with open(path, "r+", encoding="utf8") as file:
- self._apply_transformation(producer, file)
+ self._apply_transformation(producer, file, build_release)
- def _apply_transformation(self, producer, file):
+ def _apply_transformation(self, producer, file, build_release):
"""Apply the transformation to the file.
The file has been opened in read/write mode so the implementation of
@@ -96,7 +96,7 @@ class SoongConfigVarTransformation(FileTransformation):
# The line containing the prefer property.
PREFER_LINE = " prefer: false,"
- def _apply_transformation(self, producer, file):
+ def _apply_transformation(self, producer, file, build_release):
raise NotImplementedError
@@ -117,11 +117,7 @@ class SoongConfigBoilerplateInserter(SoongConfigVarTransformation):
def config_module_type(self, module_type):
return self.configModuleTypePrefix + module_type
- def apply(self, producer, path):
- with open(path, "r+", encoding="utf8") as file:
- self._apply_transformation(producer, file)
-
- def _apply_transformation(self, producer, file):
+ def _apply_transformation(self, producer, file, build_release):
# TODO(b/174997203): Remove this when we have a proper way to control
# prefer flags in Mainline modules.
@@ -228,7 +224,7 @@ soong_config_module_type {{
@dataclasses.dataclass(frozen=True)
class UseSourceConfigVarTransformation(SoongConfigVarTransformation):
- def _apply_transformation(self, producer, file):
+ def _apply_transformation(self, producer, file, build_release):
lines = []
for line in file:
line = line.rstrip("\n")
@@ -288,6 +284,12 @@ def sdk_snapshot_api_diff_file(snapshots_dir, sdk_name):
return os.path.join(snapshots_dir, f"{sdk_name}-{SDK_VERSION}-api-diff.txt")
+def sdk_snapshot_gantry_metadata_json_file(snapshots_dir, sdk_name):
+ """Get the path to the sdk snapshot gantry metadata json file."""
+ return os.path.join(snapshots_dir,
+ f"{sdk_name}-{SDK_VERSION}-gantry-metadata.json")
+
+
# The default time to use in zip entries. Ideally, this should be the same as is
# used by soong_zip and ziptime but there is no strict need for that to be the
# case. What matters is this is a fixed time so that the contents of zip files
@@ -541,8 +543,10 @@ java_sdk_library_import {{
capture_output=True).stdout.decode("utf-8")
file_object.write(diff)
- def create_snapshot_api_diff(self, sdk, target_dict, snapshots_dir):
- """Creates api diff files for each module sdk.
+ def create_snapshot_gantry_metadata_and_api_diff(self, sdk, target_dict,
+ snapshots_dir,
+ module_extension_version):
+ """Creates gantry metadata and api diff files for each module sdk.
For each module sdk, the scope targets are obtained for each java sdk
library and the api diff files are generated by performing a diff
@@ -551,6 +555,8 @@ java_sdk_library_import {{
sdk_info_file = sdk_snapshot_info_file(snapshots_dir, sdk)
sdk_zip_file = sdk_snapshot_zip_file(snapshots_dir, sdk)
sdk_api_diff_file = sdk_snapshot_api_diff_file(snapshots_dir, sdk)
+
+ gantry_metadata_dict = {}
with open(
sdk_api_diff_file, "w",
encoding="utf8") as sdk_api_diff_file_object:
@@ -569,14 +575,39 @@ java_sdk_library_import {{
sdk_zip_file, removed_api,
latest_removed_api, snapshots_dir)
- def build_snapshot_api_diff(self, modules, target_dict, snapshots_dir):
- """For each module sdk, create the api diff file."""
+ gantry_metadata_dict["api_diff_file"] = sdk_api_diff_file.rsplit(
+ "/", 1)[-1]
+ gantry_metadata_dict["api_diff_file_size"] = os.path.getsize(
+ sdk_api_diff_file)
+ gantry_metadata_dict[
+ "module_extension_version"] = module_extension_version
+ sdk_metadata_json_file = sdk_snapshot_gantry_metadata_json_file(
+ snapshots_dir, sdk)
+
+ gantry_metadata_json_object = json.dumps(gantry_metadata_dict, indent=4)
+ with open(sdk_metadata_json_file,
+ "w") as gantry_metadata_json_file_object:
+ gantry_metadata_json_file_object.write(gantry_metadata_json_object)
+
+ def get_module_extension_version(self):
+ return int(
+ subprocess.run([
+ "build/soong/soong_ui.bash", "--dumpvar-mode",
+ "PLATFORM_SDK_EXTENSION_VERSION"
+ ],
+ capture_output=True).stdout.decode("utf-8").strip())
+
+ def build_snapshot_gantry_metadata_and_api_diff(self, modules, target_dict,
+ snapshots_dir):
+ """For each module sdk, create the metadata and api diff file."""
+ module_extension_version = self.get_module_extension_version()
for module in modules:
for sdk in module.sdks:
sdk_type = sdk_type_from_name(sdk)
if not sdk_type.providesApis:
continue
- self.create_snapshot_api_diff(sdk, target_dict, snapshots_dir)
+ self.create_snapshot_gantry_metadata_and_api_diff(
+ sdk, target_dict, snapshots_dir, module_extension_version)
# The sdk version to build
@@ -822,6 +853,9 @@ class MainlineModule:
# Defaults to the last part of the apex name.
short_name: str = ""
+ # Additional transformations
+ additional_transformations: list[FileTransformation] = None
+
def __post_init__(self):
# If short_name is not set then set it to the last component of the apex
# name.
@@ -863,6 +897,9 @@ class MainlineModule:
"Android.bp", configVar=config_var)
transformations.append(transformation)
+ if self.additional_transformations and build_release > R:
+ transformations.extend(self.additional_transformations)
+
return transformations
def is_required_for(self, target_build_release):
@@ -1152,7 +1189,7 @@ class SdkDistProducer:
if build_release == LATEST:
target_dict = self.snapshot_builder.build_sdk_scope_targets(
build_release, modules)
- self.snapshot_builder.build_snapshot_api_diff(
+ self.snapshot_builder.build_snapshot_gantry_metadata_and_api_diff(
modules, target_dict, snapshots_dir)
self.populate_unbundled_dist(build_release, modules, snapshots_dir)
return snapshots_dir
@@ -1164,18 +1201,26 @@ class SdkDistProducer:
build_release, modules)
self.populate_bundled_dist(build_release, modules, snapshots_dir)
- def dist_sdk_snapshot_api_diff(self, sdk_dist_dir, sdk, module,
- snapshots_dir):
+ def dist_sdk_snapshot_gantry_metadata_and_api_diff(self, sdk_dist_dir, sdk,
+ module, snapshots_dir):
"""Copy the sdk snapshot api diff file to a dist directory."""
sdk_type = sdk_type_from_name(sdk)
if not sdk_type.providesApis:
return
- sdk_dist_subdir = os.path.join(sdk_dist_dir, module.apex, "sdk")
+ sdk_dist_module_subdir = os.path.join(sdk_dist_dir, module.apex)
+ sdk_dist_subdir = os.path.join(sdk_dist_module_subdir, "sdk")
os.makedirs(sdk_dist_subdir, exist_ok=True)
sdk_api_diff_path = sdk_snapshot_api_diff_file(snapshots_dir, sdk)
shutil.copy(sdk_api_diff_path, sdk_dist_subdir)
+ sdk_gantry_metadata_json_path = sdk_snapshot_gantry_metadata_json_file(
+ snapshots_dir, sdk)
+ sdk_dist_gantry_metadata_json_path = os.path.join(
+ sdk_dist_module_subdir, "gantry-metadata.json")
+ shutil.copy(sdk_gantry_metadata_json_path,
+ sdk_dist_gantry_metadata_json_path)
+
def populate_unbundled_dist(self, build_release, modules, snapshots_dir):
build_release_dist_dir = os.path.join(self.mainline_sdks_dir,
build_release.sub_dir)
@@ -1183,8 +1228,8 @@ class SdkDistProducer:
for sdk in module.sdks:
sdk_dist_dir = os.path.join(build_release_dist_dir, SDK_VERSION)
if build_release == LATEST:
- self.dist_sdk_snapshot_api_diff(sdk_dist_dir, sdk, module,
- snapshots_dir)
+ self.dist_sdk_snapshot_gantry_metadata_and_api_diff(
+ sdk_dist_dir, sdk, module, snapshots_dir)
self.populate_dist_snapshot(build_release, module, sdk,
sdk_dist_dir, snapshots_dir)
@@ -1204,9 +1249,11 @@ class SdkDistProducer:
sdk_path = sdk_snapshot_zip_file(snapshots_dir, sdk)
sdk_type = sdk_type_from_name(sdk)
transformations = module.transformations(build_release, sdk_type)
- self.dist_sdk_snapshot_zip(sdk_path, sdk_dist_subdir, transformations)
+ self.dist_sdk_snapshot_zip(
+ build_release, sdk_path, sdk_dist_subdir, transformations)
- def dist_sdk_snapshot_zip(self, src_sdk_zip, sdk_dist_dir, transformations):
+ def dist_sdk_snapshot_zip(
+ self, build_release, src_sdk_zip, sdk_dist_dir, transformations):
"""Copy the sdk snapshot zip file to a dist directory.
If no transformations are provided then this simply copies the show sdk
@@ -1214,7 +1261,8 @@ class SdkDistProducer:
provided then the files to be transformed are extracted from the
snapshot zip file, they are transformed to files in a separate directory
and then a new zip file is created in the dist directory with the
- original files replaced by the newly transformed files.
+ original files replaced by the newly transformed files. build_release is
+ provided for transformations if it is needed.
"""
os.makedirs(sdk_dist_dir, exist_ok=True)
dest_sdk_zip = os.path.join(sdk_dist_dir, os.path.basename(src_sdk_zip))
@@ -1237,7 +1285,7 @@ class SdkDistProducer:
extract_matching_files_from_zip(src_sdk_zip, tmp_dir, pattern)
# Apply the transformations to the extracted files in situ.
- apply_transformations(self, tmp_dir, transformations)
+ apply_transformations(self, tmp_dir, transformations, build_release)
# Replace the original entries in the zip with the transformed
# files.
@@ -1291,7 +1339,7 @@ def copy_zip_and_replace(producer, src_zip_path, dest_zip_path, src_dir, paths):
cwd=src_dir)
-def apply_transformations(producer, tmp_dir, transformations):
+def apply_transformations(producer, tmp_dir, transformations, build_release):
for transformation in transformations:
path = os.path.join(tmp_dir, transformation.path)
@@ -1299,7 +1347,7 @@ def apply_transformations(producer, tmp_dir, transformations):
modified = os.path.getmtime(path)
# Transform the file.
- transformation.apply(producer, path)
+ transformation.apply(producer, path, build_release)
# Reset the timestamp of the file to the original timestamp before the
# transformation was applied.
diff --git a/build/mainline_modules_sdks_test.py b/build/mainline_modules_sdks_test.py
index e66b3bb2..2131a602 100644
--- a/build/mainline_modules_sdks_test.py
+++ b/build/mainline_modules_sdks_test.py
@@ -23,6 +23,7 @@ import shutil
import tempfile
import unittest
import zipfile
+import json
from unittest import mock
import mainline_modules_sdks as mm
@@ -108,6 +109,10 @@ class FakeSnapshotBuilder(mm.SnapshotBuilder):
# For rest of the modules, generate an empty .info file.
self.write_data_to_file(sdk_info_file, "[]")
+ def get_module_extension_version(self):
+ # Return any integer value indicating the module extension version for testing.
+ return 5
+
def build_sdk_scope_targets(self, build_release, modules):
target_paths = []
target_dict = {}
@@ -199,14 +204,18 @@ class TestProduceDist(unittest.TestCase):
"mainline-sdks/for-S-build/current/com.android.ipsec/sdk/ipsec-module-sdk-current.zip",
"mainline-sdks/for-S-build/current/com.android.tethering/sdk/tethering-module-sdk-current.zip",
"mainline-sdks/for-S-build/current/com.google.android.wifi/sdk/wifi-module-sdk-current.zip",
+ "mainline-sdks/for-latest-build/current/com.android.art/gantry-metadata.json",
"mainline-sdks/for-latest-build/current/com.android.art/host-exports/art-module-host-exports-current.zip",
"mainline-sdks/for-latest-build/current/com.android.art/sdk/art-module-sdk-current-api-diff.txt",
"mainline-sdks/for-latest-build/current/com.android.art/sdk/art-module-sdk-current.zip",
"mainline-sdks/for-latest-build/current/com.android.art/test-exports/art-module-test-exports-current.zip",
+ "mainline-sdks/for-latest-build/current/com.android.ipsec/gantry-metadata.json",
"mainline-sdks/for-latest-build/current/com.android.ipsec/sdk/ipsec-module-sdk-current-api-diff.txt",
"mainline-sdks/for-latest-build/current/com.android.ipsec/sdk/ipsec-module-sdk-current.zip",
+ "mainline-sdks/for-latest-build/current/com.android.tethering/gantry-metadata.json",
"mainline-sdks/for-latest-build/current/com.android.tethering/sdk/tethering-module-sdk-current-api-diff.txt",
"mainline-sdks/for-latest-build/current/com.android.tethering/sdk/tethering-module-sdk-current.zip",
+ "mainline-sdks/for-latest-build/current/com.google.android.wifi/gantry-metadata.json",
"mainline-sdks/for-latest-build/current/com.google.android.wifi/sdk/wifi-module-sdk-current-api-diff.txt",
"mainline-sdks/for-latest-build/current/com.google.android.wifi/sdk/wifi-module-sdk-current.zip",
],
@@ -295,6 +304,7 @@ class TestProduceDist(unittest.TestCase):
"bundled-mainline-sdks/platform-mainline/sdk/platform-mainline-sdk-current.zip",
"bundled-mainline-sdks/platform-mainline/test-exports/platform-mainline-test-exports-current.zip",
# Unbundled (normal) modules.
+ "mainline-sdks/for-latest-build/current/com.android.art/gantry-metadata.json",
"mainline-sdks/for-latest-build/current/com.android.art/host-exports/art-module-host-exports-current.zip",
"mainline-sdks/for-latest-build/current/com.android.art/sdk/art-module-sdk-current-api-diff.txt",
"mainline-sdks/for-latest-build/current/com.android.art/sdk/art-module-sdk-current.zip",
@@ -311,6 +321,29 @@ class TestProduceDist(unittest.TestCase):
0,
msg="Api diff file should not be empty for the art module")
+ art_gantry_metadata_json_file = os.path.join(
+ self.tmp_dist_dir,
+ "mainline-sdks/for-latest-build/current/com.android.art/gantry-metadata.json"
+ )
+
+ with open(art_gantry_metadata_json_file, "r",
+ encoding="utf8") as gantry_metadata_json_file_object:
+ json_data = json.load(gantry_metadata_json_file_object)
+
+ self.assertEqual(
+ json_data["api_diff_file"],
+ "art-module-sdk-current-api-diff.txt",
+ msg="Incorrect api-diff file name.")
+ self.assertEqual(
+ json_data["api_diff_file_size"],
+ 267,
+ msg="Incorrect api-diff file size.")
+ self.assertEqual(
+ json_data["module_extension_version"],
+ 5,
+ msg="The module extension version does not match the expected value."
+ )
+
def create_build_number_file(self):
soong_dir = os.path.join(self.tmp_out_dir, "soong")
os.makedirs(soong_dir, exist_ok=True)
@@ -405,7 +438,7 @@ def read_test_data(relative_path):
class TestAndroidBpTransformations(unittest.TestCase):
- def apply_transformations(self, src, transformations, expected):
+ def apply_transformations(self, src, transformations, build_release, expected):
producer = mm.SdkDistProducer(
subprocess_runner=mock.Mock(mm.SubprocessRunner),
snapshot_builder=mock.Mock(mm.SnapshotBuilder),
@@ -417,7 +450,8 @@ class TestAndroidBpTransformations(unittest.TestCase):
with open(path, "w", encoding="utf8") as f:
f.write(src)
- mm.apply_transformations(producer, tmp_dir, transformations)
+ mm.apply_transformations(
+ producer, tmp_dir, transformations, build_release)
with open(path, "r", encoding="utf8") as f:
result = f.read()
@@ -438,7 +472,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.ipsec"]
transformations = module.transformations(mm.S, mm.Sdk)
- self.apply_transformations(src, transformations, expected)
+ self.apply_transformations(src, transformations, mm.S, expected)
def test_common_mainline_module_tiramisu(self):
"""Tests the transformations applied to a common mainline sdk on T.
@@ -453,7 +487,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.ipsec"]
transformations = module.transformations(mm.Tiramisu, mm.Sdk)
- self.apply_transformations(src, transformations, expected)
+ self.apply_transformations(src, transformations, mm.Tiramisu, expected)
def test_optional_mainline_module(self):
"""Tests the transformations applied to an optional mainline sdk on S.
@@ -469,7 +503,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.wifi"]
transformations = module.transformations(mm.S, mm.Sdk)
- self.apply_transformations(src, transformations, expected)
+ self.apply_transformations(src, transformations, mm.S, expected)
def test_optional_mainline_module_tiramisu(self):
"""Tests the transformations applied to an optional mainline sdk on T.
@@ -484,7 +518,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.wifi"]
transformations = module.transformations(mm.Tiramisu, mm.Sdk)
- self.apply_transformations(src, transformations, expected)
+ self.apply_transformations(src, transformations, mm.Tiramisu, expected)
def test_art(self):
"""Tests the transformations applied to a the ART mainline module.
@@ -500,7 +534,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.art"]
transformations = module.transformations(mm.S, mm.Sdk)
- self.apply_transformations(src, transformations, expected)
+ self.apply_transformations(src, transformations, mm.S, expected)
def test_art_module_exports(self):
"""Tests the transformations applied to a the ART mainline module.
@@ -516,7 +550,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.art"]
transformations = module.transformations(mm.S, mm.HostExports)
- self.apply_transformations(src, transformations, expected)
+ self.apply_transformations(src, transformations, mm.S, expected)
def test_r_build(self):
"""Tests the transformations that are applied for the R build.
@@ -534,7 +568,43 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.ipsec"]
transformations = module.transformations(mm.R, mm.Sdk)
- self.apply_transformations(src, transformations, expected)
+ self.apply_transformations(src, transformations, mm.R, expected)
+
+ def test_additional_transformation(self):
+ """Tests additional transformation.
+
+ This uses ipsec as an example of a common case for adding information
+ in Android.bp file.
+ This checks will append the information in Android.bp for a regular module.
+ """
+
+ @dataclasses.dataclass(frozen=True)
+ class TestTransformation(mm.FileTransformation):
+ """Transforms an Android.bp file by appending testing message."""
+
+ test_content: str = ""
+
+ def apply(self, producer, path, build_release):
+ with open(path, "a+", encoding="utf8") as file:
+ self._apply_transformation(producer, file, build_release)
+
+ def _apply_transformation(self, producer, file, build_release):
+ if build_release >= mm.Tiramisu:
+ file.write(self.test_content)
+
+ src = read_test_data("ipsec_Android.bp.input")
+
+ expected = read_test_data(
+ "ipsec_tiramisu_Android.bp.additional.expected")
+ test_transformation = TestTransformation(
+ "Android.bp", test_content="\n// Adding by test")
+ module = MAINLINE_MODULES_BY_APEX["com.android.ipsec"]
+ module = dataclasses.replace(
+ module, apex=module.apex,
+ first_release=module.first_release,
+ additional_transformations=[test_transformation])
+ transformations = module.transformations(mm.Tiramisu, mm.Sdk)
+ self.apply_transformations(src, transformations, mm.Tiramisu, expected)
class TestFilterModules(unittest.TestCase):
diff --git a/build/mainline_modules_sdks_test_data/OWNERS b/build/mainline_modules_sdks_test_data/OWNERS
index 3c17a968..2fba2131 100644
--- a/build/mainline_modules_sdks_test_data/OWNERS
+++ b/build/mainline_modules_sdks_test_data/OWNERS
@@ -1,3 +1,3 @@
hansson@google.com
paulduffin@google.com
-satayev@google.com
+robertogil@google.com
diff --git a/build/mainline_modules_sdks_test_data/ipsec_tiramisu_Android.bp.additional.expected b/build/mainline_modules_sdks_test_data/ipsec_tiramisu_Android.bp.additional.expected
new file mode 100644
index 00000000..2b844ab6
--- /dev/null
+++ b/build/mainline_modules_sdks_test_data/ipsec_tiramisu_Android.bp.additional.expected
@@ -0,0 +1,79 @@
+// This is auto-generated. DO NOT EDIT.
+
+package {
+ // A default list here prevents the license LSC from adding its own list which would
+ // be unnecessary as every module in the sdk already has its own licenses property.
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+prebuilt_bootclasspath_fragment {
+ name: "com.android.ipsec-bootclasspath-fragment",
+ // Do not prefer prebuilt if the Soong config variable "module_build_from_source" in namespace "ANDROID" is true.
+ use_source_config_var: {
+ config_namespace: "ANDROID",
+ var_name: "module_build_from_source",
+ },
+ visibility: ["//visibility:public"],
+ apex_available: ["com.android.ipsec"],
+ licenses: ["ipsec-module-sdk_Android-Apache-2.0"],
+ contents: ["android.net.ipsec.ike"],
+ hidden_api: {
+ stub_flags: "hiddenapi/stub-flags.csv",
+ annotation_flags: "hiddenapi/annotation-flags.csv",
+ metadata: "hiddenapi/metadata.csv",
+ index: "hiddenapi/index.csv",
+ all_flags: "hiddenapi/all-flags.csv",
+ },
+}
+
+java_sdk_library_import {
+ name: "android.net.ipsec.ike",
+ // Do not prefer prebuilt if the Soong config variable "module_build_from_source" in namespace "ANDROID" is true.
+ use_source_config_var: {
+ config_namespace: "ANDROID",
+ var_name: "module_build_from_source",
+ },
+ visibility: ["//visibility:public"],
+ apex_available: [
+ "com.android.ipsec",
+ "test_com.android.ipsec",
+ ],
+ licenses: ["ipsec-module-sdk_Android-Apache-2.0"],
+ shared_library: true,
+ compile_dex: true,
+ permitted_packages: [
+ "com.android.internal.net",
+ "android.net.ipsec.ike",
+ "android.net.eap",
+ ],
+ public: {
+ jars: ["sdk_library/public/android.net.ipsec.ike-stubs.jar"],
+ stub_srcs: ["sdk_library/public/android.net.ipsec.ike.srcjar"],
+ current_api: "sdk_library/public/android.net.ipsec.ike.txt",
+ removed_api: "sdk_library/public/android.net.ipsec.ike-removed.txt",
+ sdk_version: "module_current",
+ },
+ system: {
+ jars: ["sdk_library/system/android.net.ipsec.ike-stubs.jar"],
+ stub_srcs: ["sdk_library/system/android.net.ipsec.ike.srcjar"],
+ current_api: "sdk_library/system/android.net.ipsec.ike.txt",
+ removed_api: "sdk_library/system/android.net.ipsec.ike-removed.txt",
+ sdk_version: "module_current",
+ },
+ module_lib: {
+ jars: ["sdk_library/module-lib/android.net.ipsec.ike-stubs.jar"],
+ stub_srcs: ["sdk_library/module-lib/android.net.ipsec.ike.srcjar"],
+ current_api: "sdk_library/module-lib/android.net.ipsec.ike.txt",
+ removed_api: "sdk_library/module-lib/android.net.ipsec.ike-removed.txt",
+ sdk_version: "module_current",
+ },
+}
+
+license {
+ name: "ipsec-module-sdk_Android-Apache-2.0",
+ visibility: ["//visibility:private"],
+ license_kinds: ["SPDX-license-identifier-Apache-2.0"],
+ license_text: ["licenses/build/soong/licenses/LICENSE"],
+}
+
+// Adding by test \ No newline at end of file
diff --git a/javatests/com/android/modules/updatablesharedlibs/OWNERS b/javatests/com/android/modules/updatablesharedlibs/OWNERS
index 55f5b971..778e15d8 100644
--- a/javatests/com/android/modules/updatablesharedlibs/OWNERS
+++ b/javatests/com/android/modules/updatablesharedlibs/OWNERS
@@ -2,4 +2,4 @@
andreionea@google.com
pedroql@google.com
-satayev@google.com
+robertogil@google.com
diff --git a/sdk/ModuleDefaults.bp b/sdk/ModuleDefaults.bp
index 379cb28d..d2f5734b 100644
--- a/sdk/ModuleDefaults.bp
+++ b/sdk/ModuleDefaults.bp
@@ -227,6 +227,12 @@ java_defaults {
},
}
+filegroup_defaults {
+ name: "framework-sources-module-defaults",
+ visibility: ["//frameworks/base"], // For the "global" stubs
+ defaults_visibility: ["//visibility:public"],
+}
+
// These apex_defaults serve as a common place to add properties which should
// affect all mainline modules.
diff --git a/tools/finalize_sdk.py b/tools/finalize_sdk.py
index 7d229742..a4680258 100755
--- a/tools/finalize_sdk.py
+++ b/tools/finalize_sdk.py
@@ -67,7 +67,6 @@ def repo_for_sdk(filename):
module = filename.split('-')[0]
target_dir = ''
if module == 'btservices': return Path('prebuilts/module_sdk/Bluetooth')
- if module == 'healthfitness': return Path('prebuilts/module_sdk/HealthConnect')
if module == 'media': return Path('prebuilts/module_sdk/Media')
if module == 'rkpd': return Path('prebuilts/module_sdk/RemoteKeyProvisioning')
if module == 'tethering': return Path('prebuilts/module_sdk/Connectivity')