3 # Copyright 2014 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 REPOSITORY_ROOT
= os
.path
.abspath(os
.path
.join(
13 os
.path
.dirname(__file__
), '..', '..', '..'))
15 sys
.path
.append(os
.path
.join(REPOSITORY_ROOT
, 'build/android/gyp/util'))
19 def ExtractJars(options
):
20 # The paths of the files in the jar will be the same as they are passed in to
21 # the command. Because of this, the command should be run in
22 # options.classes_dir so the .class file paths in the jar are correct.
23 jar_cwd
= options
.classes_dir
24 build_utils
.DeleteDirectory(jar_cwd
)
25 build_utils
.MakeDirectory(jar_cwd
)
26 for jar
in build_utils
.ParseGypList(options
.jars
):
27 jar_path
= os
.path
.abspath(jar
)
28 jar_cmd
= ['jar', 'xf', jar_path
]
29 build_utils
.CheckOutput(jar_cmd
, cwd
=jar_cwd
)
33 parser
= optparse
.OptionParser()
34 parser
.add_option('--classes-dir', help='Directory to extract .class files.')
35 parser
.add_option('--jars', help='Paths to jars to extract.')
36 parser
.add_option('--stamp', help='Path to touch on success.')
38 options
, _
= parser
.parse_args()
43 build_utils
.Touch(options
.stamp
)
46 if __name__
== '__main__':