| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Pack relocations in a library (or copy unchanged). | 7 """Pack relocations in a library (or copy unchanged). |
| 8 | 8 |
| 9 If --enable-packing and --configuration-name=='Release', invoke the | 9 If --enable-packing and --configuration-name=='Release', invoke the |
| 10 relocation_packer tool to pack the .rel.dyn or .rela.dyn section in the given | 10 relocation_packer tool to pack the .rel.dyn or .rela.dyn section in the given |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 help='Names of any libraries explicitly not packed') | 57 help='Names of any libraries explicitly not packed') |
| 58 parser.add_option('--android-pack-relocations', | 58 parser.add_option('--android-pack-relocations', |
| 59 help='Path to the relocations packer binary') | 59 help='Path to the relocations packer binary') |
| 60 parser.add_option('--stripped-libraries-dir', | 60 parser.add_option('--stripped-libraries-dir', |
| 61 help='Directory for stripped libraries') | 61 help='Directory for stripped libraries') |
| 62 parser.add_option('--packed-libraries-dir', | 62 parser.add_option('--packed-libraries-dir', |
| 63 help='Directory for packed libraries') | 63 help='Directory for packed libraries') |
| 64 parser.add_option('--libraries', action='append', | 64 parser.add_option('--libraries', action='append', |
| 65 help='List of libraries') | 65 help='List of libraries') |
| 66 parser.add_option('--stamp', help='Path to touch on success') | 66 parser.add_option('--stamp', help='Path to touch on success') |
| 67 parser.add_option('--filelistjson', |
| 68 help='Output path of filelist.json to write') |
| 67 | 69 |
| 68 options, _ = parser.parse_args(args) | 70 options, _ = parser.parse_args(args) |
| 69 enable_packing = (options.enable_packing == '1' and | 71 enable_packing = (options.enable_packing == '1' and |
| 70 options.configuration_name == 'Release') | 72 options.configuration_name == 'Release') |
| 71 exclude_packing_set = set(build_utils.ParseGypList( | 73 exclude_packing_set = set(build_utils.ParseGypList( |
| 72 options.exclude_packing_list)) | 74 options.exclude_packing_list)) |
| 73 | 75 |
| 74 libraries = [] | 76 libraries = [] |
| 75 for libs_arg in options.libraries: | 77 for libs_arg in options.libraries: |
| 76 libraries += build_utils.ParseGypList(libs_arg) | 78 libraries += build_utils.ParseGypList(libs_arg) |
| 77 | 79 |
| 78 if options.clear_dir: | 80 if options.clear_dir: |
| 79 build_utils.DeleteDirectory(options.packed_libraries_dir) | 81 build_utils.DeleteDirectory(options.packed_libraries_dir) |
| 80 | 82 |
| 81 build_utils.MakeDirectory(options.packed_libraries_dir) | 83 build_utils.MakeDirectory(options.packed_libraries_dir) |
| 82 | 84 |
| 85 output_paths = [] |
| 83 for library in libraries: | 86 for library in libraries: |
| 84 library_path = os.path.join(options.stripped_libraries_dir, library) | 87 library_path = os.path.join(options.stripped_libraries_dir, library) |
| 85 output_path = os.path.join( | 88 output_path = os.path.join( |
| 86 options.packed_libraries_dir, os.path.basename(library)) | 89 options.packed_libraries_dir, os.path.basename(library)) |
| 90 output_paths.append(output_path) |
| 87 | 91 |
| 88 if enable_packing and library not in exclude_packing_set: | 92 if enable_packing and library not in exclude_packing_set: |
| 89 PackLibraryRelocations(options.android_pack_relocations, | 93 PackLibraryRelocations(options.android_pack_relocations, |
| 90 library_path, | 94 library_path, |
| 91 output_path) | 95 output_path) |
| 92 else: | 96 else: |
| 93 CopyLibraryUnchanged(library_path, output_path) | 97 CopyLibraryUnchanged(library_path, output_path) |
| 94 | 98 |
| 99 if options.filelistjson: |
| 100 build_utils.WriteJson({ 'files': output_paths }, options.filelistjson) |
| 101 |
| 95 if options.depfile: | 102 if options.depfile: |
| 96 build_utils.WriteDepfile( | 103 build_utils.WriteDepfile( |
| 97 options.depfile, | 104 options.depfile, |
| 98 libraries + build_utils.GetPythonDependencies()) | 105 libraries + build_utils.GetPythonDependencies()) |
| 99 | 106 |
| 100 if options.stamp: | 107 if options.stamp: |
| 101 build_utils.Touch(options.stamp) | 108 build_utils.Touch(options.stamp) |
| 102 | 109 |
| 103 return 0 | 110 return 0 |
| 104 | 111 |
| 105 | 112 |
| 106 if __name__ == '__main__': | 113 if __name__ == '__main__': |
| 107 sys.exit(main(sys.argv[1:])) | 114 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |