Add product bundle name to iOS Xcode projects

Before this you'd need to set the bundle name to launch the app
via the Xcode debugger. With this it's set automatically.

Change-Id: Ic84a6c8ba020580d5ff4afa9c104efbc2360b60e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334898
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This commit is contained in:
Jim Van Verth 2020-11-16 10:24:30 -05:00 committed by Skia Commit-Bot
parent 971b19d0c6
commit b50e5cf3a6
2 changed files with 14 additions and 4 deletions

View File

@ -10,7 +10,9 @@ import sys
# Arguments to the script:
# app path to binary to package, e.g. out/Debug/gen/dm
app, = sys.argv[1:]
# bundle_prefix the first part of the bundle ID, e.g. com.google (no trailing '.')
# the app name will be appended to this to create the full bundle ID
app,bundle_prefix = sys.argv[1:3]
out, app = os.path.split(app)
@ -22,7 +24,7 @@ with open(os.path.join(out, app + '_Info.plist'), 'w') as f:
<key>CFBundleVersion</key> <string>0.1.0</string>
<key>CFBundleShortVersionString</key> <string>0.1.0</string>
<key>CFBundleExecutable</key> <string>{app}</string>
<key>CFBundleIdentifier</key> <string>com.google.{app}</string>
<key>CFBundleIdentifier</key> <string>{bundle_prefix}.{app}</string>
<key>CFBundlePackageType</key> <string>APPL</string>
<key>LSRequiresIPhoneOS</key> <true/>
<key>UIDeviceFamily</key> <array>
@ -32,4 +34,4 @@ with open(os.path.join(out, app + '_Info.plist'), 'w') as f:
<key>UILaunchStoryboardName</key> <string>LaunchScreen</string>
</dict>
</plist>
'''.format(app=app))
'''.format(app=app, bundle_prefix=bundle_prefix))

View File

@ -106,11 +106,15 @@ if (is_ios) {
template("ios_app_bundle") {
app_name = target_name
gen_path = target_gen_dir
bundle_prefix = "com.google"
action("${app_name}_generate_info_plist") {
script = "//gn/gen_plist_ios.py"
outputs = [ "$gen_path/${app_name}_Info.plist" ]
args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
args = [
rebase_path("$gen_path/$app_name", root_build_dir),
"$bundle_prefix",
]
}
bundle_data("${app_name}_bundle_info_plist") {
@ -184,6 +188,10 @@ if (is_ios) {
bundle_resources_dir = bundle_root_dir
bundle_executable_dir = bundle_root_dir
xcode_extra_attributes = {
PRODUCT_BUNDLE_IDENTIFIER = "${bundle_prefix}.${app_name}"
}
deps = [
":${app_name}_bundle_executable_and_symbols",
":${app_name}_bundle_info_plist",