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 25 matching lines...) Expand all Loading... | |
| 36 shutil.copytree(build_dir, target_dir, ignore=shutil.ignore_patterns('*.a')) | 36 shutil.copytree(build_dir, target_dir, ignore=shutil.ignore_patterns('*.a')) |
| 37 except OSError as e: | 37 except OSError as e: |
| 38 print('Directory not copied. Error: %s' % e) | 38 print('Directory not copied. Error: %s' % e) |
| 39 return 0 | 39 return 0 |
| 40 | 40 |
| 41 | 41 |
| 42 def package_ios(out_dir, build_dir, build_config): | 42 def package_ios(out_dir, build_dir, build_config): |
| 43 build_dir_sim = build_dir | 43 build_dir_sim = build_dir |
| 44 build_dir_dev = build_dir +'-iphoneos' | 44 build_dir_dev = build_dir +'-iphoneos' |
| 45 build_target = 'cronet_package' | 45 build_target = 'cronet_package' |
| 46 target_dir = out_dir + "/Cronet" | 46 target_dir = out_dir |
| 47 return build(build_dir_sim, build_target) or \ | 47 return build(build_dir_sim, build_target) or \ |
| 48 build(build_dir_dev, build_target) or \ | 48 build(build_dir_dev, build_target) or \ |
| 49 copy_build_dir(target_dir, build_dir_dev + "/cronet") or \ | 49 copy_build_dir(target_dir, build_dir_dev + "/cronet") or \ |
| 50 lipo_libraries(target_dir, [build_dir_sim, build_dir_dev], \ | 50 lipo_libraries(target_dir, [build_dir_sim, build_dir_dev], \ |
| 51 "libcronet_" + build_config + ".a", \ | 51 "libcronet_" + build_config + ".a", \ |
| 52 "cronet/libcronet_standalone.a") | 52 "cronet/libcronet_standalone.a") |
| 53 | 53 |
| 54 | 54 |
| 55 def package_ios_framework(out_dir='out/Framework', extra_options=''): | 55 def package_ios_framework(out_dir='out/Framework', extra_options=''): |
| 56 print 'Building Cronet Dynamic Framework...' | 56 print 'Building Cronet Dynamic Framework...' |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 68 return build_result | 68 return build_result |
| 69 | 69 |
| 70 # Package all builds in the output directory | 70 # Package all builds in the output directory |
| 71 os.makedirs(out_dir) | 71 os.makedirs(out_dir) |
| 72 for build_dir in build_dirs: | 72 for build_dir in build_dirs: |
| 73 shutil.copytree(os.path.join('out', build_dir, 'Cronet.framework'), | 73 shutil.copytree(os.path.join('out', build_dir, 'Cronet.framework'), |
| 74 os.path.join(out_dir, build_dir, 'Cronet.framework')) | 74 os.path.join(out_dir, build_dir, 'Cronet.framework')) |
| 75 if 'Release' in build_dir: | 75 if 'Release' in build_dir: |
| 76 shutil.copytree(os.path.join('out', build_dir, 'Cronet.framework.dSYM'), | 76 shutil.copytree(os.path.join('out', build_dir, 'Cronet.framework.dSYM'), |
| 77 os.path.join(out_dir, build_dir, 'Cronet.framework.dSYM')) | 77 os.path.join(out_dir, build_dir, 'Cronet.framework.dSYM')) |
| 78 # Copy the version file | |
| 79 shutil.copy2('chrome/VERSION', out_dir) | |
| 80 # Copy the headers | |
| 81 headers_dir = os.path.join(out_dir, 'Headers') | |
| 82 os.makedirs(headers_dir) | |
| 83 shutil.copy2('components/cronet/ios/cronet_c_for_grpc.h', headers_dir) | |
|
mef
2016/05/25 17:55:31
Could / should those copies come from Framework di
kapishnikov
2016/05/25 18:12:53
Done.
| |
| 84 shutil.copy2('components/cronet/ios/Cronet.h', headers_dir) | |
| 78 | 85 |
| 79 | 86 |
| 80 def main(): | 87 def main(): |
| 81 parser = argparse.ArgumentParser() | 88 parser = argparse.ArgumentParser() |
| 82 parser.add_argument('out_dir', nargs=1, help='path to output directory') | 89 parser.add_argument('out_dir', nargs=1, help='path to output directory') |
| 83 parser.add_argument('-g', '--skip_gyp', action='store_true', | 90 parser.add_argument('-g', '--skip_gyp', action='store_true', |
| 84 help='skip gyp') | 91 help='skip gyp') |
| 85 parser.add_argument('-d', '--debug', action='store_true', | 92 parser.add_argument('-d', '--debug', action='store_true', |
| 86 help='use release configuration') | 93 help='use release configuration') |
| 87 parser.add_argument('-r', '--release', action='store_true', | 94 parser.add_argument('-r', '--release', action='store_true', |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 110 | 117 |
| 111 if options.framework: | 118 if options.framework: |
| 112 return package_ios_framework(out_dir, extra_options_list) | 119 return package_ios_framework(out_dir, extra_options_list) |
| 113 | 120 |
| 114 return package_ios(out_dir, "out/Release", "opt") or \ | 121 return package_ios(out_dir, "out/Release", "opt") or \ |
| 115 package_ios(out_dir, "out/Debug", "dbg") | 122 package_ios(out_dir, "out/Debug", "dbg") |
| 116 | 123 |
| 117 | 124 |
| 118 if __name__ == '__main__': | 125 if __name__ == '__main__': |
| 119 sys.exit(main()) | 126 sys.exit(main()) |
| OLD | NEW |