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

Side by Side Diff: build/toolchain/mac/compile_xcassets.py

Issue 2236973004: Pass the bundle product_type to the actool invocation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@product_type
Patch Set: Created 4 years, 4 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
1 # Copyright 2016 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import argparse 5 import argparse
6 import os 6 import os
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 9
10 10
11 def CompileXCAssets(output, platform, min_deployment_target, inputs): 11 def CompileXCAssets(
12 output, platform, product_type, min_deployment_target, inputs):
13 """Compile the .xcassets bundles to an asset catalog using actool.
14
15 Args:
16 output: absolute path to the containing bundle
17 platform: the targetted platform
18 product_type: the bundle type
19 min_deployment_target: minimum deployment target
20 inputs: list of absolute paths to .xcassets bundles
21 """
12 command = [ 22 command = [
13 'xcrun', 'actool', '--output-format=human-readable-text', 23 'xcrun', 'actool', '--output-format=human-readable-text',
14 '--compress-pngs', '--notices', '--warnings', '--errors', 24 '--compress-pngs', '--notices', '--warnings', '--errors',
15 '--platform', platform, '--minimum-deployment-target', 25 '--platform', platform, '--minimum-deployment-target',
16 min_deployment_target, 26 min_deployment_target,
17 ] 27 ]
18 28
29 if product_type != '':
30 command.extend(['--product-type', product_type])
31
19 if platform == 'macosx': 32 if platform == 'macosx':
20 command.extend(['--target-device', 'mac']) 33 command.extend(['--target-device', 'mac'])
21 else: 34 else:
22 command.extend(['--target-device', 'iphone', '--target-device', 'ipad']) 35 command.extend(['--target-device', 'iphone', '--target-device', 'ipad'])
23 36
24 # actool crashes if paths are relative, so convert input and output paths 37 # actool crashes if paths are relative, so convert input and output paths
25 # to absolute paths. 38 # to absolute paths.
26 command.extend(['--compile', os.path.dirname(os.path.abspath(output))]) 39 command.extend(['--compile', os.path.dirname(os.path.abspath(output))])
27 command.extend(map(os.path.abspath, inputs)) 40 command.extend(map(os.path.abspath, inputs))
28 41
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 '--platform', '-p', required=True, 73 '--platform', '-p', required=True,
61 choices=('macosx', 'iphoneos', 'iphonesimulator'), 74 choices=('macosx', 'iphoneos', 'iphonesimulator'),
62 help='target platform for the compiled assets catalog') 75 help='target platform for the compiled assets catalog')
63 parser.add_argument( 76 parser.add_argument(
64 '--minimum-deployment-target', '-t', required=True, 77 '--minimum-deployment-target', '-t', required=True,
65 help='minimum deployment target for the compiled assets catalog') 78 help='minimum deployment target for the compiled assets catalog')
66 parser.add_argument( 79 parser.add_argument(
67 '--output', '-o', required=True, 80 '--output', '-o', required=True,
68 help='path to the compiled assets catalog') 81 help='path to the compiled assets catalog')
69 parser.add_argument( 82 parser.add_argument(
83 '--product-type', '-T',
84 help='type of the containing bundle')
85 parser.add_argument(
70 'inputs', nargs='+', 86 'inputs', nargs='+',
71 help='path to input assets catalog sources') 87 help='path to input assets catalog sources')
72 args = parser.parse_args() 88 args = parser.parse_args()
73 89
74 if os.path.basename(args.output) != 'Assets.car': 90 if os.path.basename(args.output) != 'Assets.car':
75 sys.stderr.write( 91 sys.stderr.write(
76 'output should be path to compiled asset catalog, not ' 92 'output should be path to compiled asset catalog, not '
77 'to the containing bundle: %s\n' % (args.output,)) 93 'to the containing bundle: %s\n' % (args.output,))
78 sys.exit(1) 94 sys.exit(1)
79 95
80 CompileXCAssets( 96 CompileXCAssets(
81 args.output, 97 args.output,
82 args.platform, 98 args.platform,
99 args.product_type,
83 args.minimum_deployment_target, 100 args.minimum_deployment_target,
84 args.inputs) 101 args.inputs)
85 102
86 103
87 if __name__ == '__main__': 104 if __name__ == '__main__':
88 sys.exit(Main()) 105 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