Commit 8707811d by Kaiyi Li Committed by Commit Bot

Add an option to copy the artifact to vendor partition

Add a --copy-to-vendor-partition optional argument to both roll_aosp.sh and generate_android_bp.py. When specified the root targets will be generated with vendor: true and a relative install path to egl folder, so that we can use ANGLE as the Android OpenGLES driver when the system starts up. Test: run roll_aosp.sh --copy-to-vendor-partion, build the Android image with m -j72, load the image with the Android emulator and find all ANGLE related *.so's are under the /vendor/lib/egl folder. Bug: angleproject:5456 Change-Id: I38c64e8ea3ad5f5d0cc0b8cd77856f49109b23c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568907 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent 4d9157a5
...@@ -312,7 +312,7 @@ def merge_bps(bps_for_abis): ...@@ -312,7 +312,7 @@ def merge_bps(bps_for_abis):
return common_bp return common_bp
def library_target_to_blueprint(target, build_info): def library_target_to_blueprint(target, build_info, copy_to_vendor, relative_install_path):
bps_for_abis = {} bps_for_abis = {}
blueprint_type = "" blueprint_type = ""
for abi in abi_targets: for abi in abi_targets:
...@@ -339,6 +339,11 @@ def library_target_to_blueprint(target, build_info): ...@@ -339,6 +339,11 @@ def library_target_to_blueprint(target, build_info):
bp['sdk_version'] = sdk_version bp['sdk_version'] = sdk_version
bp['stl'] = stl bp['stl'] = stl
if copy_to_vendor:
bp['vendor'] = True
if relative_install_path is not None:
assert copy_to_vendor
bp['target'] = {'android': {'relative_install_path': relative_install_path}}
bps_for_abis[abi] = bp bps_for_abis[abi] = bp
common_bp = merge_bps(bps_for_abis) common_bp = merge_bps(bps_for_abis)
...@@ -441,11 +446,14 @@ def action_target_to_blueprint(target, build_info): ...@@ -441,11 +446,14 @@ def action_target_to_blueprint(target, build_info):
return blueprint_type, bp return blueprint_type, bp
def gn_target_to_blueprint(target, build_info): def gn_target_to_blueprint(target, build_info, copy_to_vendor, relative_install_path):
for abi in abi_targets: for abi in abi_targets:
gn_type = build_info[abi][target]['type'] gn_type = build_info[abi][target]['type']
if gn_type in blueprint_library_target_types: if gn_type in blueprint_library_target_types:
return library_target_to_blueprint(target, build_info) if copy_to_vendor and gn_type == 'shared_library':
return library_target_to_blueprint(target, build_info, True, relative_install_path)
else:
return library_target_to_blueprint(target, build_info, False, None)
elif gn_type in blueprint_gen_types: elif gn_type in blueprint_gen_types:
return action_target_to_blueprint(target, build_info[abi]) return action_target_to_blueprint(target, build_info[abi])
else: else:
...@@ -481,7 +489,13 @@ def main(): ...@@ -481,7 +489,13 @@ def main():
'gn_json_' + fixed_abi, 'gn_json_' + fixed_abi,
help=fixed_abi + help=fixed_abi +
'gn desc in json format. Generated with \'gn desc <out_dir> --format=json "*"\'.') 'gn desc in json format. Generated with \'gn desc <out_dir> --format=json "*"\'.')
parser.add_argument(
'--copy-to-vendor-partition',
help='whether the shared library target will copy to the vendor partition',
action='store_true',
default=False)
args = vars(parser.parse_args()) args = vars(parser.parse_args())
copy_to_vendor = args['copy_to_vendor_partition']
build_info = {} build_info = {}
for abi in abi_targets: for abi in abi_targets:
...@@ -498,7 +512,13 @@ def main(): ...@@ -498,7 +512,13 @@ def main():
blueprint_targets = [] blueprint_targets = []
for target in targets_to_write: for target in targets_to_write:
blueprint_targets.append(gn_target_to_blueprint(target, build_info)) blueprint_targets.append(
gn_target_to_blueprint(
target,
build_info,
copy_to_vendor,
relative_install_path='egl' if copy_to_vendor and
(target in root_targets) else None))
# Add APKs with all of the root libraries # Add APKs with all of the root libraries
blueprint_targets.append(('filegroup', { blueprint_targets.append(('filegroup', {
......
...@@ -105,7 +105,7 @@ python scripts/generate_android_bp.py \ ...@@ -105,7 +105,7 @@ python scripts/generate_android_bp.py \
${GN_OUTPUT_DIRECTORY}/desc.arm.json \ ${GN_OUTPUT_DIRECTORY}/desc.arm.json \
${GN_OUTPUT_DIRECTORY}/desc.arm64.json \ ${GN_OUTPUT_DIRECTORY}/desc.arm64.json \
${GN_OUTPUT_DIRECTORY}/desc.x86.json \ ${GN_OUTPUT_DIRECTORY}/desc.x86.json \
${GN_OUTPUT_DIRECTORY}/desc.x64.json > Android.bp ${GN_OUTPUT_DIRECTORY}/desc.x64.json $@ > Android.bp
rm -rf ${GN_OUTPUT_DIRECTORY} rm -rf ${GN_OUTPUT_DIRECTORY}
git add Android.bp git add Android.bp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment