From 5a747c7b55b6bcee9429bc57c5ccd61e8aecf4fa Mon Sep 17 00:00:00 2001 From: Ivan Lozano Date: Wed, 16 Mar 2022 13:22:53 -0400 Subject: [PATCH] Add Rust proc-macros to host snapshot update.py Bug: 204304380 Test: The host snapshot Android.bp includes proc-macros. Change-Id: I7d406d9075fc5a6aa5983a5fef71edd119c6f67f --- vendor_snapshot/update.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/vendor_snapshot/update.py b/vendor_snapshot/update.py index 03cc236dc..e209584b7 100644 --- a/vendor_snapshot/update.py +++ b/vendor_snapshot/update.py @@ -110,6 +110,7 @@ JSON_TO_BP = { 'RuntimeLibs': 'runtime_libs', 'Required': 'required', 'Filename': 'filename', + 'CrateName': 'crate_name', } SANITIZER_VARIANT_PROPS = { @@ -409,18 +410,25 @@ def convert_json_host_data_to_bp(mod, install_dir): mod: JSON definition of the module install_dir: installation directory of the host snapshot """ + rust_proc_macro = mod.pop('RustProcMacro', False) prop = convert_json_data_to_bp_prop(mod, install_dir) - prop['host_supported'] = True - prop['device_supported'] = False + if not rust_proc_macro: + prop['host_supported'] = True + prop['device_supported'] = False + prop['stl'] = 'none' prop['prefer'] = True - prop['stl'] = 'none' ## Move install file to host source file prop['target'] = dict() prop['target']['host'] = dict() prop['target']['host']['srcs'] = [prop['filename']] del prop['filename'] - bp = 'cc_prebuilt_binary {\n' + gen_bp_prop(prop, INDENT) + '}\n\n' + mod_type = 'cc_prebuilt_binary' + + if rust_proc_macro: + mod_type = 'rust_prebuilt_proc_macro' + + bp = mod_type + ' {\n' + gen_bp_prop(prop, INDENT) + '}\n\n' return bp def gen_host_bp_file(install_dir):