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.
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)
26 build_utils
.Touch(options
.dex_path
)
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()
44 build_utils
.Touch(options
.stamp
)
47 if __name__
== '__main__':
48 sys
.exit(main(sys
.argv
))