2017-02-06 07:53:41 -08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
|
|
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
#
|
|
|
|
|
# Use of this source code is governed by a BSD-style license
|
|
|
|
|
# that can be found in the LICENSE file in the root of the source
|
|
|
|
|
# tree. An additional intellectual property rights grant can be found
|
|
|
|
|
# in the file PATENTS. All contributing project authors may
|
|
|
|
|
# be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
|
|
|
|
|
"""WebRTC iOS FAT libraries build script.
|
|
|
|
|
Each architecture is compiled separately before being merged together.
|
|
|
|
|
By default, the library is created in out_ios_libs/. (Change with -o.)
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
|
import distutils.dir_util
|
|
|
|
|
import logging
|
|
|
|
|
import os
|
|
|
|
|
import shutil
|
|
|
|
|
import subprocess
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
os.environ['PATH'] = '/usr/libexec' + os.pathsep + os.environ['PATH']
|
|
|
|
|
|
|
|
|
|
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
2017-02-15 20:51:26 +01:00
|
|
|
WEBRTC_SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..'))
|
|
|
|
|
SDK_OUTPUT_DIR = os.path.join(WEBRTC_SRC_DIR, 'out_ios_libs')
|
2017-02-06 07:53:41 -08:00
|
|
|
SDK_LIB_NAME = 'librtc_sdk_objc.a'
|
|
|
|
|
SDK_FRAMEWORK_NAME = 'WebRTC.framework'
|
|
|
|
|
|
2017-02-13 08:30:01 -08:00
|
|
|
DEFAULT_ARCHS = ENABLED_ARCHS = ['arm64', 'arm', 'x64', 'x86']
|
2017-02-06 07:53:41 -08:00
|
|
|
IOS_DEPLOYMENT_TARGET = '8.0'
|
|
|
|
|
LIBVPX_BUILD_VP9 = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _ParseArgs():
|
|
|
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
|
|
|
parser.add_argument('-b', '--build_type', default='framework',
|
|
|
|
|
choices=['framework', 'static_only'],
|
|
|
|
|
help='The build type. Can be "framework" or "static_only". '
|
|
|
|
|
'Defaults to "framework".')
|
|
|
|
|
parser.add_argument('--build_config', default='release',
|
|
|
|
|
choices=['debug', 'release'],
|
|
|
|
|
help='The build config. Can be "debug" or "release". '
|
|
|
|
|
'Defaults to "release".')
|
2017-02-13 08:30:01 -08:00
|
|
|
parser.add_argument('--arch', nargs='+', default=DEFAULT_ARCHS,
|
|
|
|
|
choices=ENABLED_ARCHS,
|
|
|
|
|
help='Architectures to build. Defaults to %(default)s.')
|
2017-02-06 07:53:41 -08:00
|
|
|
parser.add_argument('-c', '--clean', action='store_true', default=False,
|
|
|
|
|
help='Removes the previously generated build output, if any.')
|
2017-03-14 03:12:35 -07:00
|
|
|
parser.add_argument('-p', '--purify', action='store_true', default=False,
|
|
|
|
|
help='Purifies the previously generated build output by '
|
|
|
|
|
'removing the temporary results used when (re)building.')
|
2017-02-06 07:53:41 -08:00
|
|
|
parser.add_argument('-o', '--output-dir', default=SDK_OUTPUT_DIR,
|
|
|
|
|
help='Specifies a directory to output the build artifacts to. '
|
|
|
|
|
'If specified together with -c, deletes the dir.')
|
|
|
|
|
parser.add_argument('-r', '--revision', type=int, default=0,
|
|
|
|
|
help='Specifies a revision number to embed if building the framework.')
|
|
|
|
|
parser.add_argument('-e', '--bitcode', action='store_true', default=False,
|
|
|
|
|
help='Compile with bitcode.')
|
|
|
|
|
parser.add_argument('--verbose', action='store_true', default=False,
|
|
|
|
|
help='Debug logging.')
|
2017-02-13 04:59:27 -08:00
|
|
|
parser.add_argument('--use-goma', action='store_true', default=False,
|
|
|
|
|
help='Use goma to build.')
|
|
|
|
|
parser.add_argument('--extra-gn-args', default=[], nargs='*',
|
|
|
|
|
help='Additional GN args to be used during Ninja generation.')
|
|
|
|
|
|
2017-02-06 07:53:41 -08:00
|
|
|
return parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _RunCommand(cmd):
|
|
|
|
|
logging.debug('Running: %r', cmd)
|
2017-02-15 20:51:26 +01:00
|
|
|
subprocess.check_call(cmd, cwd=WEBRTC_SRC_DIR)
|
2017-02-06 07:53:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def _CleanArtifacts(output_dir):
|
|
|
|
|
if os.path.isdir(output_dir):
|
|
|
|
|
logging.info('Deleting %s', output_dir)
|
|
|
|
|
shutil.rmtree(output_dir)
|
|
|
|
|
|
|
|
|
|
|
2017-03-14 03:12:35 -07:00
|
|
|
def _CleanTemporary(output_dir, architectures):
|
|
|
|
|
if os.path.isdir(output_dir):
|
|
|
|
|
logging.info('Removing temporary build files.')
|
|
|
|
|
for arch in architectures:
|
|
|
|
|
arch_lib_path = os.path.join(output_dir, arch + '_libs')
|
|
|
|
|
if os.path.isdir(arch_lib_path):
|
|
|
|
|
shutil.rmtree(arch_lib_path)
|
|
|
|
|
|
|
|
|
|
|
2017-02-06 07:53:41 -08:00
|
|
|
def BuildWebRTC(output_dir, target_arch, flavor, build_type,
|
|
|
|
|
ios_deployment_target, libvpx_build_vp9, use_bitcode,
|
2017-02-13 04:59:27 -08:00
|
|
|
use_goma, extra_gn_args):
|
2017-02-06 07:53:41 -08:00
|
|
|
output_dir = os.path.join(output_dir, target_arch + '_libs')
|
|
|
|
|
gn_args = ['target_os="ios"', 'ios_enable_code_signing=false',
|
|
|
|
|
'use_xcode_clang=true', 'is_component_build=false']
|
|
|
|
|
|
|
|
|
|
# Add flavor option.
|
|
|
|
|
if flavor == 'debug':
|
|
|
|
|
gn_args.append('is_debug=true')
|
|
|
|
|
elif flavor == 'release':
|
|
|
|
|
gn_args.append('is_debug=false')
|
|
|
|
|
else:
|
|
|
|
|
raise ValueError('Unexpected flavor type: %s' % flavor)
|
|
|
|
|
|
|
|
|
|
gn_args.append('target_cpu="%s"' % target_arch)
|
|
|
|
|
|
|
|
|
|
gn_args.append('ios_deployment_target="%s"' % ios_deployment_target)
|
|
|
|
|
|
|
|
|
|
gn_args.append('rtc_libvpx_build_vp9=' +
|
|
|
|
|
('true' if libvpx_build_vp9 else 'false'))
|
|
|
|
|
|
|
|
|
|
gn_args.append('enable_ios_bitcode=' +
|
|
|
|
|
('true' if use_bitcode else 'false'))
|
2017-02-13 04:59:27 -08:00
|
|
|
gn_args.append('use_goma=' + ('true' if use_goma else 'false'))
|
2017-02-06 07:53:41 -08:00
|
|
|
|
|
|
|
|
# Generate static or dynamic.
|
|
|
|
|
if build_type == 'static_only':
|
|
|
|
|
gn_target_name = 'rtc_sdk_objc'
|
|
|
|
|
elif build_type == 'framework':
|
Reland of Split iOS sdk in to separate targets (patchset #1 id:1 of https://codereview.webrtc.org/2911053002/ )
Reason for revert:
Take three of relanding this after all internal issues have been resolved.
Original issue's description:
> Revert of Split iOS sdk in to separate targets (patchset #3 id:320001 of https://codereview.webrtc.org/2893843003/ )
>
> Reason for revert:
> Breaks downstream project.
>
> Original issue's description:
> > Reland of Split iOS sdk in to separate targets (patchset #1 id:1 of https://codereview.webrtc.org/2893593002/ )
> >
> > Reason for revert:
> > Take two of fixing downstream issues?
> >
> > Original issue's description:
> > > Revert of Split iOS sdk in to separate targets (patchset #1 id:1 of https://codereview.webrtc.org/2890733003/ )
> > >
> > > Reason for revert:
> > > Still problems with downstream projects
> > >
> > > Original issue's description:
> > > > Reland of Split iOS sdk in to separate targets (patchset #1 id:1 of https://codereview.webrtc.org/2890513002/ )
> > > >
> > > > Reason for revert:
> > > > Fixing downstream breakages
> > > >
> > > > Original issue's description:
> > > > > Revert of Split iOS sdk in to separate targets (patchset #13 id:280001 of https://codereview.webrtc.org/2862543002/ )
> > > > >
> > > > > Reason for revert:
> > > > > Breaking downstream projects.
> > > > >
> > > > > Original issue's description:
> > > > > > Split iOS sdk in to separate targets
> > > > > >
> > > > > > This CL splits the iOS sdk into separate static libraries for video,
> > > > > > audio, ui, common, and peerconnection-related code. This will in the
> > > > > > future make it easier to compile WebRTC without unneeded components.
> > > > > >
> > > > > > BUG=webrtc:4867
> > > > > >
> > > > > > Review-Url: https://codereview.webrtc.org/2862543002
> > > > > > Cr-Commit-Position: refs/heads/master@{#18166}
> > > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/52c83fe7102f566cf35a7533092873d58b38f426
> > > > >
> > > > > TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,kthelgason@webrtc.org
> > > > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > > > NOPRESUBMIT=true
> > > > > NOTREECHECKS=true
> > > > > NOTRY=true
> > > > > BUG=webrtc:4867
> > > > >
> > > > > Review-Url: https://codereview.webrtc.org/2890513002
> > > > > Cr-Commit-Position: refs/heads/master@{#18170}
> > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/9756238084707787f735e1294e896e462e459717
> > > >
> > > > TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,charujain@webrtc.org
> > > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > > NOPRESUBMIT=true
> > > > NOTREECHECKS=true
> > > > NOTRY=true
> > > > BUG=webrtc:4867
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2890733003
> > > > Cr-Commit-Position: refs/heads/master@{#18174}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/d51e042492bedd057bc0cac7828979d5c7369cea
> > >
> > > TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,charujain@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:4867
> > >
> > > Review-Url: https://codereview.webrtc.org/2893593002
> > > Cr-Commit-Position: refs/heads/master@{#18182}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/37144b214e2baf62ecb262ab878dde8c59cdd6a3
> >
> > TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,charujain@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=webrtc:4867
> >
> > Review-Url: https://codereview.webrtc.org/2893843003
> > Cr-Commit-Position: refs/heads/master@{#18303}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/580c3522d294c877adfe555048c675bd8d166657
>
> TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,charujain@webrtc.org,kthelgason@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4867
>
> Review-Url: https://codereview.webrtc.org/2911053002
> Cr-Commit-Position: refs/heads/master@{#18309}
> Committed: https://chromium.googlesource.com/external/webrtc/+/af5c05540cc8208f682cafe88c5c16a505479196
TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,charujain@webrtc.org,mbonadei@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4867
Review-Url: https://codereview.webrtc.org/2913753003
Cr-Commit-Position: refs/heads/master@{#18319}
2017-05-30 01:48:47 -07:00
|
|
|
gn_target_name = 'objc_framework'
|
Reland of Do not produce dSYM file for the iOS Frameworks with bitcode (patchset #1 id:1 of https://codereview.webrtc.org/2719773002/ )
Reason for revert:
Fixing issues with the framework builder.
Original issue's description:
> Revert of Do not produce dSYM file for the iOS Frameworks with bitcode (patchset #2 id:20001 of https://codereview.webrtc.org/2705163007/ )
>
> Reason for revert:
> Looks like this caused the iOS API Framework Builder to fail.
>
> https://build.chromium.org/p/client.webrtc/builders/iOS%20API%20Framework%20Builder/builds/3487/steps/zip%20archive/logs/stdio
>
> Zipping /b/rr/tmpkIyP1e/w/webrtc_ios_api_framework.zip...
> Traceback (most recent call last):
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 144, in <module>
> sys.exit(main())
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 130, in main
> exit_code = zip_with_subprocess(root, output, entries)
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 43, in zip_with_subprocess
> assert os.path.isdir(path), path
> AssertionError: /b/c/b/iOS_API_Framework_Builder/src/out_ios_libs/WebRTC.dSYM/
> step returned non-zero exit code: 1
> @@@STEP_FAILURE@@@
>
> Original issue's description:
> > Do not produce dSYM file for the iOS Frameworks with bitcode
> >
> > Though dSYM files can be generated when building applications or libraries
> > with bitcode. They cannot be used to symbolicate crash reports from
> > applications. Instead, developers need to grab the real dSYM files, which
> > are generated for each specific device type after uploading an iOS / tvOS
> > application to App Store (or to a device using Xcode). Apple clearly warns
> > about it in its documentation:
> >
> > https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATION-BITCODE
> >
> > With that in mind, I believe that it would be better to not confuse
> > developers by giving them dSYM files that are not very helpful with
> > the bitcode-enabled framework. Thus, proposing the following modification
> > to the building script, to generate dSYM by default only without
> > the bitcode option. However, if some developers still want to get
> > the dSYM files as a build-process artifact, when enabling bitcode,
> > they can explicitly add --extra-gn-args enable_dsyms=true to the script.
> >
> > Let me know if it lgty.
> >
> > NOTRY=True
> > BUG=None
> >
> > Review-Url: https://codereview.webrtc.org/2705163007
> > Cr-Commit-Position: refs/heads/master@{#16836}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/d74517c52a6cd4172b1f3fdc4e624b6145ff5a0f
>
> TBR=kjellander@webrtc.org,kthelgason@webrtc.org,VladimirTechMan@gmail.com
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=None
> NOTRY=True
>
> Review-Url: https://codereview.webrtc.org/2719773002
> Cr-Commit-Position: refs/heads/master@{#16844}
> Committed: https://chromium.googlesource.com/external/webrtc/+/da00077cfac335503b3335d5eac110f2f5bff408
TBR=kjellander@webrtc.org,vladimirtechman@gmail.com,tommi@webrtc.org
NOTRY=true
BUG=None
Review-Url: https://codereview.webrtc.org/2718983002
Cr-Commit-Position: refs/heads/master@{#16924}
2017-02-28 15:33:26 -08:00
|
|
|
if not use_bitcode:
|
|
|
|
|
gn_args.append('enable_dsyms=true')
|
2017-02-06 07:53:41 -08:00
|
|
|
gn_args.append('enable_stripping=true')
|
|
|
|
|
else:
|
|
|
|
|
raise ValueError('Build type "%s" is not supported.' % build_type)
|
|
|
|
|
|
2017-02-16 01:40:59 -08:00
|
|
|
args_string = ' '.join(gn_args + extra_gn_args)
|
|
|
|
|
logging.info('Building WebRTC with args: %s', args_string)
|
2017-02-15 13:18:57 -08:00
|
|
|
|
2017-02-16 01:40:59 -08:00
|
|
|
cmd = ['gn', 'gen', output_dir, '--args=' + args_string]
|
2017-02-06 07:53:41 -08:00
|
|
|
_RunCommand(cmd)
|
|
|
|
|
logging.info('Building target: %s', gn_target_name)
|
2017-02-15 13:18:57 -08:00
|
|
|
|
2017-02-06 07:53:41 -08:00
|
|
|
cmd = ['ninja', '-C', output_dir, gn_target_name]
|
2017-02-15 13:18:57 -08:00
|
|
|
if use_goma:
|
|
|
|
|
cmd.extend(['-j', '200'])
|
2017-02-06 07:53:41 -08:00
|
|
|
_RunCommand(cmd)
|
|
|
|
|
|
|
|
|
|
# Strip debug symbols to reduce size.
|
|
|
|
|
if build_type == 'static_only':
|
|
|
|
|
gn_target_path = os.path.join(output_dir, 'obj', 'webrtc', 'sdk',
|
|
|
|
|
'lib%s.a' % gn_target_name)
|
|
|
|
|
cmd = ['strip', '-S', gn_target_path, '-o',
|
|
|
|
|
os.path.join(output_dir, 'lib%s.a' % gn_target_name)]
|
|
|
|
|
_RunCommand(cmd)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
args = _ParseArgs()
|
|
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO)
|
|
|
|
|
|
|
|
|
|
if args.clean:
|
|
|
|
|
_CleanArtifacts(args.output_dir)
|
|
|
|
|
return 0
|
|
|
|
|
|
2017-02-13 08:30:01 -08:00
|
|
|
architectures = list(args.arch)
|
2017-03-14 03:12:35 -07:00
|
|
|
|
|
|
|
|
if args.purify:
|
|
|
|
|
_CleanTemporary(args.output_dir, architectures)
|
|
|
|
|
return 0
|
|
|
|
|
|
2017-02-13 08:30:01 -08:00
|
|
|
# Ignoring x86 except for static libraries for now because of a GN build issue
|
|
|
|
|
# where the generated dynamic framework has the wrong architectures.
|
|
|
|
|
if 'x86' in architectures and args.build_type != 'static_only':
|
|
|
|
|
architectures.remove('x86')
|
|
|
|
|
|
2017-02-06 07:53:41 -08:00
|
|
|
# Build all architectures.
|
2017-02-13 08:30:01 -08:00
|
|
|
for arch in architectures:
|
2017-02-06 07:53:41 -08:00
|
|
|
BuildWebRTC(args.output_dir, arch, args.build_config, args.build_type,
|
|
|
|
|
IOS_DEPLOYMENT_TARGET, LIBVPX_BUILD_VP9, args.bitcode,
|
2017-02-13 04:59:27 -08:00
|
|
|
args.use_goma, args.extra_gn_args)
|
2017-02-06 07:53:41 -08:00
|
|
|
|
|
|
|
|
# Create FAT archive.
|
|
|
|
|
if args.build_type == 'static_only':
|
2017-02-13 08:30:01 -08:00
|
|
|
lib_paths = [os.path.join(args.output_dir, arch + '_libs', SDK_LIB_NAME)
|
|
|
|
|
for arch in architectures]
|
|
|
|
|
out_lib_path = os.path.join(args.output_dir, SDK_LIB_NAME)
|
2017-02-06 07:53:41 -08:00
|
|
|
# Combine the slices.
|
2017-02-13 08:30:01 -08:00
|
|
|
cmd = ['lipo'] + lib_paths + ['-create', '-output', out_lib_path]
|
2017-02-06 07:53:41 -08:00
|
|
|
_RunCommand(cmd)
|
|
|
|
|
|
|
|
|
|
elif args.build_type == 'framework':
|
2017-02-13 08:30:01 -08:00
|
|
|
lib_paths = [os.path.join(args.output_dir, arch + '_libs')
|
|
|
|
|
for arch in architectures]
|
2017-02-06 07:53:41 -08:00
|
|
|
|
|
|
|
|
# Combine the slices.
|
|
|
|
|
dylib_path = os.path.join(SDK_FRAMEWORK_NAME, 'WebRTC')
|
2017-02-13 08:30:01 -08:00
|
|
|
# Dylibs will be combined, all other files are the same across archs.
|
2017-02-06 07:53:41 -08:00
|
|
|
# Use distutils instead of shutil to support merging folders.
|
|
|
|
|
distutils.dir_util.copy_tree(
|
2017-02-13 08:30:01 -08:00
|
|
|
os.path.join(lib_paths[0], SDK_FRAMEWORK_NAME),
|
2017-02-06 07:53:41 -08:00
|
|
|
os.path.join(args.output_dir, SDK_FRAMEWORK_NAME))
|
Revert of Do not produce dSYM file for the iOS Frameworks with bitcode (patchset #2 id:20001 of https://codereview.webrtc.org/2705163007/ )
Reason for revert:
Looks like this caused the iOS API Framework Builder to fail.
https://build.chromium.org/p/client.webrtc/builders/iOS%20API%20Framework%20Builder/builds/3487/steps/zip%20archive/logs/stdio
Zipping /b/rr/tmpkIyP1e/w/webrtc_ios_api_framework.zip...
Traceback (most recent call last):
File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 144, in <module>
sys.exit(main())
File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 130, in main
exit_code = zip_with_subprocess(root, output, entries)
File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 43, in zip_with_subprocess
assert os.path.isdir(path), path
AssertionError: /b/c/b/iOS_API_Framework_Builder/src/out_ios_libs/WebRTC.dSYM/
step returned non-zero exit code: 1
@@@STEP_FAILURE@@@
Original issue's description:
> Do not produce dSYM file for the iOS Frameworks with bitcode
>
> Though dSYM files can be generated when building applications or libraries
> with bitcode. They cannot be used to symbolicate crash reports from
> applications. Instead, developers need to grab the real dSYM files, which
> are generated for each specific device type after uploading an iOS / tvOS
> application to App Store (or to a device using Xcode). Apple clearly warns
> about it in its documentation:
>
> https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATION-BITCODE
>
> With that in mind, I believe that it would be better to not confuse
> developers by giving them dSYM files that are not very helpful with
> the bitcode-enabled framework. Thus, proposing the following modification
> to the building script, to generate dSYM by default only without
> the bitcode option. However, if some developers still want to get
> the dSYM files as a build-process artifact, when enabling bitcode,
> they can explicitly add --extra-gn-args enable_dsyms=true to the script.
>
> Let me know if it lgty.
>
> NOTRY=True
> BUG=None
>
> Review-Url: https://codereview.webrtc.org/2705163007
> Cr-Commit-Position: refs/heads/master@{#16836}
> Committed: https://chromium.googlesource.com/external/webrtc/+/d74517c52a6cd4172b1f3fdc4e624b6145ff5a0f
TBR=kjellander@webrtc.org,kthelgason@webrtc.org,VladimirTechMan@gmail.com
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=None
NOTRY=True
Review-Url: https://codereview.webrtc.org/2719773002
Cr-Commit-Position: refs/heads/master@{#16844}
2017-02-26 06:39:07 -08:00
|
|
|
logging.info('Merging framework slices.')
|
|
|
|
|
dylib_paths = [os.path.join(path, dylib_path) for path in lib_paths]
|
|
|
|
|
out_dylib_path = os.path.join(args.output_dir, dylib_path)
|
|
|
|
|
try:
|
Reland of Do not produce dSYM file for the iOS Frameworks with bitcode (patchset #1 id:1 of https://codereview.webrtc.org/2719773002/ )
Reason for revert:
Fixing issues with the framework builder.
Original issue's description:
> Revert of Do not produce dSYM file for the iOS Frameworks with bitcode (patchset #2 id:20001 of https://codereview.webrtc.org/2705163007/ )
>
> Reason for revert:
> Looks like this caused the iOS API Framework Builder to fail.
>
> https://build.chromium.org/p/client.webrtc/builders/iOS%20API%20Framework%20Builder/builds/3487/steps/zip%20archive/logs/stdio
>
> Zipping /b/rr/tmpkIyP1e/w/webrtc_ios_api_framework.zip...
> Traceback (most recent call last):
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 144, in <module>
> sys.exit(main())
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 130, in main
> exit_code = zip_with_subprocess(root, output, entries)
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 43, in zip_with_subprocess
> assert os.path.isdir(path), path
> AssertionError: /b/c/b/iOS_API_Framework_Builder/src/out_ios_libs/WebRTC.dSYM/
> step returned non-zero exit code: 1
> @@@STEP_FAILURE@@@
>
> Original issue's description:
> > Do not produce dSYM file for the iOS Frameworks with bitcode
> >
> > Though dSYM files can be generated when building applications or libraries
> > with bitcode. They cannot be used to symbolicate crash reports from
> > applications. Instead, developers need to grab the real dSYM files, which
> > are generated for each specific device type after uploading an iOS / tvOS
> > application to App Store (or to a device using Xcode). Apple clearly warns
> > about it in its documentation:
> >
> > https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATION-BITCODE
> >
> > With that in mind, I believe that it would be better to not confuse
> > developers by giving them dSYM files that are not very helpful with
> > the bitcode-enabled framework. Thus, proposing the following modification
> > to the building script, to generate dSYM by default only without
> > the bitcode option. However, if some developers still want to get
> > the dSYM files as a build-process artifact, when enabling bitcode,
> > they can explicitly add --extra-gn-args enable_dsyms=true to the script.
> >
> > Let me know if it lgty.
> >
> > NOTRY=True
> > BUG=None
> >
> > Review-Url: https://codereview.webrtc.org/2705163007
> > Cr-Commit-Position: refs/heads/master@{#16836}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/d74517c52a6cd4172b1f3fdc4e624b6145ff5a0f
>
> TBR=kjellander@webrtc.org,kthelgason@webrtc.org,VladimirTechMan@gmail.com
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=None
> NOTRY=True
>
> Review-Url: https://codereview.webrtc.org/2719773002
> Cr-Commit-Position: refs/heads/master@{#16844}
> Committed: https://chromium.googlesource.com/external/webrtc/+/da00077cfac335503b3335d5eac110f2f5bff408
TBR=kjellander@webrtc.org,vladimirtechman@gmail.com,tommi@webrtc.org
NOTRY=true
BUG=None
Review-Url: https://codereview.webrtc.org/2718983002
Cr-Commit-Position: refs/heads/master@{#16924}
2017-02-28 15:33:26 -08:00
|
|
|
os.remove(out_dylib_path)
|
Revert of Do not produce dSYM file for the iOS Frameworks with bitcode (patchset #2 id:20001 of https://codereview.webrtc.org/2705163007/ )
Reason for revert:
Looks like this caused the iOS API Framework Builder to fail.
https://build.chromium.org/p/client.webrtc/builders/iOS%20API%20Framework%20Builder/builds/3487/steps/zip%20archive/logs/stdio
Zipping /b/rr/tmpkIyP1e/w/webrtc_ios_api_framework.zip...
Traceback (most recent call last):
File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 144, in <module>
sys.exit(main())
File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 130, in main
exit_code = zip_with_subprocess(root, output, entries)
File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 43, in zip_with_subprocess
assert os.path.isdir(path), path
AssertionError: /b/c/b/iOS_API_Framework_Builder/src/out_ios_libs/WebRTC.dSYM/
step returned non-zero exit code: 1
@@@STEP_FAILURE@@@
Original issue's description:
> Do not produce dSYM file for the iOS Frameworks with bitcode
>
> Though dSYM files can be generated when building applications or libraries
> with bitcode. They cannot be used to symbolicate crash reports from
> applications. Instead, developers need to grab the real dSYM files, which
> are generated for each specific device type after uploading an iOS / tvOS
> application to App Store (or to a device using Xcode). Apple clearly warns
> about it in its documentation:
>
> https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATION-BITCODE
>
> With that in mind, I believe that it would be better to not confuse
> developers by giving them dSYM files that are not very helpful with
> the bitcode-enabled framework. Thus, proposing the following modification
> to the building script, to generate dSYM by default only without
> the bitcode option. However, if some developers still want to get
> the dSYM files as a build-process artifact, when enabling bitcode,
> they can explicitly add --extra-gn-args enable_dsyms=true to the script.
>
> Let me know if it lgty.
>
> NOTRY=True
> BUG=None
>
> Review-Url: https://codereview.webrtc.org/2705163007
> Cr-Commit-Position: refs/heads/master@{#16836}
> Committed: https://chromium.googlesource.com/external/webrtc/+/d74517c52a6cd4172b1f3fdc4e624b6145ff5a0f
TBR=kjellander@webrtc.org,kthelgason@webrtc.org,VladimirTechMan@gmail.com
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=None
NOTRY=True
Review-Url: https://codereview.webrtc.org/2719773002
Cr-Commit-Position: refs/heads/master@{#16844}
2017-02-26 06:39:07 -08:00
|
|
|
except OSError:
|
|
|
|
|
pass
|
Reland of Do not produce dSYM file for the iOS Frameworks with bitcode (patchset #1 id:1 of https://codereview.webrtc.org/2719773002/ )
Reason for revert:
Fixing issues with the framework builder.
Original issue's description:
> Revert of Do not produce dSYM file for the iOS Frameworks with bitcode (patchset #2 id:20001 of https://codereview.webrtc.org/2705163007/ )
>
> Reason for revert:
> Looks like this caused the iOS API Framework Builder to fail.
>
> https://build.chromium.org/p/client.webrtc/builders/iOS%20API%20Framework%20Builder/builds/3487/steps/zip%20archive/logs/stdio
>
> Zipping /b/rr/tmpkIyP1e/w/webrtc_ios_api_framework.zip...
> Traceback (most recent call last):
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 144, in <module>
> sys.exit(main())
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 130, in main
> exit_code = zip_with_subprocess(root, output, entries)
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 43, in zip_with_subprocess
> assert os.path.isdir(path), path
> AssertionError: /b/c/b/iOS_API_Framework_Builder/src/out_ios_libs/WebRTC.dSYM/
> step returned non-zero exit code: 1
> @@@STEP_FAILURE@@@
>
> Original issue's description:
> > Do not produce dSYM file for the iOS Frameworks with bitcode
> >
> > Though dSYM files can be generated when building applications or libraries
> > with bitcode. They cannot be used to symbolicate crash reports from
> > applications. Instead, developers need to grab the real dSYM files, which
> > are generated for each specific device type after uploading an iOS / tvOS
> > application to App Store (or to a device using Xcode). Apple clearly warns
> > about it in its documentation:
> >
> > https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATION-BITCODE
> >
> > With that in mind, I believe that it would be better to not confuse
> > developers by giving them dSYM files that are not very helpful with
> > the bitcode-enabled framework. Thus, proposing the following modification
> > to the building script, to generate dSYM by default only without
> > the bitcode option. However, if some developers still want to get
> > the dSYM files as a build-process artifact, when enabling bitcode,
> > they can explicitly add --extra-gn-args enable_dsyms=true to the script.
> >
> > Let me know if it lgty.
> >
> > NOTRY=True
> > BUG=None
> >
> > Review-Url: https://codereview.webrtc.org/2705163007
> > Cr-Commit-Position: refs/heads/master@{#16836}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/d74517c52a6cd4172b1f3fdc4e624b6145ff5a0f
>
> TBR=kjellander@webrtc.org,kthelgason@webrtc.org,VladimirTechMan@gmail.com
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=None
> NOTRY=True
>
> Review-Url: https://codereview.webrtc.org/2719773002
> Cr-Commit-Position: refs/heads/master@{#16844}
> Committed: https://chromium.googlesource.com/external/webrtc/+/da00077cfac335503b3335d5eac110f2f5bff408
TBR=kjellander@webrtc.org,vladimirtechman@gmail.com,tommi@webrtc.org
NOTRY=true
BUG=None
Review-Url: https://codereview.webrtc.org/2718983002
Cr-Commit-Position: refs/heads/master@{#16924}
2017-02-28 15:33:26 -08:00
|
|
|
cmd = ['lipo'] + dylib_paths + ['-create', '-output', out_dylib_path]
|
Revert of Do not produce dSYM file for the iOS Frameworks with bitcode (patchset #2 id:20001 of https://codereview.webrtc.org/2705163007/ )
Reason for revert:
Looks like this caused the iOS API Framework Builder to fail.
https://build.chromium.org/p/client.webrtc/builders/iOS%20API%20Framework%20Builder/builds/3487/steps/zip%20archive/logs/stdio
Zipping /b/rr/tmpkIyP1e/w/webrtc_ios_api_framework.zip...
Traceback (most recent call last):
File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 144, in <module>
sys.exit(main())
File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 130, in main
exit_code = zip_with_subprocess(root, output, entries)
File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 43, in zip_with_subprocess
assert os.path.isdir(path), path
AssertionError: /b/c/b/iOS_API_Framework_Builder/src/out_ios_libs/WebRTC.dSYM/
step returned non-zero exit code: 1
@@@STEP_FAILURE@@@
Original issue's description:
> Do not produce dSYM file for the iOS Frameworks with bitcode
>
> Though dSYM files can be generated when building applications or libraries
> with bitcode. They cannot be used to symbolicate crash reports from
> applications. Instead, developers need to grab the real dSYM files, which
> are generated for each specific device type after uploading an iOS / tvOS
> application to App Store (or to a device using Xcode). Apple clearly warns
> about it in its documentation:
>
> https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATION-BITCODE
>
> With that in mind, I believe that it would be better to not confuse
> developers by giving them dSYM files that are not very helpful with
> the bitcode-enabled framework. Thus, proposing the following modification
> to the building script, to generate dSYM by default only without
> the bitcode option. However, if some developers still want to get
> the dSYM files as a build-process artifact, when enabling bitcode,
> they can explicitly add --extra-gn-args enable_dsyms=true to the script.
>
> Let me know if it lgty.
>
> NOTRY=True
> BUG=None
>
> Review-Url: https://codereview.webrtc.org/2705163007
> Cr-Commit-Position: refs/heads/master@{#16836}
> Committed: https://chromium.googlesource.com/external/webrtc/+/d74517c52a6cd4172b1f3fdc4e624b6145ff5a0f
TBR=kjellander@webrtc.org,kthelgason@webrtc.org,VladimirTechMan@gmail.com
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=None
NOTRY=True
Review-Url: https://codereview.webrtc.org/2719773002
Cr-Commit-Position: refs/heads/master@{#16844}
2017-02-26 06:39:07 -08:00
|
|
|
_RunCommand(cmd)
|
2017-02-25 02:08:27 -08:00
|
|
|
|
Reland of Do not produce dSYM file for the iOS Frameworks with bitcode (patchset #1 id:1 of https://codereview.webrtc.org/2719773002/ )
Reason for revert:
Fixing issues with the framework builder.
Original issue's description:
> Revert of Do not produce dSYM file for the iOS Frameworks with bitcode (patchset #2 id:20001 of https://codereview.webrtc.org/2705163007/ )
>
> Reason for revert:
> Looks like this caused the iOS API Framework Builder to fail.
>
> https://build.chromium.org/p/client.webrtc/builders/iOS%20API%20Framework%20Builder/builds/3487/steps/zip%20archive/logs/stdio
>
> Zipping /b/rr/tmpkIyP1e/w/webrtc_ios_api_framework.zip...
> Traceback (most recent call last):
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 144, in <module>
> sys.exit(main())
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 130, in main
> exit_code = zip_with_subprocess(root, output, entries)
> File "/b/rr/tmpkIyP1e/rw/checkout/scripts/slave/recipe_modules/zip/resources/zip.py", line 43, in zip_with_subprocess
> assert os.path.isdir(path), path
> AssertionError: /b/c/b/iOS_API_Framework_Builder/src/out_ios_libs/WebRTC.dSYM/
> step returned non-zero exit code: 1
> @@@STEP_FAILURE@@@
>
> Original issue's description:
> > Do not produce dSYM file for the iOS Frameworks with bitcode
> >
> > Though dSYM files can be generated when building applications or libraries
> > with bitcode. They cannot be used to symbolicate crash reports from
> > applications. Instead, developers need to grab the real dSYM files, which
> > are generated for each specific device type after uploading an iOS / tvOS
> > application to App Store (or to a device using Xcode). Apple clearly warns
> > about it in its documentation:
> >
> > https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATION-BITCODE
> >
> > With that in mind, I believe that it would be better to not confuse
> > developers by giving them dSYM files that are not very helpful with
> > the bitcode-enabled framework. Thus, proposing the following modification
> > to the building script, to generate dSYM by default only without
> > the bitcode option. However, if some developers still want to get
> > the dSYM files as a build-process artifact, when enabling bitcode,
> > they can explicitly add --extra-gn-args enable_dsyms=true to the script.
> >
> > Let me know if it lgty.
> >
> > NOTRY=True
> > BUG=None
> >
> > Review-Url: https://codereview.webrtc.org/2705163007
> > Cr-Commit-Position: refs/heads/master@{#16836}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/d74517c52a6cd4172b1f3fdc4e624b6145ff5a0f
>
> TBR=kjellander@webrtc.org,kthelgason@webrtc.org,VladimirTechMan@gmail.com
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=None
> NOTRY=True
>
> Review-Url: https://codereview.webrtc.org/2719773002
> Cr-Commit-Position: refs/heads/master@{#16844}
> Committed: https://chromium.googlesource.com/external/webrtc/+/da00077cfac335503b3335d5eac110f2f5bff408
TBR=kjellander@webrtc.org,vladimirtechman@gmail.com,tommi@webrtc.org
NOTRY=true
BUG=None
Review-Url: https://codereview.webrtc.org/2718983002
Cr-Commit-Position: refs/heads/master@{#16924}
2017-02-28 15:33:26 -08:00
|
|
|
# Merge the dSYM slices.
|
|
|
|
|
lib_dsym_dir_path = os.path.join(lib_paths[0], 'WebRTC.dSYM')
|
|
|
|
|
if os.path.isdir(lib_dsym_dir_path):
|
|
|
|
|
distutils.dir_util.copy_tree(lib_dsym_dir_path,
|
|
|
|
|
os.path.join(args.output_dir, 'WebRTC.dSYM'))
|
|
|
|
|
logging.info('Merging dSYM slices.')
|
|
|
|
|
dsym_path = os.path.join('WebRTC.dSYM', 'Contents', 'Resources', 'DWARF',
|
|
|
|
|
'WebRTC')
|
|
|
|
|
lib_dsym_paths = [os.path.join(path, dsym_path) for path in lib_paths]
|
|
|
|
|
out_dsym_path = os.path.join(args.output_dir, dsym_path)
|
|
|
|
|
try:
|
|
|
|
|
os.remove(out_dsym_path)
|
|
|
|
|
except OSError:
|
|
|
|
|
pass
|
|
|
|
|
cmd = ['lipo'] + lib_dsym_paths + ['-create', '-output', out_dsym_path]
|
|
|
|
|
_RunCommand(cmd)
|
|
|
|
|
|
2017-03-13 08:05:59 -07:00
|
|
|
# Generate the license file.
|
|
|
|
|
license_script_path = os.path.join(SCRIPT_DIR, 'generate_licenses.py')
|
|
|
|
|
ninja_dirs = [os.path.join(args.output_dir, arch + '_libs')
|
|
|
|
|
for arch in architectures]
|
|
|
|
|
gn_target_full_name = '//webrtc/sdk:rtc_sdk_framework_objc'
|
|
|
|
|
cmd = [sys.executable, license_script_path, gn_target_full_name,
|
|
|
|
|
os.path.join(args.output_dir, SDK_FRAMEWORK_NAME)] + ninja_dirs
|
|
|
|
|
_RunCommand(cmd)
|
|
|
|
|
|
2017-02-06 07:53:41 -08:00
|
|
|
# Modify the version number.
|
|
|
|
|
# Format should be <Branch cut MXX>.<Hotfix #>.<Rev #>.
|
|
|
|
|
# e.g. 55.0.14986 means branch cut 55, no hotfixes, and revision 14986.
|
|
|
|
|
infoplist_path = os.path.join(args.output_dir, SDK_FRAMEWORK_NAME,
|
|
|
|
|
'Info.plist')
|
|
|
|
|
cmd = ['PlistBuddy', '-c',
|
|
|
|
|
'Print :CFBundleShortVersionString', infoplist_path]
|
|
|
|
|
major_minor = subprocess.check_output(cmd).strip()
|
|
|
|
|
version_number = '%s.%s' % (major_minor, args.revision)
|
|
|
|
|
logging.info('Substituting revision number: %s', version_number)
|
|
|
|
|
cmd = ['PlistBuddy', '-c',
|
|
|
|
|
'Set :CFBundleVersion ' + version_number, infoplist_path]
|
|
|
|
|
_RunCommand(cmd)
|
|
|
|
|
_RunCommand(['plutil', '-convert', 'binary1', infoplist_path])
|
|
|
|
|
|
|
|
|
|
logging.info('Done.')
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
sys.exit(main())
|