aboutsummaryrefslogtreecommitdiffhomepage
path: root/gn
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2017-11-28 09:45:26 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-28 15:29:07 +0000
commit443a913b8f0e3fc4a5f6abfa6be2fd6e79641ffe (patch)
tree9463b8ae0b35268ae0c8229ec561cbde5eeb8c06 /gn
parent9f553932a4a4e986db323d8f4da2f78d9a729254 (diff)
Add create_bundle support for GN
Docs-Preview: https://skia.org/?cl=75383 Bug: skia:7339 Change-Id: I985734e8b7b5af21a82cb8ee59acbfb5ff1d3ff7 Reviewed-on: https://skia-review.googlesource.com/75383 Commit-Queue: Jim Van Verth <jvanverth@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'gn')
-rw-r--r--gn/codesign_ios.py (renamed from gn/package_ios.py)28
-rw-r--r--gn/gen_plist_ios.py29
-rw-r--r--gn/toolchain/BUILD.gn12
3 files changed, 47 insertions, 22 deletions
diff --git a/gn/package_ios.py b/gn/codesign_ios.py
index eb07fc703b..66a97d39ee 100644
--- a/gn/package_ios.py
+++ b/gn/codesign_ios.py
@@ -14,8 +14,9 @@ import sys
import tempfile
# Arguments to the script:
-# app path to binary to package, e.g. out/Debug/dm
-app, = sys.argv[1:]
+# pkg path to application directory, e.g. out/Debug/dm.app
+# executable and plist should already be in this directory
+pkg, = sys.argv[1:]
# Find the Google signing identity.
identity = None
@@ -34,35 +35,18 @@ for p in glob.glob(os.path.join(os.environ['HOME'], 'Library', 'MobileDevice',
mobileprovision = p
assert mobileprovision
-out, app = os.path.split(app)
-
-pkg = os.path.join(out, app + '.app')
-if not os.path.exists(pkg):
- os.mkdir(pkg)
-
-# The binary and .mobileprovision just get copied into the package.
-shutil.copy(os.path.join(out, app), pkg)
+# The .mobileprovision just gets copied into the package.
shutil.copy(mobileprovision,
os.path.join(pkg, 'embedded.mobileprovision'))
-# Write a minimal Info.plist to name the package and point at the binary.
-with open(os.path.join(pkg, 'Info.plist'), 'w') as f:
- f.write('''
-<plist version="1.0">
- <dict>
- <key>CFBundleExecutable</key> <string>{app}</string>
- <key>CFBundleIdentifier</key> <string>com.google.{app}</string>
- <key>CFBundlePackageType</key> <string>APPL</string>
- </dict>
-</plist>
-'''.format(app=app))
-
# Extract the appliciation identitifer prefix from the .mobileprovision.
m = re.search(r'''<key>ApplicationIdentifierPrefix</key>
\t<array>
\t<string>(.*)</string>''', open(mobileprovision).read(), re.MULTILINE)
prefix = m.group(1)
+app, _ = os.path.splitext(os.path.basename(pkg))
+
# Write a minimal entitlements file, then codesign.
with tempfile.NamedTemporaryFile() as f:
f.write('''
diff --git a/gn/gen_plist_ios.py b/gn/gen_plist_ios.py
new file mode 100644
index 0000000000..e4041be388
--- /dev/null
+++ b/gn/gen_plist_ios.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python2.7
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import sys
+
+# Arguments to the script:
+# app path to binary to package, e.g. out/Debug/gen/dm
+app, = sys.argv[1:]
+
+out, app = os.path.split(app)
+
+# Write a minimal Info.plist to name the package and point at the binary.
+with open(os.path.join(out, app + '_Info.plist'), 'w') as f:
+ f.write('''
+<plist version="1.0">
+ <dict>
+ <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>CFBundlePackageType</key> <string>APPL</string>
+ </dict>
+</plist>
+'''.format(app=app))
diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn
index 13c8397032..59d83e43d7 100644
--- a/gn/toolchain/BUILD.gn
+++ b/gn/toolchain/BUILD.gn
@@ -283,6 +283,18 @@ template("gcc_like_toolchain") {
description = "copy {{source}} {{output}}"
}
+ tool("copy_bundle_data") {
+ cp_py = rebase_path("../cp.py")
+ command = "$python $cp_py {{source}} {{output}}"
+ description = "copy_bundle_data {{source}} {{output}}"
+ }
+
+ # We don't currently have any xcasset files so make this a NOP
+ tool("compile_xcassets") {
+ command = "true"
+ description = "compile_xcassets {{output}}"
+ }
+
toolchain_args = {
current_cpu = invoker.cpu
current_os = invoker.os