Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / build / android / gyp / dex.py
blob99834c4fe0908ae83fb094ba0206ea16c57dbc53
1 #!/usr/bin/env python
3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 import fnmatch
8 import optparse
9 import os
10 import sys
12 from util import build_utils
13 from util import md5_check
16 def DoDex(options, paths):
17 dx_binary = os.path.join(options.android_sdk_root, 'platform-tools', 'dx')
18 dex_cmd = [dx_binary, '--dex', '--output', options.dex_path] + paths
20 md5_stamp = '%s.md5' % options.dex_path
21 md5_checker = md5_check.Md5Checker(
22 stamp=md5_stamp, inputs=paths, command=dex_cmd)
23 if md5_checker.IsStale():
24 build_utils.CheckCallDie(dex_cmd, suppress_output=True)
25 else:
26 build_utils.Touch(options.dex_path)
27 md5_checker.Write()
30 def main(argv):
31 parser = optparse.OptionParser()
32 parser.add_option('--android-sdk-root', help='Android sdk root directory.')
33 parser.add_option('--dex-path', help='Dex output path.')
34 parser.add_option('--stamp', help='Path to touch on success.')
36 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
37 parser.add_option('--ignore', help='Ignored.')
39 options, paths = parser.parse_args()
41 DoDex(options, paths)
43 if options.stamp:
44 build_utils.Touch(options.stamp)
47 if __name__ == '__main__':
48 sys.exit(main(sys.argv))