mainline_modules_sdks.py: Fix issues with r snapshot

Moves the generated Android.bp file from the root of the snapshot zip
file into the sdk_library/ sub-directory to allow the zip to be
unpacked in a directory that already contains an Android.bp file that
defines the apex_set for the corresponding APEX.

Also, removes the stubs_src property from the generated Android.bp
file.

Bug: 218685706
Test: packages/modules/common/build/mainline_modules_sdks.sh --build-release=R
      atest --host mainline_modules_sdks_test
      # deleted vendor/unbundled_google/modules/IpSecGooglePrebuilt from rvc-dev checkout.
      # unpacked out/soong/mainline-sdks/for-R-build/ipsec-module-sdk-current.zip
      # ran "m nothing"
Change-Id: I03e2060dc06338a8d0102744f79c75d33d567a17
This commit is contained in:
Paul Duffin
2022-03-29 12:49:29 +00:00
parent 2ef33a4d65
commit fa90e1e5e0
4 changed files with 36 additions and 39 deletions

View File

@@ -306,7 +306,13 @@ class SnapshotBuilder:
apex = module.apex
dest_dir = os.path.join(r_snapshot_dir, apex)
os.makedirs(dest_dir, exist_ok=True)
bp_file = os.path.join(dest_dir, "Android.bp")
# Write the bp file in the sdk_library sub-directory rather than the
# root of the zip file as it will be unpacked in a directory that
# already contains an Android.bp file that defines the corresponding
# apex_set.
bp_file = os.path.join(dest_dir, "sdk_library/Android.bp")
os.makedirs(os.path.dirname(bp_file), exist_ok=True)
# The first sdk in the list is the name to use.
sdk_name = module.sdks[0]
@@ -338,24 +344,21 @@ java_sdk_library_import {{
"test_{aosp_apex}",
],
public: {{
jars: ["sdk_library/public/{module_name}-stubs.jar"],
stub_srcs: ["sdk_library/public/{module_name}.srcjar"],
current_api: "sdk_library/public/{module_name}.txt",
removed_api: "sdk_library/public/{module_name}-removed.txt",
jars: ["public/{module_name}-stubs.jar"],
current_api: "public/{module_name}.txt",
removed_api: "public/{module_name}-removed.txt",
sdk_version: "module_current",
}},
system: {{
jars: ["sdk_library/system/{module_name}-stubs.jar"],
stub_srcs: ["sdk_library/system/{module_name}.srcjar"],
current_api: "sdk_library/system/{module_name}.txt",
removed_api: "sdk_library/system/{module_name}-removed.txt",
jars: ["system/{module_name}-stubs.jar"],
current_api: "system/{module_name}.txt",
removed_api: "system/{module_name}-removed.txt",
sdk_version: "module_current",
}},
module_lib: {{
jars: ["sdk_library/module-lib/{module_name}-stubs.jar"],
stub_srcs: ["sdk_library/module-lib/{module_name}.srcjar"],
current_api: "sdk_library/module-lib/{module_name}.txt",
removed_api: "sdk_library/module-lib/{module_name}-removed.txt",
jars: ["module-lib/{module_name}-stubs.jar"],
current_api: "module-lib/{module_name}.txt",
removed_api: "module-lib/{module_name}-removed.txt",
sdk_version: "module_current",
}},
}}