Reland "Add launch screen to iOS apps"
This is a reland of bf8dad281e
Original change's description:
> Add launch screen to iOS apps
>
> Bug: skia:
> Change-Id: I7ebe94213c26c31c1b0dbd1b8951f87263cd41a3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/175826
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Hal Canary <halcanary@google.com>
Bug: skia:
Change-Id: I111242899339186fba2b8753ee43bc0fb2ea5295
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239437
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
parent
b0e2347fed
commit
e784f75beb
106
BUILD.gn
106
BUILD.gn
@ -1197,6 +1197,108 @@ if (skia_enable_tools) {
|
||||
}
|
||||
}
|
||||
|
||||
# Template to compile .xib and .storyboard files.
|
||||
#
|
||||
# Arguments
|
||||
#
|
||||
# sources:
|
||||
# list of string, sources to compile
|
||||
#
|
||||
# ibtool_flags:
|
||||
# (optional) list of string, additional flags to pass to the ibtool
|
||||
template("compile_ib_files") {
|
||||
action_foreach(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"testonly",
|
||||
"visibility",
|
||||
])
|
||||
assert(defined(invoker.sources),
|
||||
"sources must be specified for $target_name")
|
||||
assert(defined(invoker.output_extension),
|
||||
"output_extension must be specified for $target_name")
|
||||
|
||||
ibtool_flags = []
|
||||
if (defined(invoker.ibtool_flags)) {
|
||||
ibtool_flags = invoker.ibtool_flags
|
||||
}
|
||||
|
||||
_output_extension = invoker.output_extension
|
||||
|
||||
script = "//gn/compile_ib_files.py"
|
||||
sources = invoker.sources
|
||||
outputs = [
|
||||
"$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
|
||||
]
|
||||
args = [
|
||||
"--input",
|
||||
"{{source}}",
|
||||
"--output",
|
||||
rebase_path(
|
||||
"$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
|
||||
root_build_dir),
|
||||
]
|
||||
|
||||
# if (!use_system_xcode) {
|
||||
# args += [
|
||||
# "--developer_dir",
|
||||
# hermetic_xcode_path,
|
||||
# ]
|
||||
# }
|
||||
args += ibtool_flags
|
||||
}
|
||||
}
|
||||
|
||||
template("bundle_data_ib_file") {
|
||||
assert(defined(invoker.source),
|
||||
"source needs to be defined for $target_name")
|
||||
|
||||
_source_extension = get_path_info(invoker.source, "extension")
|
||||
assert(_source_extension == "xib" || _source_extension == "storyboard",
|
||||
"source must be a .xib or .storyboard for $target_name")
|
||||
|
||||
_target_name = target_name
|
||||
if (_source_extension == "xib") {
|
||||
_compile_ib_file = target_name + "_compile_xib"
|
||||
_output_extension = "nib"
|
||||
} else {
|
||||
_compile_ib_file = target_name + "_compile_storyboard"
|
||||
_output_extension = "storyboardc"
|
||||
}
|
||||
|
||||
compile_ib_files(_compile_ib_file) {
|
||||
sources = [
|
||||
invoker.source,
|
||||
]
|
||||
output_extension = _output_extension
|
||||
visibility = [ ":$_target_name" ]
|
||||
ibtool_flags = [
|
||||
# "--minimum-deployment-target",
|
||||
# ios_deployment_target,
|
||||
"--auto-activate-custom-fonts",
|
||||
"--target-device",
|
||||
"iphone",
|
||||
"--target-device",
|
||||
"ipad",
|
||||
]
|
||||
}
|
||||
|
||||
bundle_data(_target_name) {
|
||||
forward_variables_from(invoker, "*", [ "source" ])
|
||||
|
||||
if (!defined(public_deps)) {
|
||||
public_deps = []
|
||||
}
|
||||
public_deps += [ ":$_compile_ib_file" ]
|
||||
|
||||
sources = get_target_outputs(":$_compile_ib_file")
|
||||
|
||||
outputs = [
|
||||
"{{bundle_resources_dir}}/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
template("test_app") {
|
||||
if (is_ios) {
|
||||
app_name = target_name
|
||||
@ -1234,6 +1336,9 @@ if (skia_enable_tools) {
|
||||
"{{bundle_resources_dir}}/data/resources",
|
||||
]
|
||||
}
|
||||
bundle_data_ib_file("${app_name}_bundle_launchscreen") {
|
||||
source = "platform_tools/ios/app/LaunchScreen.storyboard"
|
||||
}
|
||||
if (has_skps) {
|
||||
bundle_data("${app_name}_bundle_skps") {
|
||||
sources = [
|
||||
@ -1315,6 +1420,7 @@ if (skia_enable_tools) {
|
||||
deps = [
|
||||
":${app_name}_bundle_executable",
|
||||
":${app_name}_bundle_info_plist",
|
||||
":${app_name}_bundle_launchscreen",
|
||||
":${app_name}_bundle_resources",
|
||||
":${app_name}_bundle_symbols",
|
||||
]
|
||||
|
60
gn/compile_ib_files.py
Normal file
60
gn/compile_ib_files.py
Normal file
@ -0,0 +1,60 @@
|
||||
# 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 argparse
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='A script to compile xib and storyboard.',
|
||||
fromfile_prefix_chars='@')
|
||||
parser.add_argument('-o', '--output', required=True,
|
||||
help='Path to output bundle.')
|
||||
parser.add_argument('-i', '--input', required=True,
|
||||
help='Path to input xib or storyboard.')
|
||||
parser.add_argument('--developer_dir', required=False,
|
||||
help='Path to Xcode.')
|
||||
args, unknown_args = parser.parse_known_args()
|
||||
|
||||
if args.developer_dir:
|
||||
os.environ['DEVELOPER_DIR'] = args.developer_dir
|
||||
|
||||
ibtool_args = [
|
||||
'xcrun', 'ibtool',
|
||||
'--errors', '--warnings', '--notices',
|
||||
'--output-format', 'human-readable-text'
|
||||
]
|
||||
ibtool_args += unknown_args
|
||||
ibtool_args += [
|
||||
'--compile',
|
||||
os.path.abspath(args.output),
|
||||
os.path.abspath(args.input)
|
||||
]
|
||||
|
||||
ibtool_section_re = re.compile(r'/\*.*\*/')
|
||||
ibtool_re = re.compile(r'.*note:.*is clipping its content')
|
||||
try:
|
||||
stdout = subprocess.check_output(ibtool_args)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(e.output)
|
||||
raise
|
||||
current_section_header = None
|
||||
for line in stdout.splitlines():
|
||||
if ibtool_section_re.match(line):
|
||||
current_section_header = line
|
||||
elif not ibtool_re.match(line):
|
||||
if current_section_header:
|
||||
print(current_section_header)
|
||||
current_section_header = None
|
||||
print(line)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
@ -29,6 +29,7 @@ with open(os.path.join(out, app + '_Info.plist'), 'w') as f:
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key> <string>LaunchScreen</string>
|
||||
</dict>
|
||||
</plist>
|
||||
'''.format(app=app))
|
||||
|
@ -34,6 +34,7 @@
|
||||
'../../platform_tools/android/apps/skottie/src/main/cpp',
|
||||
'../../platform_tools/android/launcher/skia_launcher.cpp',
|
||||
'../../platform_tools/android/vulkan/Skia_Vulkan_Android.h',
|
||||
'../../platform_tools/ios/app/LaunchScreen.storyboard',
|
||||
'../../platform_tools/libraries/include/arcore_c_api.h',
|
||||
'../../resources',
|
||||
'../../samplecode',
|
||||
|
@ -22,6 +22,7 @@ PATH_PATTERNS = [
|
||||
r'.*\.gn$',
|
||||
r'.*\.gni$',
|
||||
r'.*\.h$',
|
||||
r'.*\.storyboard$',
|
||||
]
|
||||
|
||||
# These paths are always added to the inclusion list. Note that they may not
|
||||
|
25
platform_tools/ios/app/LaunchScreen.storyboard
Normal file
25
platform_tools/ios/app/LaunchScreen.storyboard
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
Loading…
Reference in New Issue
Block a user