Merge "mainline_modules_sdks: Remove legacy build support" am: 310b9f3650
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2095744 Change-Id: Id531f68bcb47c1c18f33c1fe050d1be4e94687db Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -485,36 +485,6 @@ def create_latest_sdk_snapshots(build_release: BuildRelease,
|
|||||||
producer.produce_bundled_dist_for_build_release(build_release, modules)
|
producer.produce_bundled_dist_for_build_release(build_release, modules)
|
||||||
|
|
||||||
|
|
||||||
def create_legacy_dist_structures(build_release: BuildRelease,
|
|
||||||
producer: "SdkDistProducer",
|
|
||||||
modules: List["MainlineModule"]):
|
|
||||||
"""Creates legacy file structures."""
|
|
||||||
|
|
||||||
# Only put unbundled modules in the legacy dist and stubs structures.
|
|
||||||
modules = [m for m in modules if not m.is_bundled()]
|
|
||||||
|
|
||||||
snapshots_dir = producer.produce_unbundled_dist_for_build_release(
|
|
||||||
build_release, modules)
|
|
||||||
|
|
||||||
# Create the out/dist/mainline-sdks/stubs structure.
|
|
||||||
# TODO(b/199759953): Remove stubs once it is no longer used by gantry.
|
|
||||||
# Clear and populate the stubs directory.
|
|
||||||
dist_dir = producer.dist_dir
|
|
||||||
stubs_dir = os.path.join(dist_dir, "stubs")
|
|
||||||
shutil.rmtree(stubs_dir, ignore_errors=True)
|
|
||||||
|
|
||||||
for module in modules:
|
|
||||||
apex = module.apex
|
|
||||||
dest_dir = os.path.join(dist_dir, "stubs", apex)
|
|
||||||
for sdk in module.sdks:
|
|
||||||
# If the sdk's name ends with -sdk then extract sdk library
|
|
||||||
# related files from its zip file.
|
|
||||||
if sdk.endswith("-sdk"):
|
|
||||||
sdk_file = sdk_snapshot_zip_file(snapshots_dir, sdk, "current")
|
|
||||||
extract_matching_files_from_zip(sdk_file, dest_dir,
|
|
||||||
sdk_library_files_pattern())
|
|
||||||
|
|
||||||
|
|
||||||
Q = BuildRelease(
|
Q = BuildRelease(
|
||||||
name="Q",
|
name="Q",
|
||||||
# At the moment we do not generate a snapshot for Q.
|
# At the moment we do not generate a snapshot for Q.
|
||||||
@@ -546,8 +516,7 @@ Tiramisu = BuildRelease(
|
|||||||
# before LATEST.
|
# before LATEST.
|
||||||
|
|
||||||
# The build release for the latest build supported by this build, i.e. the
|
# The build release for the latest build supported by this build, i.e. the
|
||||||
# current build. This must be the last BuildRelease defined in this script,
|
# current build. This must be the last BuildRelease defined in this script.
|
||||||
# before LEGACY_BUILD_RELEASE.
|
|
||||||
LATEST = BuildRelease(
|
LATEST = BuildRelease(
|
||||||
name="latest",
|
name="latest",
|
||||||
creator=create_latest_sdk_snapshots,
|
creator=create_latest_sdk_snapshots,
|
||||||
@@ -556,20 +525,6 @@ LATEST = BuildRelease(
|
|||||||
soong_env={},
|
soong_env={},
|
||||||
)
|
)
|
||||||
|
|
||||||
# The build release to populate the legacy dist structure that does not specify
|
|
||||||
# a particular build release. This MUST come after LATEST so that it includes
|
|
||||||
# all the modules for which sdk snapshot source is available.
|
|
||||||
LEGACY_BUILD_RELEASE = BuildRelease(
|
|
||||||
name="legacy",
|
|
||||||
# There is no build release specific sub directory.
|
|
||||||
sub_dir="",
|
|
||||||
# Create snapshots needed for legacy tools.
|
|
||||||
creator=create_legacy_dist_structures,
|
|
||||||
# There are no build release specific environment variables to pass to
|
|
||||||
# Soong.
|
|
||||||
soong_env={},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
@dataclasses.dataclass(frozen=True)
|
||||||
class SdkLibrary:
|
class SdkLibrary:
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
"""Unit tests for mainline_modules_sdks.py."""
|
"""Unit tests for mainline_modules_sdks.py."""
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import pathlib
|
|
||||||
import re
|
import re
|
||||||
import typing
|
import typing
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -128,19 +127,12 @@ class TestProduceDist(unittest.TestCase):
|
|||||||
mm.R,
|
mm.R,
|
||||||
mm.S,
|
mm.S,
|
||||||
mm.LATEST,
|
mm.LATEST,
|
||||||
mm.LEGACY_BUILD_RELEASE,
|
|
||||||
]
|
]
|
||||||
self.produce_dist(modules, build_releases)
|
self.produce_dist(modules, build_releases)
|
||||||
|
|
||||||
# pylint: disable=line-too-long
|
# pylint: disable=line-too-long
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[
|
[
|
||||||
# Legacy copy of the snapshots, for use by tools that don't support build specific snapshots.
|
|
||||||
"mainline-sdks/current/com.android.art/host-exports/art-module-host-exports-current.zip",
|
|
||||||
"mainline-sdks/current/com.android.art/sdk/art-module-sdk-current.zip",
|
|
||||||
"mainline-sdks/current/com.android.art/test-exports/art-module-test-exports-current.zip",
|
|
||||||
"mainline-sdks/current/com.android.ipsec/sdk/ipsec-module-sdk-current.zip",
|
|
||||||
"mainline-sdks/current/com.google.android.wifi/sdk/wifi-module-sdk-current.zip",
|
|
||||||
# Build specific snapshots.
|
# Build specific snapshots.
|
||||||
"mainline-sdks/for-R-build/current/com.android.ipsec/sdk/ipsec-module-sdk-current.zip",
|
"mainline-sdks/for-R-build/current/com.android.ipsec/sdk/ipsec-module-sdk-current.zip",
|
||||||
"mainline-sdks/for-R-build/current/com.google.android.wifi/sdk/wifi-module-sdk-current.zip",
|
"mainline-sdks/for-R-build/current/com.google.android.wifi/sdk/wifi-module-sdk-current.zip",
|
||||||
@@ -154,19 +146,6 @@ class TestProduceDist(unittest.TestCase):
|
|||||||
"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.art/test-exports/art-module-test-exports-current.zip",
|
||||||
"mainline-sdks/for-latest-build/current/com.android.ipsec/sdk/ipsec-module-sdk-current.zip",
|
"mainline-sdks/for-latest-build/current/com.android.ipsec/sdk/ipsec-module-sdk-current.zip",
|
||||||
"mainline-sdks/for-latest-build/current/com.google.android.wifi/sdk/wifi-module-sdk-current.zip",
|
"mainline-sdks/for-latest-build/current/com.google.android.wifi/sdk/wifi-module-sdk-current.zip",
|
||||||
# Legacy stubs directory containing unpacked java_sdk_library artifacts.
|
|
||||||
"stubs/com.android.art/sdk_library/public/art-removed.txt",
|
|
||||||
"stubs/com.android.art/sdk_library/public/art-stubs.jar",
|
|
||||||
"stubs/com.android.art/sdk_library/public/art.srcjar",
|
|
||||||
"stubs/com.android.art/sdk_library/public/art.txt",
|
|
||||||
"stubs/com.android.ipsec/sdk_library/public/android.net.ipsec.ike-removed.txt",
|
|
||||||
"stubs/com.android.ipsec/sdk_library/public/android.net.ipsec.ike-stubs.jar",
|
|
||||||
"stubs/com.android.ipsec/sdk_library/public/android.net.ipsec.ike.srcjar",
|
|
||||||
"stubs/com.android.ipsec/sdk_library/public/android.net.ipsec.ike.txt",
|
|
||||||
"stubs/com.google.android.wifi/sdk_library/public/framework-wifi-removed.txt",
|
|
||||||
"stubs/com.google.android.wifi/sdk_library/public/framework-wifi-stubs.jar",
|
|
||||||
"stubs/com.google.android.wifi/sdk_library/public/framework-wifi.srcjar",
|
|
||||||
"stubs/com.google.android.wifi/sdk_library/public/framework-wifi.txt",
|
|
||||||
],
|
],
|
||||||
sorted(self.list_files_in_dir(self.tmp_dist_dir)))
|
sorted(self.list_files_in_dir(self.tmp_dist_dir)))
|
||||||
|
|
||||||
@@ -246,30 +225,6 @@ class TestProduceDist(unittest.TestCase):
|
|||||||
],
|
],
|
||||||
sorted(self.list_files_in_dir(self.tmp_dist_dir)))
|
sorted(self.list_files_in_dir(self.tmp_dist_dir)))
|
||||||
|
|
||||||
def test_legacy_release(self):
|
|
||||||
modules = [
|
|
||||||
MAINLINE_MODULES_BY_APEX["com.android.art"], # An unnbundled module
|
|
||||||
MAINLINE_MODULES_BY_APEX["com.android.runtime"], # A bundled module
|
|
||||||
MAINLINE_MODULES_BY_APEX["platform-mainline"], # Platform SDK
|
|
||||||
]
|
|
||||||
build_releases = [mm.LEGACY_BUILD_RELEASE]
|
|
||||||
self.produce_dist(modules, build_releases)
|
|
||||||
|
|
||||||
# pylint: disable=line-too-long
|
|
||||||
self.assertEqual(
|
|
||||||
[
|
|
||||||
# Legacy copy of the snapshots.
|
|
||||||
"mainline-sdks/current/com.android.art/host-exports/art-module-host-exports-current.zip",
|
|
||||||
"mainline-sdks/current/com.android.art/sdk/art-module-sdk-current.zip",
|
|
||||||
"mainline-sdks/current/com.android.art/test-exports/art-module-test-exports-current.zip",
|
|
||||||
# Legacy stubs directory containing unpacked java_sdk_library artifacts.
|
|
||||||
"stubs/com.android.art/sdk_library/public/art-removed.txt",
|
|
||||||
"stubs/com.android.art/sdk_library/public/art-stubs.jar",
|
|
||||||
"stubs/com.android.art/sdk_library/public/art.srcjar",
|
|
||||||
"stubs/com.android.art/sdk_library/public/art.txt",
|
|
||||||
],
|
|
||||||
sorted(self.list_files_in_dir(self.tmp_dist_dir)))
|
|
||||||
|
|
||||||
def create_build_number_file(self):
|
def create_build_number_file(self):
|
||||||
soong_dir = os.path.join(self.tmp_out_dir, "soong")
|
soong_dir = os.path.join(self.tmp_out_dir, "soong")
|
||||||
os.makedirs(soong_dir, exist_ok=True)
|
os.makedirs(soong_dir, exist_ok=True)
|
||||||
@@ -305,7 +260,6 @@ class TestProduceDist(unittest.TestCase):
|
|||||||
mm.R,
|
mm.R,
|
||||||
mm.S,
|
mm.S,
|
||||||
mm.LATEST,
|
mm.LATEST,
|
||||||
mm.LEGACY_BUILD_RELEASE,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
producer.produce_dist(modules, build_releases)
|
producer.produce_dist(modules, build_releases)
|
||||||
@@ -327,15 +281,6 @@ class TestProduceDist(unittest.TestCase):
|
|||||||
"com.google.android.wifi"
|
"com.google.android.wifi"
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
(
|
|
||||||
"legacy",
|
|
||||||
{},
|
|
||||||
["current"],
|
|
||||||
[
|
|
||||||
"com.android.art", "com.android.ipsec",
|
|
||||||
"com.google.android.wifi"
|
|
||||||
],
|
|
||||||
),
|
|
||||||
(
|
(
|
||||||
"S",
|
"S",
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user