Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2181)

Unified Diff: build/toolchain/mac/compile_xcassets.py

Issue 2023223002: [GN] Add script to compile assets catalog without using tools/gyp. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@{0}
Patch Set: Use mac_sdk_name in "compile_xcassets" tool definition Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/toolchain/mac/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/mac/compile_xcassets.py
diff --git a/build/toolchain/mac/compile_xcassets.py b/build/toolchain/mac/compile_xcassets.py
new file mode 100644
index 0000000000000000000000000000000000000000..b78854416bab5852420995b49ff181cef29f3544
--- /dev/null
+++ b/build/toolchain/mac/compile_xcassets.py
@@ -0,0 +1,54 @@
+# 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 sys
+
+
+def Main():
+ parser = argparse.ArgumentParser(
+ description='compile assets catalog for a bundle')
+ parser.add_argument(
+ '--platform', '-p', required=True,
+ choices=('macosx', 'iphoneos', 'iphonesimulator'),
+ help='target platform for the compiled assets catalog')
+ parser.add_argument(
+ '--minimum-deployment-target', '-t', required=True,
+ help='minimum deployment target for the compiled assets catalog')
+ parser.add_argument(
+ '--output', '-o', required=True,
+ help='path to the compiled assets catalog')
+ parser.add_argument(
+ 'inputs', nargs='+',
+ help='path to input assets catalog sources')
+ args = parser.parse_args()
+
+ if os.path.basename(args.output) != 'Assets.car':
+ sys.stderr.write(
+ 'output should be path to compiled asset catalog, not '
+ 'to the containing bundle: %s\n' % (args.output,))
+
+ command = [
+ 'xcrun', 'actool', '--output-format', 'human-readable-text',
+ '--compress-pngs', '--notices', '--warnings', '--errors',
+ '--platform', args.platform, '--minimum-deployment-target',
+ args.minimum_deployment_target,
+ ]
+
+ if args.platform == 'macosx':
+ command.extend(['--target-device', 'mac'])
+ else:
+ command.extend(['--target-device', 'iphone', '--target-device', 'ipad'])
+
+ # actool crashes if paths are relative, so use os.path.abspath to get absolute
+ # path for input and outputs.
+ command.extend(['--compile', os.path.abspath(os.path.dirname(args.output))])
+ command.extend(map(os.path.abspath, args.inputs))
+
+ os.execvp('xcrun', command)
+ sys.exit(1)
+
+if __name__ == '__main__':
+ sys.exit(Main())
« no previous file with comments | « build/toolchain/mac/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698