Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 package_ios.py - Build and Package Release and Rebug fat libraries for iOS. | 7 package_ios.py - Build and Package Release and Rebug fat libraries for iOS. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import argparse | 10 import argparse |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 framework_name, 'Headers'), | 83 framework_name, 'Headers'), |
| 84 os.path.join(out_dir, 'Headers')) | 84 os.path.join(out_dir, 'Headers')) |
| 85 | 85 |
| 86 | 86 |
| 87 def package_ios_framework_using_gn(out_dir='out/Framework', extra_options=''): | 87 def package_ios_framework_using_gn(out_dir='out/Framework', extra_options=''): |
| 88 print 'Building Cronet Dynamic Framework using gn...' | 88 print 'Building Cronet Dynamic Framework using gn...' |
| 89 | 89 |
| 90 # Package all builds in the output directory | 90 # Package all builds in the output directory |
| 91 os.makedirs(out_dir) | 91 os.makedirs(out_dir) |
| 92 build_dir = '' | 92 build_dir = '' |
| 93 for (build_config, gn_extra_args) in [('Debug', 'is_debug=true use_xcode_clang =true'), | 93 build_configs = [ |
| 94 ('Release', 'is_debug=false enable_stripping=true is_official_build=true ')]: | 94 ('Release', 'is_debug=false is_official_build=true'), |
| 95 for (target_device, target_cpu, additional_cpu) in [('os', 'arm', 'arm64'), | 95 ('Debug', 'is_debug=true use_xcode_clang=true'), |
| 96 ('simulator', 'x86', 'x64')]: | 96 ] |
| 97 target_dir = '%s-iphone%s' % (build_config, target_device) | 97 target_devices = [ |
| 98 build_dir = os.path.join("out", target_dir) | 98 ('iphoneos', ['arm', 'arm64']), |
| 99 gn_args = 'target_os="ios" enable_websockets=false ' \ | 99 ('iphonesimulator', ['x64']), |
| 100 'is_cronet_build=true is_component_build=false ' \ | 100 ] |
| 101 'disable_file_support=true disable_ftp_support=true ' \ | 101 for (build_config, gn_extra_args) in build_configs: |
| 102 'use_platform_icu_alternatives=true ' \ | 102 for (target_device, target_cpus) in target_devices: |
| 103 'disable_brotli_filter=true enable_dsyms=true ' \ | 103 for target_cpu in target_cpus: |
|
kapishnikov
2017/05/17 16:02:49
The output has changed to contain thin libraries i
mef
2017/05/19 18:07:59
With latest changes in BUILD.gn we should be able
| |
| 104 'target_cpu="%s" additional_target_cpus = ["%s"] %s' % \ | 104 target_dir = '%s-%s-%s' % (build_config, target_device, target_cpu) |
| 105 (target_cpu, additional_cpu, gn_extra_args) | 105 build_dir = os.path.join("out", target_dir) |
| 106 gn_args = 'target_os="ios" enable_websockets=false ' \ | |
| 107 'is_cronet_build=true is_component_build=false ' \ | |
| 108 'disable_file_support=true disable_ftp_support=true ' \ | |
| 109 'use_platform_icu_alternatives=true ' \ | |
| 110 'disable_brotli_filter=true enable_dsyms=true ' \ | |
| 111 'target_cpu="%s" %s' % \ | |
| 112 (target_cpu, gn_extra_args) | |
| 106 | 113 |
| 107 print 'Generating Ninja ' + gn_args | 114 print 'Generating Ninja ' + gn_args |
| 108 gn_result = run('gn gen %s --args=\'%s\'' % (build_dir, gn_args)) | 115 gn_result = run('gn gen %s --args=\'%s\'' % (build_dir, gn_args)) |
| 109 if gn_result != 0: | 116 if gn_result != 0: |
| 110 return gn_result | 117 return gn_result |
| 111 | 118 |
| 112 print 'Building ' + build_dir | 119 print 'Building ' + build_dir |
| 113 build_result = run('ninja -C %s cronet_package' % build_dir, | 120 build_result = run('ninja -C %s cronet_package' % build_dir, |
| 114 extra_options) | 121 extra_options) |
| 115 if build_result != 0: | 122 if build_result != 0: |
| 116 return build_result | 123 return build_result |
| 117 | 124 |
| 118 # Copy framework. | 125 # Copy framework. |
| 119 shutil.copytree(os.path.join(build_dir, 'Cronet.framework'), | 126 shutil.copytree(os.path.join(build_dir, 'Cronet.framework'), |
| 120 os.path.join(out_dir, target_dir, 'Cronet.framework')) | 127 os.path.join(out_dir, target_dir, 'Cronet.framework')) |
| 121 # Copy symbols. | 128 # Copy symbols. |
| 122 shutil.copytree(os.path.join(build_dir, 'Cronet.dSYM'), | 129 shutil.copytree(os.path.join(build_dir, 'Cronet.dSYM'), |
| 123 os.path.join(out_dir, target_dir, 'Cronet.framework.dSYM')) | 130 os.path.join(out_dir, target_dir, 'Cronet.framework.dSYM')) |
| 131 | |
| 132 # Copy static library. | |
| 133 shutil.copy2(os.path.join(build_dir, 'cronet', 'libcronet.a'), | |
| 134 os.path.join(out_dir, target_dir)) | |
| 124 | 135 |
| 125 # Copy common files from last built package. | 136 # Copy common files from last built package. |
| 126 package_dir = os.path.join(build_dir, 'cronet') | 137 package_dir = os.path.join(build_dir, 'cronet') |
| 127 shutil.copy2(os.path.join(package_dir, 'AUTHORS'), out_dir) | 138 shutil.copy2(os.path.join(package_dir, 'AUTHORS'), out_dir) |
| 128 shutil.copy2(os.path.join(package_dir, 'LICENSE'), out_dir) | 139 shutil.copy2(os.path.join(package_dir, 'LICENSE'), out_dir) |
| 129 shutil.copy2(os.path.join(package_dir, 'VERSION'), out_dir) | 140 shutil.copy2(os.path.join(package_dir, 'VERSION'), out_dir) |
| 130 # Copy the headers. | 141 # Copy the headers. |
| 131 shutil.copytree(os.path.join(build_dir, | 142 shutil.copytree(os.path.join(build_dir, |
| 132 'Cronet.framework', 'Headers'), | 143 'Cronet.framework', 'Headers'), |
| 133 os.path.join(out_dir, 'Headers')) | 144 os.path.join(out_dir, 'Headers')) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 | 201 |
| 191 if options.gn: | 202 if options.gn: |
| 192 return package_ios_framework_using_gn(out_dir, extra_options_list) | 203 return package_ios_framework_using_gn(out_dir, extra_options_list) |
| 193 | 204 |
| 194 return package_ios(out_dir, "out/Release", "opt") or \ | 205 return package_ios(out_dir, "out/Release", "opt") or \ |
| 195 package_ios(out_dir, "out/Debug", "dbg") | 206 package_ios(out_dir, "out/Debug", "dbg") |
| 196 | 207 |
| 197 | 208 |
| 198 if __name__ == '__main__': | 209 if __name__ == '__main__': |
| 199 sys.exit(main()) | 210 sys.exit(main()) |
| OLD | NEW |