Convert ios_web_shell_test to GN.
BUG=629867 Review-Url: https://codereview.chromium.org/2173493002 Cr-Original-Commit-Position: refs/heads/master@{#407159} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: cdf365d050f4d1a86c42818b3e1f760eedfc4315
This commit is contained in:
Родитель
a4bdac6663
Коммит
b4e1962bf6
|
@ -41,3 +41,18 @@ config("runtime_library") {
|
|||
config("ios_dynamic_flags") {
|
||||
ldflags = [ "-Wl,-ObjC" ] # Always load Objective-C categories and class.
|
||||
}
|
||||
|
||||
config("xctest_config") {
|
||||
common_flags = [
|
||||
"-F",
|
||||
"$ios_sdk_platform_path/Developer/Library/Frameworks",
|
||||
]
|
||||
|
||||
cflags = common_flags
|
||||
ldflags = common_flags
|
||||
|
||||
libs = [
|
||||
"Foundation.framework",
|
||||
"XCTest.framework",
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.chromium.test.ios_web_shell_test_host</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UILaunchImages</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UILaunchImageMinimumOSVersion</key>
|
||||
<string>7.0</string>
|
||||
<key>UILaunchImageName</key>
|
||||
<string>Default</string>
|
||||
<key>UILaunchImageOrientation</key>
|
||||
<string>Portrait</string>
|
||||
<key>UILaunchImageSize</key>
|
||||
<string>{320, 480}</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UILaunchImageMinimumOSVersion</key>
|
||||
<string>7.0</string>
|
||||
<key>UILaunchImageName</key>
|
||||
<string>Default</string>
|
||||
<key>UILaunchImageOrientation</key>
|
||||
<string>Portrait</string>
|
||||
<key>UILaunchImageSize</key>
|
||||
<string>{320, 568}</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UILaunchImageMinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
<key>UILaunchImageName</key>
|
||||
<string>Default</string>
|
||||
<key>UILaunchImageOrientation</key>
|
||||
<string>Portrait</string>
|
||||
<key>UILaunchImageSize</key>
|
||||
<string>{375, 667}</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UILaunchImageMinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
<key>UILaunchImageName</key>
|
||||
<string>Default</string>
|
||||
<key>UILaunchImageOrientation</key>
|
||||
<string>Portrait</string>
|
||||
<key>UILaunchImageSize</key>
|
||||
<string>{414, 736}</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UILaunchImageMinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
<key>UILaunchImageName</key>
|
||||
<string>Default</string>
|
||||
<key>UILaunchImageOrientation</key>
|
||||
<string>Landscape</string>
|
||||
<key>UILaunchImageSize</key>
|
||||
<string>{414, 736}</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>UILaunchImages~ipad</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UILaunchImageMinimumOSVersion</key>
|
||||
<string>7.0</string>
|
||||
<key>UILaunchImageName</key>
|
||||
<string>Default</string>
|
||||
<key>UILaunchImageOrientation</key>
|
||||
<string>Portrait</string>
|
||||
<key>UILaunchImageSize</key>
|
||||
<string>{768, 1024}</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UILaunchImageMinimumOSVersion</key>
|
||||
<string>7.0</string>
|
||||
<key>UILaunchImageName</key>
|
||||
<string>Default</string>
|
||||
<key>UILaunchImageOrientation</key>
|
||||
<string>Landscape</string>
|
||||
<key>UILaunchImageSize</key>
|
||||
<string>{768, 1024}</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.chromium.test.ios_web_shell_test_host.ios_web_shell_test</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -206,7 +206,21 @@ def FindProvisioningProfile(bundle, provisioning_profile_short_name):
|
|||
key=lambda p: len(p.application_identifier_pattern))
|
||||
|
||||
|
||||
def CodeSignBundle(binary, bundle, args):
|
||||
def InstallFramework(framework_path, bundle, args):
|
||||
"""Install framework from |framework_path| to |bundle| and code-re-sign it."""
|
||||
installed_framework_path = os.path.join(
|
||||
bundle.path, 'Frameworks', os.path.basename(framework_path))
|
||||
|
||||
if os.path.exists(installed_framework_path):
|
||||
shutil.rmtree(installed_framework_path)
|
||||
|
||||
shutil.copytree(framework_path, installed_framework_path)
|
||||
|
||||
framework_bundle = Bundle(installed_framework_path)
|
||||
CodeSignBundle(framework_bundle.binary_path, framework_bundle, args, True)
|
||||
|
||||
|
||||
def CodeSignBundle(binary, bundle, args, preserve=False):
|
||||
"""Cryptographically signs bundle.
|
||||
|
||||
Args:
|
||||
|
@ -219,18 +233,29 @@ def CodeSignBundle(binary, bundle, args):
|
|||
bundle, args.provisioning_profile_short_name)
|
||||
provisioning_profile.Install(bundle)
|
||||
|
||||
signature_file = os.path.join(bundle.path, '_CodeSignature', 'CodeResources')
|
||||
if os.path.isfile(signature_file):
|
||||
os.unlink(signature_file)
|
||||
|
||||
shutil.copy(binary, bundle.binary_path)
|
||||
|
||||
if args.preserve:
|
||||
subprocess.check_call([
|
||||
if preserve:
|
||||
process = subprocess.Popen([
|
||||
'xcrun', 'codesign', '--force', '--sign', args.identity,
|
||||
'--deep', '--preserve-metadata=identifier,entitlements',
|
||||
'--timestamp=none', bundle.path])
|
||||
'--timestamp=none', bundle.path], stderr=subprocess.PIPE)
|
||||
_, stderr = process.communicate()
|
||||
if process.returncode:
|
||||
sys.stderr.write(stderr)
|
||||
sys.exit(process.returncode)
|
||||
for line in stderr.splitlines():
|
||||
# Ignore expected warning as we are replacing the signature on purpose.
|
||||
if not line.endswith(': replacing existing signature'):
|
||||
sys.stderr.write(line + '\n')
|
||||
else:
|
||||
signature_file = os.path.join(
|
||||
bundle.path, '_CodeSignature', 'CodeResources')
|
||||
if os.path.isfile(signature_file):
|
||||
os.unlink(signature_file)
|
||||
|
||||
if os.path.isfile(bundle.binary_path):
|
||||
os.unlink(bundle.binary_path)
|
||||
shutil.copy(binary, bundle.binary_path)
|
||||
|
||||
entitlements = Entitlements(args.entitlements_path)
|
||||
entitlements.LoadDefaults(provisioning_profile.entitlements)
|
||||
entitlements.ExpandVariables({
|
||||
|
@ -261,16 +286,19 @@ def Main():
|
|||
parser.add_argument(
|
||||
'--identity', '-i', required=True,
|
||||
help='identity to use to codesign')
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument(
|
||||
parser.add_argument(
|
||||
'--entitlements', '-e', dest='entitlements_path',
|
||||
help='path to the entitlements file to use')
|
||||
group.add_argument(
|
||||
'--deep', '-d', action='store_true', default=False, dest='preserve',
|
||||
help='deep signature (default: %(default)s)')
|
||||
parser.add_argument(
|
||||
'--framework', '-F', action='append', default=[], dest="frameworks",
|
||||
help='install and resign system framework')
|
||||
args = parser.parse_args()
|
||||
|
||||
CodeSignBundle(args.binary, Bundle(args.path), args)
|
||||
bundle = Bundle(args.path)
|
||||
for framework in args.frameworks:
|
||||
InstallFramework(framework, bundle, args)
|
||||
|
||||
CodeSignBundle(args.binary, bundle, args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -160,6 +160,7 @@ template("ios_app_bundle") {
|
|||
[
|
||||
"bundle_deps",
|
||||
"bundle_extension",
|
||||
"extra_system_frameworks",
|
||||
"entitlements_path",
|
||||
"extra_substitutions",
|
||||
"info_plist",
|
||||
|
@ -239,6 +240,7 @@ template("ios_app_bundle") {
|
|||
[
|
||||
"bundle_deps",
|
||||
"bundle_extension",
|
||||
"extra_system_frameworks",
|
||||
"data_deps",
|
||||
"entitlements_path",
|
||||
"extra_substitutions",
|
||||
|
@ -358,6 +360,16 @@ template("ios_app_bundle") {
|
|||
}
|
||||
}
|
||||
|
||||
if (!ios_enable_code_signing && defined(invoker.extra_system_frameworks)) {
|
||||
bundle_data(_target_name + "_extra_system_frameworks") {
|
||||
visibility = [ ":$_target_name" ]
|
||||
sources = invoker.extra_system_frameworks
|
||||
outputs = [
|
||||
"{{bundle_resources_dir}}/Frameworks/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
create_bundle(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
|
@ -380,6 +392,9 @@ template("ios_app_bundle") {
|
|||
}
|
||||
} else {
|
||||
deps += [ ":$_bundle_data_executable" ]
|
||||
if (defined(invoker.extra_system_frameworks)) {
|
||||
deps += [ ":${_target_name}_extra_system_frameworks" ]
|
||||
}
|
||||
}
|
||||
if (defined(invoker.bundle_deps)) {
|
||||
deps += invoker.bundle_deps
|
||||
|
@ -425,12 +440,26 @@ template("ios_app_bundle") {
|
|||
"$bundle_root_dir/_CodeSignature/CodeResources",
|
||||
"$bundle_root_dir/embedded.mobileprovision",
|
||||
]
|
||||
if (defined(invoker.extra_system_frameworks)) {
|
||||
foreach(_framework, invoker.extra_system_frameworks) {
|
||||
code_signing_outputs += [ "$bundle_root_dir/Frameworks/" +
|
||||
get_path_info(_framework, "name") ]
|
||||
}
|
||||
}
|
||||
code_signing_args = [
|
||||
"-i=" + ios_code_signing_identity,
|
||||
"-b=" + rebase_path("$target_out_dir/$_output_name", root_build_dir),
|
||||
"-e=" + rebase_path(_entitlements_path, root_build_dir),
|
||||
rebase_path(bundle_root_dir, root_build_dir),
|
||||
]
|
||||
if (defined(invoker.extra_system_frameworks)) {
|
||||
# All framework in extra_system_frameworks are expected to be
|
||||
# system framework and the path to be already system absolute
|
||||
# so do not use rebase_path here.
|
||||
foreach(_framework, invoker.extra_system_frameworks) {
|
||||
code_signing_args += [ "-F=" + _framework ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -776,12 +805,11 @@ template("ios_framework_bundle") {
|
|||
}
|
||||
|
||||
config(_framework_public_config) {
|
||||
visibility = [ ":$_framework_public_config" ]
|
||||
common_flags = [ "-F" + rebase_path("$root_out_dir/.", root_build_dir) ]
|
||||
cflags_objc = common_flags
|
||||
cflags_objcc = common_flags
|
||||
|
||||
# The link settings are inherited from the framework_bundle config.
|
||||
cflags = [
|
||||
"-F",
|
||||
rebase_path("$root_out_dir/.", root_build_dir),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -910,3 +938,281 @@ template("ios_framework_bundle") {
|
|||
set_defaults("ios_framework_bundle") {
|
||||
configs = default_shared_library_configs
|
||||
}
|
||||
|
||||
# For Chrome on iOS we want to run XCTests for all our build configurations
|
||||
# (Debug, Release, ...). In addition, the symbols visibility is configured to
|
||||
# private by default. To simplify testing with those constraints, our tests are
|
||||
# compiled in the TEST_HOST target instead of the .xctest bundle.
|
||||
template("ios_xctest_test") {
|
||||
_target_name = target_name
|
||||
_output_name = target_name
|
||||
if (defined(invoker.output_name)) {
|
||||
_output_name = invoker.output_name
|
||||
}
|
||||
|
||||
_is_fat_build = additional_toolchains != []
|
||||
if (_is_fat_build) {
|
||||
_is_fat_build_main_target = current_toolchain == default_toolchain
|
||||
}
|
||||
|
||||
_xctest_target = _target_name
|
||||
_xctest_output = _output_name
|
||||
|
||||
_host_target = _target_name + "_host"
|
||||
_host_output = _output_name + "_host"
|
||||
|
||||
if (_is_fat_build && !_is_fat_build_main_target) {
|
||||
loadable_module(_xctest_target) {
|
||||
visibility = [ ":${_xctest_target}_loadable_module($default_toolchain)" ]
|
||||
sources = [
|
||||
"//build/config/ios/xctest_shell.mm",
|
||||
]
|
||||
configs += [ "//build/config/ios:xctest_config" ]
|
||||
|
||||
output_name = _xctest_output
|
||||
output_extension = ""
|
||||
}
|
||||
} else {
|
||||
_xctest_info_plist_target = _xctest_target + "_info_plist"
|
||||
_xctest_info_plist_bundle = _xctest_target + "_info_plist_bundle"
|
||||
ios_info_plist(_xctest_info_plist_target) {
|
||||
visibility = [ ":$_xctest_info_plist_bundle" ]
|
||||
info_plist = "//build/config/ios/Module-Info.plist"
|
||||
executable_name = _output_name
|
||||
}
|
||||
|
||||
bundle_data(_xctest_info_plist_bundle) {
|
||||
visibility = [ ":$_xctest_target" ]
|
||||
public_deps = [
|
||||
":$_xctest_info_plist_target",
|
||||
]
|
||||
sources = get_target_outputs(":$_xctest_info_plist_target")
|
||||
outputs = [
|
||||
"{{bundle_root_dir}}/Info.plist",
|
||||
]
|
||||
}
|
||||
|
||||
_xctest_loadable_module_target = _xctest_target + "_loadable_module"
|
||||
_xctest_loadable_module_path = "$target_out_dir/$_xctest_output"
|
||||
|
||||
if (!ios_enable_code_signing) {
|
||||
_xctest_loadable_module_bundle =
|
||||
_xctest_target + "_loadable_module_bundle"
|
||||
_xctest_loadable_module_visibility =
|
||||
[ ":$_xctest_loadable_module_bundle" ]
|
||||
} else {
|
||||
_xctest_loadable_module_visibility = [ ":$_xctest_target" ]
|
||||
}
|
||||
|
||||
if (_is_fat_build) {
|
||||
_xctest_lipo_loadable_module_target = _xctest_loadable_module_target
|
||||
_xctest_lipo_loadable_module_visibility =
|
||||
_xctest_loadable_module_visibility
|
||||
_arch_xctest_loadable_module_path =
|
||||
"$target_out_dir/$current_cpu/$_xctest_output"
|
||||
|
||||
_xctest_loadable_module_visibility = []
|
||||
_xctest_loadable_module_visibility =
|
||||
[ ":$_xctest_lipo_loadable_module_target" ]
|
||||
_xctest_loadable_module_target = _xctest_target + "_arch_loadable_module"
|
||||
}
|
||||
|
||||
loadable_module(_xctest_loadable_module_target) {
|
||||
visibility = _xctest_loadable_module_visibility
|
||||
sources = [
|
||||
"//build/config/ios/xctest_shell.mm",
|
||||
]
|
||||
configs += [ "//build/config/ios:xctest_config" ]
|
||||
|
||||
if (_is_fat_build) {
|
||||
output_name =
|
||||
rebase_path(_arch_xctest_loadable_module_path, root_out_dir)
|
||||
} else {
|
||||
output_name = rebase_path(_xctest_loadable_module_path, root_out_dir)
|
||||
}
|
||||
|
||||
output_prefix_override = true
|
||||
output_extension = ""
|
||||
}
|
||||
|
||||
if (_is_fat_build) {
|
||||
action(_xctest_lipo_loadable_module_target) {
|
||||
visibility = _xctest_lipo_loadable_module_visibility
|
||||
script = "//build/toolchain/mac/linker_driver.py"
|
||||
outputs = [
|
||||
_xctest_loadable_module_path,
|
||||
]
|
||||
inputs = [
|
||||
_arch_xctest_loadable_module_path,
|
||||
]
|
||||
deps = [
|
||||
":$_xctest_loadable_module_target",
|
||||
]
|
||||
foreach(_additional_toolchain, additional_toolchains) {
|
||||
_additional_toolchain_target = "$_target_name($_additional_toolchain)"
|
||||
deps += [ ":$_additional_toolchain_target" ]
|
||||
inputs += [ get_label_info(_additional_toolchain_target,
|
||||
"root_out_dir") + "/$_xctest_output" ]
|
||||
}
|
||||
args = [
|
||||
"xcrun",
|
||||
"lipo",
|
||||
"-create",
|
||||
"-output",
|
||||
rebase_path(outputs[0], root_build_dir),
|
||||
] + rebase_path(inputs, root_build_dir)
|
||||
|
||||
if (enable_dsyms) {
|
||||
outputs += [ "$root_out_dir/$_xctest_output.dSYM/" ]
|
||||
args +=
|
||||
[ "-Wcrl,dsym," + rebase_path("$root_out_dir/.", root_build_dir) ]
|
||||
}
|
||||
|
||||
if (enable_stripping) {
|
||||
# Check whether //build/config/mac:strip_all has been removed from
|
||||
# the configs variable (as this is how stripping is disabled for a
|
||||
# single target).
|
||||
_strip_all_in_config = false
|
||||
if (defined(invoker.configs)) {
|
||||
foreach(_config, invoker.configs) {
|
||||
if (_config == "//build/config/mac:strip_all") {
|
||||
_strip_all_in_config = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_strip_all_in_config) {
|
||||
args += [ "-Wcrl,strip,-x,-S" ]
|
||||
|
||||
if (save_unstripped_output) {
|
||||
outputs += [ outputs[0] + ".unstripped" ]
|
||||
args += [ "-Wcrl,unstripped," +
|
||||
rebase_path(get_path_info(outputs[0], "dir"),
|
||||
root_build_dir) ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ios_enable_code_signing) {
|
||||
bundle_data(_xctest_loadable_module_bundle) {
|
||||
visibility = [ ":$_xctest_target" ]
|
||||
if (_is_fat_build) {
|
||||
public_deps = [
|
||||
":$_xctest_lipo_loadable_module_target",
|
||||
]
|
||||
} else {
|
||||
public_deps = [
|
||||
":$_xctest_loadable_module_target",
|
||||
]
|
||||
}
|
||||
sources = [
|
||||
"$target_out_dir/$_xctest_output",
|
||||
]
|
||||
outputs = [
|
||||
"{{bundle_root_dir}}/$_xctest_output",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
_xctest_bundle = _xctest_target + "_bundle"
|
||||
|
||||
create_bundle(_xctest_target) {
|
||||
visibility = [ ":$_xctest_bundle" ]
|
||||
product_type = "com.apple.product-type.bundle.unit-test"
|
||||
deps = [
|
||||
":$_xctest_info_plist_bundle",
|
||||
]
|
||||
bundle_root_dir = "$root_out_dir/$_xctest_output.xctest"
|
||||
|
||||
if (!ios_enable_code_signing) {
|
||||
deps += [ ":$_xctest_loadable_module_bundle" ]
|
||||
} else {
|
||||
if (_is_fat_build) {
|
||||
deps += [ ":$_xctest_lipo_loadable_module_target" ]
|
||||
} else {
|
||||
deps += [ ":$_xctest_loadable_module_target" ]
|
||||
}
|
||||
|
||||
_entitlements_path = "$ios_sdk_path/Entitlements.plist"
|
||||
if (defined(invoker.entitlements_path)) {
|
||||
_entitlements_path = invoker.entitlements_path
|
||||
}
|
||||
|
||||
code_signing_script = "//build/config/ios/codesign.py"
|
||||
code_signing_sources = [
|
||||
_entitlements_path,
|
||||
"$target_out_dir/$_xctest_output",
|
||||
]
|
||||
code_signing_outputs = [
|
||||
"$bundle_root_dir/$_xctest_output",
|
||||
"$bundle_root_dir/_CodeSignature/CodeResources",
|
||||
"$bundle_root_dir/embedded.mobileprovision",
|
||||
]
|
||||
code_signing_args = [
|
||||
"-i=" + ios_code_signing_identity,
|
||||
"-b=" +
|
||||
rebase_path("$target_out_dir/$_xctest_output", root_build_dir),
|
||||
"-e=" + rebase_path(_entitlements_path, root_build_dir),
|
||||
rebase_path(bundle_root_dir, root_build_dir),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
bundle_data(_xctest_bundle) {
|
||||
visibility = [ ":$_host_target" ]
|
||||
public_deps = [
|
||||
":$_xctest_target",
|
||||
]
|
||||
sources = [
|
||||
"$root_out_dir/$_xctest_output.xctest",
|
||||
]
|
||||
outputs = [
|
||||
"{{bundle_plugins_dir}}/$_xctest_output.xctest",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
ios_app_bundle(_host_target) {
|
||||
forward_variables_from(invoker, "*", [ "testonly" ])
|
||||
|
||||
testonly = true
|
||||
output_name = _host_output
|
||||
info_plist = "//build/config/ios/Host-Info.plist"
|
||||
configs += [ "//build/config/ios:xctest_config" ]
|
||||
|
||||
# Xcode needs those two framework installed in the application (and signed)
|
||||
# for the XCTest to run, so install them using extra_system_frameworks.
|
||||
_ios_platform_library = "$ios_sdk_platform_path/Developer/Library"
|
||||
extra_system_frameworks = [
|
||||
"$_ios_platform_library/Frameworks/XCTest.framework",
|
||||
"$_ios_platform_library/PrivateFrameworks/IDEBundleInjection.framework",
|
||||
]
|
||||
|
||||
if (!_is_fat_build || _is_fat_build_main_target) {
|
||||
if (!defined(bundle_deps)) {
|
||||
bundle_deps = []
|
||||
}
|
||||
bundle_deps += [ ":$_xctest_bundle" ]
|
||||
}
|
||||
|
||||
if (!defined(ldflags)) {
|
||||
ldflags = []
|
||||
}
|
||||
ldflags += [
|
||||
"-Xlinker",
|
||||
"-rpath",
|
||||
"-Xlinker",
|
||||
"@executable_path/Frameworks",
|
||||
"-Xlinker",
|
||||
"-rpath",
|
||||
"-Xlinker",
|
||||
"@loader_path/Frameworks",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
set_defaults("ios_xctest_test") {
|
||||
configs = default_executable_configs
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
// For Chrome on iOS we want to run EarlGrey tests (that are XCTests) for all
|
||||
// our build configurations (Debug, Release, ...). In addition, the symbols
|
||||
// visibility is configured to private by default. To simplify testing with
|
||||
// those constraints, our tests are compiled in the TEST_HOST target instead
|
||||
// of the .xctest bundle that all link against this single test (just there to
|
||||
// ensure that the bundle is not empty).
|
||||
|
||||
@interface XCTestShellEmptyClass : NSObject
|
||||
@end
|
||||
|
||||
@implementation XCTestShellEmptyClass
|
||||
@end
|
|
@ -245,6 +245,7 @@ template("framework_bundle") {
|
|||
[
|
||||
"assert_no_deps",
|
||||
"bundle_deps",
|
||||
"code_signing_enabled",
|
||||
"data_deps",
|
||||
"info_plist",
|
||||
"info_plist_target",
|
||||
|
@ -274,6 +275,12 @@ template("framework_bundle") {
|
|||
assert(invoker.bundle_deps != [], "mark bundle_deps as used")
|
||||
}
|
||||
} else {
|
||||
_code_signing_enabled = is_ios && ios_enable_code_signing
|
||||
if (defined(invoker.code_signing_enabled)) {
|
||||
_code_signing_enabled =
|
||||
invoker.code_signing_enabled && _code_signing_enabled
|
||||
}
|
||||
|
||||
# If the framework is unversioned, the final _target_name will be the
|
||||
# create_bundle(_framework_target), otherwise an action with the name
|
||||
# _target_name will depends on the the create_bundle() in order to prepare
|
||||
|
@ -288,8 +295,14 @@ template("framework_bundle") {
|
|||
}
|
||||
|
||||
_link_shared_library_target = target_name + "_shared_library"
|
||||
_shared_library_bundle_data = target_name + "_shared_library_bundle_data"
|
||||
_link_shared_library_visibility = [ ":$_shared_library_bundle_data" ]
|
||||
_shared_library_dir = "$target_out_dir/$_link_shared_library_target"
|
||||
|
||||
if (_code_signing_enabled) {
|
||||
_link_shared_library_visibility = [ ":$_framework_target" ]
|
||||
} else {
|
||||
_shared_library_bundle_data = target_name + "_shared_library_bundle_data"
|
||||
_link_shared_library_visibility = [ ":$_shared_library_bundle_data" ]
|
||||
}
|
||||
|
||||
if (_is_fat_build) {
|
||||
_lipo_shared_library_target = _link_shared_library_target
|
||||
|
@ -298,6 +311,9 @@ template("framework_bundle") {
|
|||
_link_shared_library_visibility = []
|
||||
_link_shared_library_visibility = [ ":$_lipo_shared_library_target" ]
|
||||
_link_shared_library_target = target_name + "_arch_shared_library"
|
||||
|
||||
_arch_shared_library_dir = "$target_out_dir/$_link_shared_library_target"
|
||||
_shared_library_dir = "$target_out_dir/$_lipo_shared_library_target"
|
||||
}
|
||||
|
||||
shared_library(_link_shared_library_target) {
|
||||
|
@ -306,6 +322,7 @@ template("framework_bundle") {
|
|||
[
|
||||
"assert_no_deps",
|
||||
"bundle_deps",
|
||||
"code_signing_enabled",
|
||||
"data_deps",
|
||||
"info_plist",
|
||||
"output_name",
|
||||
|
@ -315,7 +332,12 @@ template("framework_bundle") {
|
|||
output_name = _output_name
|
||||
output_prefix_override = true
|
||||
output_extension = ""
|
||||
output_dir = "$target_out_dir/$_link_shared_library_target"
|
||||
|
||||
if (!_is_fat_build) {
|
||||
output_dir = _shared_library_dir
|
||||
} else {
|
||||
output_dir = _arch_shared_library_dir
|
||||
}
|
||||
}
|
||||
|
||||
if (_is_fat_build) {
|
||||
|
@ -324,10 +346,10 @@ template("framework_bundle") {
|
|||
visibility = _lipo_shared_library_visibility
|
||||
script = "//build/toolchain/mac/linker_driver.py"
|
||||
outputs = [
|
||||
"$target_out_dir/$_lipo_shared_library_target/$_output_name",
|
||||
"$_shared_library_dir/$_output_name",
|
||||
]
|
||||
inputs = [
|
||||
"$target_out_dir/$_link_shared_library_target/$_output_name",
|
||||
"$_arch_shared_library_dir/$_output_name",
|
||||
]
|
||||
deps = [
|
||||
":$_link_shared_library_target",
|
||||
|
@ -379,26 +401,25 @@ template("framework_bundle") {
|
|||
}
|
||||
}
|
||||
|
||||
bundle_data(_shared_library_bundle_data) {
|
||||
visibility = [ ":$_framework_target" ]
|
||||
forward_variables_from(invoker, [ "testonly" ])
|
||||
outputs = [
|
||||
"{{bundle_executable_dir}}/$_output_name",
|
||||
]
|
||||
if (_is_fat_build) {
|
||||
if (!_code_signing_enabled) {
|
||||
bundle_data(_shared_library_bundle_data) {
|
||||
visibility = [ ":$_framework_target" ]
|
||||
forward_variables_from(invoker, [ "testonly" ])
|
||||
sources = [
|
||||
"$target_out_dir/$_lipo_shared_library_target/$_output_name",
|
||||
"$_shared_library_dir/$_output_name",
|
||||
]
|
||||
public_deps = [
|
||||
":$_lipo_shared_library_target",
|
||||
]
|
||||
} else {
|
||||
sources = [
|
||||
"$target_out_dir/$_link_shared_library_target/$_output_name",
|
||||
]
|
||||
public_deps = [
|
||||
":$_link_shared_library_target",
|
||||
outputs = [
|
||||
"{{bundle_executable_dir}}/$_output_name",
|
||||
]
|
||||
if (_is_fat_build) {
|
||||
public_deps = [
|
||||
":$_lipo_shared_library_target",
|
||||
]
|
||||
} else {
|
||||
public_deps = [
|
||||
":$_link_shared_library_target",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -407,7 +428,10 @@ template("framework_bundle") {
|
|||
# TODO(sdefresne): should we have a framework_dirs similar to lib_dirs
|
||||
# and include_dirs to avoid duplicate values on the command-line.
|
||||
visibility = [ ":$_framework_target" ]
|
||||
ldflags = [ "-F" + rebase_path("$root_out_dir/.", root_build_dir) ]
|
||||
ldflags = [
|
||||
"-F",
|
||||
rebase_path("$root_out_dir/.", root_build_dir),
|
||||
]
|
||||
lib_dirs = [ root_out_dir ]
|
||||
libs = [ _framework_name ]
|
||||
}
|
||||
|
@ -430,18 +454,58 @@ template("framework_bundle") {
|
|||
}
|
||||
}
|
||||
|
||||
if (!defined(public_deps)) {
|
||||
public_deps = []
|
||||
}
|
||||
public_deps += [ ":$_shared_library_bundle_data" ]
|
||||
if (!_code_signing_enabled) {
|
||||
if (!defined(public_deps)) {
|
||||
public_deps = []
|
||||
}
|
||||
public_deps += [ ":$_shared_library_bundle_data" ]
|
||||
|
||||
if (defined(invoker.bundle_deps)) {
|
||||
public_deps += invoker.bundle_deps
|
||||
if (defined(invoker.bundle_deps)) {
|
||||
if (!defined(deps)) {
|
||||
deps = []
|
||||
}
|
||||
deps += invoker.bundle_deps
|
||||
}
|
||||
}
|
||||
|
||||
bundle_root_dir = _framework_root_dir
|
||||
bundle_resources_dir = "$bundle_root_dir/Resources"
|
||||
bundle_executable_dir = "$bundle_root_dir"
|
||||
|
||||
if (_code_signing_enabled) {
|
||||
if (!defined(deps)) {
|
||||
deps = []
|
||||
}
|
||||
|
||||
if (_is_fat_build) {
|
||||
deps += [ ":$_lipo_shared_library_target" ]
|
||||
} else {
|
||||
deps += [ ":$_link_shared_library_target" ]
|
||||
}
|
||||
|
||||
_entitlements_path = "$ios_sdk_path/Entitlements.plist"
|
||||
if (defined(invoker.entitlements_path)) {
|
||||
_entitlements_path = invoker.entitlements_path
|
||||
}
|
||||
|
||||
code_signing_script = "//build/config/ios/codesign.py"
|
||||
code_signing_sources = [
|
||||
_entitlements_path,
|
||||
"$_shared_library_dir/$_output_name",
|
||||
]
|
||||
code_signing_outputs = [
|
||||
"$bundle_root_dir/$_output_name",
|
||||
"$bundle_root_dir/_CodeSignature/CodeResources",
|
||||
"$bundle_root_dir/embedded.mobileprovision",
|
||||
]
|
||||
code_signing_args = [
|
||||
"-i=" + ios_code_signing_identity,
|
||||
"-b=" +
|
||||
rebase_path("$_shared_library_dir/$_output_name", root_build_dir),
|
||||
"-e=" + rebase_path(_entitlements_path, root_build_dir),
|
||||
rebase_path(bundle_root_dir, root_build_dir),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (defined(_framework_version)) {
|
||||
|
@ -470,13 +534,17 @@ template("framework_bundle") {
|
|||
group(_target_name + "+link") {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"visibility",
|
||||
"public_configs",
|
||||
"testonly",
|
||||
"visibility",
|
||||
])
|
||||
public_deps = [
|
||||
":$_target_name",
|
||||
]
|
||||
public_configs = [ ":$_framework_public_config" ]
|
||||
if (!defined(public_configs)) {
|
||||
public_configs = []
|
||||
}
|
||||
public_configs += [ ":$_framework_public_config" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче