Updates to iOS build

* Enable data bundling for all test apps unless specifically disabled.
* Add support to bundle symbols so that the stack trace in Instruments
  is correct.

Bug: skia:7525
Change-Id: I5eef9fa21ecee8f790b0736f5e23c9d678e47bef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205001
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Stephan Altmueller <stephana@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Jim Van Verth 2019-04-02 11:59:34 -04:00 committed by Skia Commit-Bot
parent 8341568629
commit ffacf656c8
2 changed files with 46 additions and 36 deletions

View File

@ -1324,35 +1324,28 @@ if (skia_enable_tools) {
]
}
bundle_ios_data =
defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
if (bundle_ios_data) {
has_skps =
"True" == exec_script("//gn/checkdir.py",
[ rebase_path("skps", root_build_dir) ],
"trim string")
bundle_data("${app_name}_bundle_resources") {
has_skps = "True" == exec_script("//gn/checkdir.py",
[ rebase_path("skps", root_build_dir) ],
"trim string")
bundle_data("${app_name}_bundle_resources") {
sources = [
"resources",
]
outputs = [
# iOS reserves the folders 'Resources' and 'resources' so store one level deeper
"{{bundle_resources_dir}}/data/resources",
]
}
if (has_skps) {
bundle_data("${app_name}_bundle_skps") {
sources = [
"resources",
"skps",
]
outputs = [
# iOS reserves the folders 'Resources' and 'resources' so store one level deeper
"{{bundle_resources_dir}}/data/resources",
# Store in same folder as resources
"{{bundle_resources_dir}}/data/skps",
]
}
if (has_skps) {
bundle_data("${app_name}_bundle_skps") {
sources = [
"skps",
]
outputs = [
# Store in same folder as resources
"{{bundle_resources_dir}}/data/skps",
]
}
}
}
executable("${app_name}_generate_executable") {
@ -1381,6 +1374,19 @@ if (skia_enable_tools) {
testonly = true
}
bundle_data("${app_name}_bundle_symbols") {
public_deps = [
":${app_name}_generate_executable",
]
sources = [
"$gen_path/${app_name}.dSYM",
]
outputs = [
"{{bundle_executable_dir}}/${app_name}.dSYM",
]
testonly = true
}
create_bundle("$app_name") {
product_type = "com.apple.product-type.application"
testonly = true
@ -1388,17 +1394,15 @@ if (skia_enable_tools) {
bundle_root_dir = "${root_build_dir}/${target_name}.app"
bundle_resources_dir = bundle_root_dir
bundle_executable_dir = bundle_root_dir
bundle_plugins_dir = bundle_root_dir + "/Plugins"
deps = [
":${app_name}_bundle_executable",
":${app_name}_bundle_info_plist",
":${app_name}_bundle_resources",
":${app_name}_bundle_symbols",
]
if (bundle_ios_data) {
deps += [ ":${app_name}_bundle_resources" ]
if (has_skps) {
deps += [ ":${app_name}_bundle_skps" ]
}
if (has_skps) {
deps += [ ":${app_name}_bundle_skps" ]
}
# should only code sign when running on a device, not the simulator
@ -2355,9 +2359,6 @@ if (skia_enable_tools) {
}
test_app("viewer") {
is_shared_library = is_android
if (is_ios) {
bundle_ios_data = true
}
sources = [
"tools/viewer/BisectSlide.cpp",
"tools/viewer/GMSlide.cpp",

View File

@ -294,7 +294,8 @@ template("gcc_like_toolchain") {
}
tool("link") {
rspfile = "{{output}}.rsp"
exe_name = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
rspfile = "$exe_name.rsp"
rspfile_content = "{{inputs}}"
# --start-group/--end-group let us link multiple .a {{inputs}}
@ -309,10 +310,18 @@ template("gcc_like_toolchain") {
_start_group = ""
_end_group = ""
}
command = "$cc_wrapper $cxx {{ldflags}} $_start_group @$rspfile {{solibs}} $_end_group {{libs}} -o {{output}}"
if (is_ios) {
command = "$cc_wrapper $cxx {{ldflags}} $_start_group @$rspfile {{solibs}} $_end_group {{libs}} -o $exe_name && dsymutil $exe_name"
} else {
command = "$cc_wrapper $cxx {{ldflags}} $_start_group @$rspfile {{solibs}} $_end_group {{libs}} -o $exe_name"
}
outputs = [
"{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
"$exe_name",
]
if (is_ios) {
outputs += [ "{{root_out_dir}}/{{target_output_name}}.dSYM" ]
}
description = "link {{output}}"
}