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

Side by Side 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, 6 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 unified diff | Download patch
« no previous file with comments | « build/toolchain/mac/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import argparse
6 import os
7 import sys
8
9
10 def Main():
11 parser = argparse.ArgumentParser(
12 description='compile assets catalog for a bundle')
13 parser.add_argument(
14 '--platform', '-p', required=True,
15 choices=('macosx', 'iphoneos', 'iphonesimulator'),
16 help='target platform for the compiled assets catalog')
17 parser.add_argument(
18 '--minimum-deployment-target', '-t', required=True,
19 help='minimum deployment target for the compiled assets catalog')
20 parser.add_argument(
21 '--output', '-o', required=True,
22 help='path to the compiled assets catalog')
23 parser.add_argument(
24 'inputs', nargs='+',
25 help='path to input assets catalog sources')
26 args = parser.parse_args()
27
28 if os.path.basename(args.output) != 'Assets.car':
29 sys.stderr.write(
30 'output should be path to compiled asset catalog, not '
31 'to the containing bundle: %s\n' % (args.output,))
32
33 command = [
34 'xcrun', 'actool', '--output-format', 'human-readable-text',
35 '--compress-pngs', '--notices', '--warnings', '--errors',
36 '--platform', args.platform, '--minimum-deployment-target',
37 args.minimum_deployment_target,
38 ]
39
40 if args.platform == 'macosx':
41 command.extend(['--target-device', 'mac'])
42 else:
43 command.extend(['--target-device', 'iphone', '--target-device', 'ipad'])
44
45 # actool crashes if paths are relative, so use os.path.abspath to get absolute
46 # path for input and outputs.
47 command.extend(['--compile', os.path.abspath(os.path.dirname(args.output))])
48 command.extend(map(os.path.abspath, args.inputs))
49
50 os.execvp('xcrun', command)
51 sys.exit(1)
52
53 if __name__ == '__main__':
54 sys.exit(Main())
OLDNEW
« 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