Chromium Code Reviews| Index: build/android/play_services/preprocess.py |
| diff --git a/build/android/play_services/preprocess.py b/build/android/play_services/preprocess.py |
| index b14ffad8b271023f46a260424fe7583209686faf..ccf0b726acc20302f4fc00448229d0ad892bdae5 100755 |
| --- a/build/android/play_services/preprocess.py |
| +++ b/build/android/play_services/preprocess.py |
| @@ -60,6 +60,11 @@ def main(): |
| help='the output directory', |
| required=True, |
| metavar='FILE') |
| + required_args.add_argument('-g', |
| + '--gni-out-file', |
| + help='the GN output file', |
| + required=True, |
| + metavar='FILE') |
| required_args.add_argument('-c', |
| '--config-file', |
| help='the config file path', |
| @@ -74,10 +79,11 @@ def main(): |
| return ProcessGooglePlayServices(args.repository, |
| args.out_dir, |
| + args.gni_out_file, |
| args.config_file) |
| -def ProcessGooglePlayServices(repo, out_dir, config_path): |
| +def ProcessGooglePlayServices(repo, out_dir, gni_out_file, config_path): |
| config = utils.ConfigParser(config_path) |
| tmp_root = tempfile.mkdtemp() |
| @@ -86,6 +92,7 @@ def ProcessGooglePlayServices(repo, out_dir, config_path): |
| _ImportFromExtractedRepo(config, tmp_paths, repo) |
| _ProcessResources(config, tmp_paths, repo) |
| _CopyToOutput(tmp_paths, out_dir) |
| + _EnumerateProguardFiles(gni_out_file, out_dir) |
| _UpdateVersionInConfig(config, tmp_paths) |
| finally: |
| shutil.rmtree(tmp_root) |
| @@ -187,6 +194,25 @@ def _CopyToOutput(tmp_paths, out_dir): |
| shutil.copytree(tmp_paths['imported_clients'], out_dir) |
| +# Write a GN file containing a list of each GMS client's proguard file (if any). |
| +def _EnumerateProguardFiles(gni_path, out_dir): |
| + gni_dir = os.path.dirname(gni_path) |
| + script_name = os.path.relpath(sys.argv[0], gni_dir) |
| + |
| + gni_text = '# This file generated by ' + script_name + '\n' |
|
Maria
2017/04/19 05:40:35
Copyright should go here I guess.
|
| + gni_text += 'gms_proguard_configs = [\n' |
|
jbudorick
2017/04/18 23:59:12
Build the (sorted) list of extant proguard files,
paulmiller
2017/04/19 17:30:13
It looks like pformat emits single quotes. Not sur
jbudorick
2017/04/19 18:42:26
Ah, yeah, you're right.
|
| + for client_dir in os.listdir(out_dir): |
| + proguard_path = os.path.join( |
| + out_dir, client_dir, 'proguard.txt') |
| + if os.path.exists(os.path.dirname(proguard_path)): |
| + relative = os.path.relpath(proguard_path, gni_dir) |
| + gni_text += ' "' + relative + '",\n' |
| + gni_text += ']\n' |
| + |
| + with open(gni_path, 'w') as gni_file: |
| + gni_file.write(gni_text) |
| + |
| + |
| def _UpdateVersionInConfig(config, tmp_paths): |
| version_xml_path = os.path.join(tmp_paths['imported_clients'], |
| config.version_xml_path) |