Merge "Stop setting SOONG_SDK_SNAPSHOT_VERSION" am: 47f779a5a6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2315019 Change-Id: I202f7a776c9d76c05cc554629820652f96442742 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -273,19 +273,19 @@ class SubprocessRunner:
|
|||||||
*args, check=True, stdout=self.stdout, stderr=self.stderr, **kwargs)
|
*args, check=True, stdout=self.stdout, stderr=self.stderr, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def sdk_snapshot_zip_file(snapshots_dir, sdk_name, sdk_version):
|
def sdk_snapshot_zip_file(snapshots_dir, sdk_name):
|
||||||
"""Get the path to the sdk snapshot zip file."""
|
"""Get the path to the sdk snapshot zip file."""
|
||||||
return os.path.join(snapshots_dir, f"{sdk_name}-{sdk_version}.zip")
|
return os.path.join(snapshots_dir, f"{sdk_name}-{SDK_VERSION}.zip")
|
||||||
|
|
||||||
|
|
||||||
def sdk_snapshot_info_file(snapshots_dir, sdk_name, sdk_version):
|
def sdk_snapshot_info_file(snapshots_dir, sdk_name):
|
||||||
"""Get the path to the sdk snapshot info file."""
|
"""Get the path to the sdk snapshot info file."""
|
||||||
return os.path.join(snapshots_dir, f"{sdk_name}-{sdk_version}.info")
|
return os.path.join(snapshots_dir, f"{sdk_name}-{SDK_VERSION}.info")
|
||||||
|
|
||||||
|
|
||||||
def sdk_snapshot_api_diff_file(snapshots_dir, sdk_name, sdk_version):
|
def sdk_snapshot_api_diff_file(snapshots_dir, sdk_name):
|
||||||
"""Get the path to the sdk snapshot api diff file."""
|
"""Get the path to the sdk snapshot api diff file."""
|
||||||
return os.path.join(snapshots_dir, f"{sdk_name}-{sdk_version}-api-diff.txt")
|
return os.path.join(snapshots_dir, f"{sdk_name}-{SDK_VERSION}-api-diff.txt")
|
||||||
|
|
||||||
|
|
||||||
# The default time to use in zip entries. Ideally, this should be the same as is
|
# The default time to use in zip entries. Ideally, this should be the same as is
|
||||||
@@ -324,12 +324,12 @@ class SnapshotBuilder:
|
|||||||
self.mainline_sdks_dir = os.path.join(self.out_dir,
|
self.mainline_sdks_dir = os.path.join(self.out_dir,
|
||||||
"soong/mainline-sdks")
|
"soong/mainline-sdks")
|
||||||
|
|
||||||
def get_sdk_path(self, sdk_name, sdk_version):
|
def get_sdk_path(self, sdk_name):
|
||||||
"""Get the path to the sdk snapshot zip file produced by soong"""
|
"""Get the path to the sdk snapshot zip file produced by soong"""
|
||||||
return os.path.join(self.mainline_sdks_dir,
|
return os.path.join(self.mainline_sdks_dir,
|
||||||
f"{sdk_name}-{sdk_version}.zip")
|
f"{sdk_name}-{SDK_VERSION}.zip")
|
||||||
|
|
||||||
def build_target_paths(self, build_release, sdk_version, target_paths):
|
def build_target_paths(self, build_release, target_paths):
|
||||||
# Extra environment variables to pass to the build process.
|
# Extra environment variables to pass to the build process.
|
||||||
extraEnv = {
|
extraEnv = {
|
||||||
# TODO(ngeoffray): remove SOONG_ALLOW_MISSING_DEPENDENCIES, but
|
# TODO(ngeoffray): remove SOONG_ALLOW_MISSING_DEPENDENCIES, but
|
||||||
@@ -338,9 +338,6 @@ class SnapshotBuilder:
|
|||||||
# Set SOONG_SDK_SNAPSHOT_USE_SRCJAR to generate .srcjars inside
|
# Set SOONG_SDK_SNAPSHOT_USE_SRCJAR to generate .srcjars inside
|
||||||
# sdk zip files as expected by prebuilt drop.
|
# sdk zip files as expected by prebuilt drop.
|
||||||
"SOONG_SDK_SNAPSHOT_USE_SRCJAR": "true",
|
"SOONG_SDK_SNAPSHOT_USE_SRCJAR": "true",
|
||||||
# Set SOONG_SDK_SNAPSHOT_VERSION to generate the appropriately
|
|
||||||
# tagged version of the sdk.
|
|
||||||
"SOONG_SDK_SNAPSHOT_VERSION": sdk_version,
|
|
||||||
}
|
}
|
||||||
extraEnv.update(build_release.soong_env)
|
extraEnv.update(build_release.soong_env)
|
||||||
|
|
||||||
@@ -364,24 +361,21 @@ class SnapshotBuilder:
|
|||||||
env.update(extraEnv)
|
env.update(extraEnv)
|
||||||
self.subprocess_runner.run(cmd, env=env)
|
self.subprocess_runner.run(cmd, env=env)
|
||||||
|
|
||||||
def build_snapshots(self, build_release, sdk_versions, modules):
|
def build_snapshots(self, build_release, modules):
|
||||||
# Build the SDKs once for each version.
|
# Compute the paths to all the Soong generated sdk snapshot files
|
||||||
for sdk_version in sdk_versions:
|
# required by this script.
|
||||||
# Compute the paths to all the Soong generated sdk snapshot files
|
paths = [
|
||||||
# required by this script.
|
sdk_snapshot_zip_file(self.mainline_sdks_dir, sdk)
|
||||||
paths = [
|
for module in modules
|
||||||
sdk_snapshot_zip_file(self.mainline_sdks_dir, sdk, sdk_version)
|
for sdk in module.sdks
|
||||||
for module in modules
|
]
|
||||||
for sdk in module.sdks
|
|
||||||
]
|
|
||||||
|
|
||||||
self.build_target_paths(build_release, sdk_version, paths)
|
self.build_target_paths(build_release, paths)
|
||||||
return self.mainline_sdks_dir
|
return self.mainline_sdks_dir
|
||||||
|
|
||||||
def build_snapshots_for_build_r(self, build_release, sdk_versions, modules):
|
def build_snapshots_for_build_r(self, build_release, modules):
|
||||||
# Build the snapshots as standard.
|
# Build the snapshots as standard.
|
||||||
snapshot_dir = self.build_snapshots(build_release, sdk_versions,
|
snapshot_dir = self.build_snapshots(build_release, modules)
|
||||||
modules)
|
|
||||||
|
|
||||||
# Each module will extract needed files from the original snapshot zip
|
# Each module will extract needed files from the original snapshot zip
|
||||||
# file and then use that to create a replacement zip file.
|
# file and then use that to create a replacement zip file.
|
||||||
@@ -414,8 +408,7 @@ class SnapshotBuilder:
|
|||||||
for library in module.for_r_build.sdk_libraries:
|
for library in module.for_r_build.sdk_libraries:
|
||||||
module_name = library.name
|
module_name = library.name
|
||||||
shared_library = str(library.shared_library).lower()
|
shared_library = str(library.shared_library).lower()
|
||||||
sdk_file = sdk_snapshot_zip_file(snapshot_dir, sdk_name,
|
sdk_file = sdk_snapshot_zip_file(snapshot_dir, sdk_name)
|
||||||
"current")
|
|
||||||
extract_matching_files_from_zip(
|
extract_matching_files_from_zip(
|
||||||
sdk_file, dest_dir,
|
sdk_file, dest_dir,
|
||||||
sdk_library_files_pattern(
|
sdk_library_files_pattern(
|
||||||
@@ -511,7 +504,7 @@ java_sdk_library_import {{
|
|||||||
|
|
||||||
return target_paths, target_dict
|
return target_paths, target_dict
|
||||||
|
|
||||||
def build_sdk_scope_targets(self, build_release, sdk_version, modules):
|
def build_sdk_scope_targets(self, build_release, modules):
|
||||||
# Build the latest scope targets for each module sdk
|
# Build the latest scope targets for each module sdk
|
||||||
# Compute the paths to all the latest scope targets for each module sdk.
|
# Compute the paths to all the latest scope targets for each module sdk.
|
||||||
target_paths = []
|
target_paths = []
|
||||||
@@ -523,11 +516,11 @@ java_sdk_library_import {{
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
sdk_info_file = sdk_snapshot_info_file(self.mainline_sdks_dir,
|
sdk_info_file = sdk_snapshot_info_file(self.mainline_sdks_dir,
|
||||||
sdk, sdk_version)
|
sdk)
|
||||||
paths, dict_item = self.latest_api_file_targets(sdk_info_file)
|
paths, dict_item = self.latest_api_file_targets(sdk_info_file)
|
||||||
target_paths.extend(paths)
|
target_paths.extend(paths)
|
||||||
target_dict[sdk_info_file] = dict_item
|
target_dict[sdk_info_file] = dict_item
|
||||||
self.build_target_paths(build_release, sdk_version, target_paths)
|
self.build_target_paths(build_release, target_paths)
|
||||||
return target_dict
|
return target_dict
|
||||||
|
|
||||||
def appendDiffToFile(self, file_object, sdk_zip_file, current_api,
|
def appendDiffToFile(self, file_object, sdk_zip_file, current_api,
|
||||||
@@ -541,24 +534,23 @@ java_sdk_library_import {{
|
|||||||
# file). As 0 or 1 are both valid results this cannot use check=True
|
# file). As 0 or 1 are both valid results this cannot use check=True
|
||||||
# so disable the pylint check.
|
# so disable the pylint check.
|
||||||
# pylint: disable=subprocess-run-check
|
# pylint: disable=subprocess-run-check
|
||||||
diff = subprocess.run(
|
diff = subprocess.run([
|
||||||
["diff", "-u0", latest_api, extracted_current_api, "--label", latest_api, "--label",
|
"diff", "-u0", latest_api, extracted_current_api, "--label",
|
||||||
extracted_current_api],
|
latest_api, "--label", extracted_current_api
|
||||||
capture_output=True).stdout.decode("utf-8")
|
],
|
||||||
|
capture_output=True).stdout.decode("utf-8")
|
||||||
file_object.write(diff)
|
file_object.write(diff)
|
||||||
|
|
||||||
def create_snapshot_api_diff(self, sdk, sdk_version, target_dict,
|
def create_snapshot_api_diff(self, sdk, target_dict, snapshots_dir):
|
||||||
snapshots_dir):
|
|
||||||
"""Creates api diff files for each module sdk.
|
"""Creates api diff files for each module sdk.
|
||||||
|
|
||||||
For each module sdk, the scope targets are obtained for each java 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
|
library and the api diff files are generated by performing a diff
|
||||||
operation between the current api file vs the latest api file.
|
operation between the current api file vs the latest api file.
|
||||||
"""
|
"""
|
||||||
sdk_info_file = sdk_snapshot_info_file(snapshots_dir, sdk, sdk_version)
|
sdk_info_file = sdk_snapshot_info_file(snapshots_dir, sdk)
|
||||||
sdk_zip_file = sdk_snapshot_zip_file(snapshots_dir, sdk, sdk_version)
|
sdk_zip_file = sdk_snapshot_zip_file(snapshots_dir, sdk)
|
||||||
sdk_api_diff_file = sdk_snapshot_api_diff_file(snapshots_dir, sdk,
|
sdk_api_diff_file = sdk_snapshot_api_diff_file(snapshots_dir, sdk)
|
||||||
sdk_version)
|
|
||||||
with open(
|
with open(
|
||||||
sdk_api_diff_file, "w",
|
sdk_api_diff_file, "w",
|
||||||
encoding="utf8") as sdk_api_diff_file_object:
|
encoding="utf8") as sdk_api_diff_file_object:
|
||||||
@@ -577,27 +569,20 @@ java_sdk_library_import {{
|
|||||||
sdk_zip_file, removed_api,
|
sdk_zip_file, removed_api,
|
||||||
latest_removed_api, snapshots_dir)
|
latest_removed_api, snapshots_dir)
|
||||||
|
|
||||||
def build_snapshot_api_diff(self, sdk_version, modules, target_dict,
|
def build_snapshot_api_diff(self, modules, target_dict, snapshots_dir):
|
||||||
snapshots_dir):
|
|
||||||
"""For each module sdk, create the api diff file."""
|
"""For each module sdk, create the api diff file."""
|
||||||
for module in modules:
|
for module in modules:
|
||||||
for sdk in module.sdks:
|
for sdk in module.sdks:
|
||||||
sdk_type = sdk_type_from_name(sdk)
|
sdk_type = sdk_type_from_name(sdk)
|
||||||
if not sdk_type.providesApis:
|
if not sdk_type.providesApis:
|
||||||
continue
|
continue
|
||||||
self.create_snapshot_api_diff(sdk, sdk_version, target_dict,
|
self.create_snapshot_api_diff(sdk, target_dict, snapshots_dir)
|
||||||
snapshots_dir)
|
|
||||||
|
|
||||||
|
|
||||||
# A list of the sdk versions to build. Usually just current but can include a
|
# The sdk version to build
|
||||||
# numeric version too.
|
#
|
||||||
SDK_VERSIONS = [
|
# This is legacy from the time when this could generate versioned sdk snapshots.
|
||||||
# Suitable for overriding the source modules with prefer:true.
|
SDK_VERSION = "current"
|
||||||
# Unlike "unversioned" this mode also adds "@current" suffixed modules
|
|
||||||
# with the same prebuilts (which are never preferred).
|
|
||||||
"current",
|
|
||||||
# Insert additional sdk versions needed for the latest build release.
|
|
||||||
]
|
|
||||||
|
|
||||||
# The initially empty list of build releases. Every BuildRelease that is created
|
# The initially empty list of build releases. Every BuildRelease that is created
|
||||||
# automatically appends itself to this list.
|
# automatically appends itself to this list.
|
||||||
@@ -644,10 +629,6 @@ class BuildRelease:
|
|||||||
# }
|
# }
|
||||||
soong_env: typing.Dict[str, str] = None
|
soong_env: typing.Dict[str, str] = None
|
||||||
|
|
||||||
# The sdk versions that need to be generated for this build release.
|
|
||||||
sdk_versions: List[str] = \
|
|
||||||
dataclasses.field(default_factory=lambda: SDK_VERSIONS)
|
|
||||||
|
|
||||||
# The position of this instance within the BUILD_RELEASES list.
|
# The position of this instance within the BUILD_RELEASES list.
|
||||||
ordinal: int = dataclasses.field(default=-1, init=False)
|
ordinal: int = dataclasses.field(default=-1, init=False)
|
||||||
|
|
||||||
@@ -1156,39 +1137,34 @@ class SdkDistProducer:
|
|||||||
# Although we only need a subset of the files that a java_sdk_library
|
# Although we only need a subset of the files that a java_sdk_library
|
||||||
# adds to an sdk snapshot generating the whole snapshot is the simplest
|
# adds to an sdk snapshot generating the whole snapshot is the simplest
|
||||||
# way to ensure that all the necessary files are produced.
|
# way to ensure that all the necessary files are produced.
|
||||||
sdk_versions = build_release.sdk_versions
|
|
||||||
|
|
||||||
# Filter out any modules that do not provide sdk for R.
|
# Filter out any modules that do not provide sdk for R.
|
||||||
modules = [m for m in modules if m.for_r_build]
|
modules = [m for m in modules if m.for_r_build]
|
||||||
|
|
||||||
snapshot_dir = self.snapshot_builder.build_snapshots_for_build_r(
|
snapshot_dir = self.snapshot_builder.build_snapshots_for_build_r(
|
||||||
build_release, sdk_versions, modules)
|
build_release, modules)
|
||||||
self.populate_unbundled_dist(build_release, sdk_versions, modules,
|
self.populate_unbundled_dist(build_release, modules, snapshot_dir)
|
||||||
snapshot_dir)
|
|
||||||
|
|
||||||
def produce_unbundled_dist_for_build_release(self, build_release, modules):
|
def produce_unbundled_dist_for_build_release(self, build_release, modules):
|
||||||
modules = [m for m in modules if not m.is_bundled()]
|
modules = [m for m in modules if not m.is_bundled()]
|
||||||
sdk_versions = build_release.sdk_versions
|
|
||||||
snapshots_dir = self.snapshot_builder.build_snapshots(
|
snapshots_dir = self.snapshot_builder.build_snapshots(
|
||||||
build_release, sdk_versions, modules)
|
build_release, modules)
|
||||||
if build_release == LATEST:
|
if build_release == LATEST:
|
||||||
target_dict = self.snapshot_builder.build_sdk_scope_targets(
|
target_dict = self.snapshot_builder.build_sdk_scope_targets(
|
||||||
build_release, "current", modules)
|
build_release, modules)
|
||||||
self.snapshot_builder.build_snapshot_api_diff(
|
self.snapshot_builder.build_snapshot_api_diff(
|
||||||
"current", modules, target_dict, snapshots_dir)
|
modules, target_dict, snapshots_dir)
|
||||||
self.populate_unbundled_dist(build_release, sdk_versions, modules,
|
self.populate_unbundled_dist(build_release, modules, snapshots_dir)
|
||||||
snapshots_dir)
|
|
||||||
return snapshots_dir
|
return snapshots_dir
|
||||||
|
|
||||||
def produce_bundled_dist_for_build_release(self, build_release, modules):
|
def produce_bundled_dist_for_build_release(self, build_release, modules):
|
||||||
modules = [m for m in modules if m.is_bundled()]
|
modules = [m for m in modules if m.is_bundled()]
|
||||||
if modules:
|
if modules:
|
||||||
sdk_versions = build_release.sdk_versions
|
|
||||||
snapshots_dir = self.snapshot_builder.build_snapshots(
|
snapshots_dir = self.snapshot_builder.build_snapshots(
|
||||||
build_release, sdk_versions, modules)
|
build_release, modules)
|
||||||
self.populate_bundled_dist(build_release, modules, snapshots_dir)
|
self.populate_bundled_dist(build_release, modules, snapshots_dir)
|
||||||
|
|
||||||
def dist_sdk_snapshot_api_diff(self, sdk_dist_dir, sdk, sdk_version, module,
|
def dist_sdk_snapshot_api_diff(self, sdk_dist_dir, sdk, module,
|
||||||
snapshots_dir):
|
snapshots_dir):
|
||||||
"""Copy the sdk snapshot api diff file to a dist directory."""
|
"""Copy the sdk snapshot api diff file to a dist directory."""
|
||||||
sdk_type = sdk_type_from_name(sdk)
|
sdk_type = sdk_type_from_name(sdk)
|
||||||
@@ -1197,42 +1173,35 @@ class SdkDistProducer:
|
|||||||
|
|
||||||
sdk_dist_subdir = os.path.join(sdk_dist_dir, module.apex, "sdk")
|
sdk_dist_subdir = os.path.join(sdk_dist_dir, module.apex, "sdk")
|
||||||
os.makedirs(sdk_dist_subdir, exist_ok=True)
|
os.makedirs(sdk_dist_subdir, exist_ok=True)
|
||||||
sdk_api_diff_path = sdk_snapshot_api_diff_file(snapshots_dir, sdk,
|
sdk_api_diff_path = sdk_snapshot_api_diff_file(snapshots_dir, sdk)
|
||||||
sdk_version)
|
|
||||||
shutil.copy(sdk_api_diff_path, sdk_dist_subdir)
|
shutil.copy(sdk_api_diff_path, sdk_dist_subdir)
|
||||||
|
|
||||||
def populate_unbundled_dist(self, build_release, sdk_versions, modules,
|
def populate_unbundled_dist(self, build_release, modules, snapshots_dir):
|
||||||
snapshots_dir):
|
|
||||||
build_release_dist_dir = os.path.join(self.mainline_sdks_dir,
|
build_release_dist_dir = os.path.join(self.mainline_sdks_dir,
|
||||||
build_release.sub_dir)
|
build_release.sub_dir)
|
||||||
for module in modules:
|
for module in modules:
|
||||||
for sdk_version in sdk_versions:
|
for sdk in module.sdks:
|
||||||
for sdk in module.sdks:
|
sdk_dist_dir = os.path.join(build_release_dist_dir, SDK_VERSION)
|
||||||
sdk_dist_dir = os.path.join(build_release_dist_dir,
|
if build_release == LATEST:
|
||||||
sdk_version)
|
self.dist_sdk_snapshot_api_diff(sdk_dist_dir, sdk, module,
|
||||||
if build_release == LATEST:
|
snapshots_dir)
|
||||||
self.dist_sdk_snapshot_api_diff(sdk_dist_dir, sdk,
|
self.populate_dist_snapshot(build_release, module, sdk,
|
||||||
sdk_version, module,
|
sdk_dist_dir, snapshots_dir)
|
||||||
snapshots_dir)
|
|
||||||
self.populate_dist_snapshot(build_release, module, sdk,
|
|
||||||
sdk_dist_dir, sdk_version,
|
|
||||||
snapshots_dir)
|
|
||||||
|
|
||||||
def populate_bundled_dist(self, build_release, modules, snapshots_dir):
|
def populate_bundled_dist(self, build_release, modules, snapshots_dir):
|
||||||
sdk_dist_dir = self.bundled_mainline_sdks_dir
|
sdk_dist_dir = self.bundled_mainline_sdks_dir
|
||||||
for module in modules:
|
for module in modules:
|
||||||
for sdk in module.sdks:
|
for sdk in module.sdks:
|
||||||
self.populate_dist_snapshot(build_release, module, sdk,
|
self.populate_dist_snapshot(build_release, module, sdk,
|
||||||
sdk_dist_dir, "current",
|
sdk_dist_dir, snapshots_dir)
|
||||||
snapshots_dir)
|
|
||||||
|
|
||||||
def populate_dist_snapshot(self, build_release, module, sdk, sdk_dist_dir,
|
def populate_dist_snapshot(self, build_release, module, sdk, sdk_dist_dir,
|
||||||
sdk_version, snapshots_dir):
|
snapshots_dir):
|
||||||
sdk_type = sdk_type_from_name(sdk)
|
sdk_type = sdk_type_from_name(sdk)
|
||||||
subdir = sdk_type.name
|
subdir = sdk_type.name
|
||||||
|
|
||||||
sdk_dist_subdir = os.path.join(sdk_dist_dir, module.apex, subdir)
|
sdk_dist_subdir = os.path.join(sdk_dist_dir, module.apex, subdir)
|
||||||
sdk_path = sdk_snapshot_zip_file(snapshots_dir, sdk, sdk_version)
|
sdk_path = sdk_snapshot_zip_file(snapshots_dir, sdk)
|
||||||
sdk_type = sdk_type_from_name(sdk)
|
sdk_type = sdk_type_from_name(sdk)
|
||||||
transformations = module.transformations(build_release, sdk_type)
|
transformations = module.transformations(build_release, sdk_type)
|
||||||
self.dist_sdk_snapshot_zip(sdk_path, sdk_dist_subdir, transformations)
|
self.dist_sdk_snapshot_zip(sdk_path, sdk_dist_subdir, transformations)
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ class FakeSnapshotBuilder(mm.SnapshotBuilder):
|
|||||||
z.writestr(f"sdk_library/public/{name}.txt",
|
z.writestr(f"sdk_library/public/{name}.txt",
|
||||||
"method public int testMethod(int);")
|
"method public int testMethod(int);")
|
||||||
|
|
||||||
def create_snapshot_file(self, out_dir, name, version, for_r_build):
|
def create_snapshot_file(self, out_dir, name, for_r_build):
|
||||||
zip_file = Path(mm.sdk_snapshot_zip_file(out_dir, name, version))
|
zip_file = Path(mm.sdk_snapshot_zip_file(out_dir, name))
|
||||||
with zipfile.ZipFile(zip_file, "w") as z:
|
with zipfile.ZipFile(zip_file, "w") as z:
|
||||||
z.writestr("Android.bp", "")
|
z.writestr("Android.bp", "")
|
||||||
if name.endswith("-sdk"):
|
if name.endswith("-sdk"):
|
||||||
@@ -61,18 +61,16 @@ class FakeSnapshotBuilder(mm.SnapshotBuilder):
|
|||||||
else:
|
else:
|
||||||
self.create_sdk_library_files(z, re.sub(r"-.*$", "", name))
|
self.create_sdk_library_files(z, re.sub(r"-.*$", "", name))
|
||||||
|
|
||||||
def build_snapshots(self, build_release, sdk_versions, modules):
|
def build_snapshots(self, build_release, modules):
|
||||||
self.snapshots.append((build_release.name, build_release.soong_env,
|
self.snapshots.append((build_release.name, build_release.soong_env,
|
||||||
sdk_versions, [m.apex for m in modules]))
|
[m.apex for m in modules]))
|
||||||
# Create input file structure.
|
# Create input file structure.
|
||||||
sdks_out_dir = Path(self.mainline_sdks_dir).joinpath("test")
|
sdks_out_dir = Path(self.mainline_sdks_dir).joinpath("test")
|
||||||
sdks_out_dir.mkdir(parents=True, exist_ok=True)
|
sdks_out_dir.mkdir(parents=True, exist_ok=True)
|
||||||
# Create a fake sdk zip file for each module.
|
# Create a fake sdk zip file for each module.
|
||||||
for module in modules:
|
for module in modules:
|
||||||
for sdk in module.sdks:
|
for sdk in module.sdks:
|
||||||
for sdk_version in sdk_versions:
|
self.create_snapshot_file(sdks_out_dir, sdk, module.for_r_build)
|
||||||
self.create_snapshot_file(sdks_out_dir, sdk, sdk_version,
|
|
||||||
module.for_r_build)
|
|
||||||
return sdks_out_dir
|
return sdks_out_dir
|
||||||
|
|
||||||
def get_art_module_info_file_data(self, sdk):
|
def get_art_module_info_file_data(self, sdk):
|
||||||
@@ -110,7 +108,7 @@ class FakeSnapshotBuilder(mm.SnapshotBuilder):
|
|||||||
# For rest of the modules, generate an empty .info file.
|
# For rest of the modules, generate an empty .info file.
|
||||||
self.write_data_to_file(sdk_info_file, "[]")
|
self.write_data_to_file(sdk_info_file, "[]")
|
||||||
|
|
||||||
def build_sdk_scope_targets(self, build_release, sdk_version, modules):
|
def build_sdk_scope_targets(self, build_release, modules):
|
||||||
target_paths = []
|
target_paths = []
|
||||||
target_dict = {}
|
target_dict = {}
|
||||||
for module in modules:
|
for module in modules:
|
||||||
@@ -119,8 +117,7 @@ class FakeSnapshotBuilder(mm.SnapshotBuilder):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
sdk_info_file = mm.sdk_snapshot_info_file(
|
sdk_info_file = mm.sdk_snapshot_info_file(
|
||||||
Path(self.mainline_sdks_dir).joinpath("test"), sdk,
|
Path(self.mainline_sdks_dir).joinpath("test"), sdk)
|
||||||
sdk_version)
|
|
||||||
self.create_snapshot_info_file(module, sdk_info_file, sdk)
|
self.create_snapshot_info_file(module, sdk_info_file, sdk)
|
||||||
paths, dict_item = self.latest_api_file_targets(sdk_info_file)
|
paths, dict_item = self.latest_api_file_targets(sdk_info_file)
|
||||||
target_paths.extend(paths)
|
target_paths.extend(paths)
|
||||||
@@ -358,13 +355,11 @@ class TestProduceDist(unittest.TestCase):
|
|||||||
(
|
(
|
||||||
"R",
|
"R",
|
||||||
{},
|
{},
|
||||||
["current"],
|
|
||||||
["com.android.ipsec", "com.google.android.wifi"],
|
["com.android.ipsec", "com.google.android.wifi"],
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"latest",
|
"latest",
|
||||||
{},
|
{},
|
||||||
["current"],
|
|
||||||
[
|
[
|
||||||
"com.android.art", "com.android.ipsec",
|
"com.android.art", "com.android.ipsec",
|
||||||
"com.google.android.wifi"
|
"com.google.android.wifi"
|
||||||
@@ -375,7 +370,6 @@ class TestProduceDist(unittest.TestCase):
|
|||||||
{
|
{
|
||||||
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE": "S"
|
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE": "S"
|
||||||
},
|
},
|
||||||
["current"],
|
|
||||||
[
|
[
|
||||||
"com.android.art", "com.android.ipsec",
|
"com.android.art", "com.android.ipsec",
|
||||||
"com.google.android.wifi"
|
"com.google.android.wifi"
|
||||||
|
|||||||
Reference in New Issue
Block a user