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

Side by Side Diff: build/android/gyp/find_sun_tools_jar.py

Issue 1136573002: Use the Errorprone Compiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using the Compiler Created 5 years, 7 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
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.
6
7 """This finds the java distribution's tools.jar and copies it somewhere.
8 """
9
10 import optparse
11 import os
12 import re
13 import shutil
14 import sys
15
16 from util import build_utils
17
18 def main(argv):
19 parser = optparse.OptionParser()
20 build_utils.AddDepfileOption(parser)
21 parser.add_option('--output', help='Path to copy the tools.jar to.')
jbudorick 2015/05/07 18:49:26 There has got to be a better way to do this than c
cjhopman 2015/05/07 19:15:18 That would be nice. You need to use the tools.jar
raywilliams_chromium 2015/05/11 19:52:24 From cjhopman's answer, it sounds like this is the
22 options, _ = parser.parse_args(argv)
23
24 # This works with at least openjdk 1.6, 1.7 and sun java 1.6, 1.7
25 stdout = build_utils.CheckOutput(
26 ["java", "-verbose", "-version"], print_stderr=False, print_stdout=False)
27 rt_jar_finder = re.compile(r'\[Opened (.*)/jre/lib/rt.jar\]')
28 sun_tools_jar_path = None
29 for ln in stdout.split('\n'):
30 match = re.match(rt_jar_finder, ln)
31 if match:
32 sun_tools_jar_path = os.path.join(match.group(1), 'lib', 'tools.jar')
33 break
34
35 if sun_tools_jar_path is None:
36 raise Exception('Couldn\'t find tools.jar')
37
38 shutil.copy(sun_tools_jar_path, options.output)
39
40 if options.depfile:
41 build_utils.WriteDepfile(
42 options.depfile,
43 [sun_tools_jar_path] + build_utils.GetPythonDependencies())
44
45
46 if __name__ == '__main__':
47 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698