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

Unified 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: Changed default to disabled 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 side-by-side diff with in-line comments
Download patch
Index: build/android/gyp/find_sun_tools_jar.py
diff --git a/build/android/gyp/find_sun_tools_jar.py b/build/android/gyp/find_sun_tools_jar.py
new file mode 100755
index 0000000000000000000000000000000000000000..cb29c5516d6148a98a55f207f6ec797dad2f996b
--- /dev/null
+++ b/build/android/gyp/find_sun_tools_jar.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""This finds the java distribution's tools.jar and copies it somewhere.
+"""
+
+import optparse
+import os
+import re
+import shutil
+import sys
+
+from util import build_utils
+
+def main(argv):
jbudorick 2015/05/15 18:37:12 nit: drop the argv param and don't pass anything t
raywilliams_chromium 2015/05/18 19:53:23 Done.
+ parser = optparse.OptionParser()
jbudorick 2015/05/15 18:37:12 oh, and use argparse.
raywilliams_chromium 2015/05/18 19:53:23 Done.
+ build_utils.AddDepfileOption(parser)
+ parser.add_option('--output', help='Path to copy the tools.jar to.')
+ options, _ = parser.parse_args(argv)
+
+ # This works with at least openjdk 1.6, 1.7 and sun java 1.6, 1.7
+ stdout = build_utils.CheckOutput(
jbudorick 2015/05/15 18:37:12 Move the logic for finding sun_tools_jar_path into
raywilliams_chromium 2015/05/18 19:53:23 helper method extracted
raywilliams_chromium 2015/05/18 19:53:23 Done.
+ ["java", "-verbose", "-version"], print_stderr=False, print_stdout=False)
+ rt_jar_finder = re.compile(r'\[Opened (.*)/jre/lib/rt.jar\]')
jbudorick 2015/05/15 18:37:12 Do this as a constant.
raywilliams_chromium 2015/05/18 19:53:23 Do you mean pull rt_jar_finder out of main() ?
jbudorick 2015/05/18 19:58:31 yes, and name it RT_JAR_FINDER
raywilliams_chromium 2015/05/18 20:50:23 Done.
+ sun_tools_jar_path = None
+ for ln in stdout.split('\n'):
jbudorick 2015/05/15 18:37:12 splitlines?
raywilliams_chromium 2015/05/18 19:53:23 sure :)
raywilliams_chromium 2015/05/18 19:53:23 Done.
+ match = re.match(rt_jar_finder, ln)
+ if match:
+ sun_tools_jar_path = os.path.join(match.group(1), 'lib', 'tools.jar')
+ break
+
+ if sun_tools_jar_path is None:
+ raise Exception('Couldn\'t find tools.jar')
jbudorick 2015/05/15 18:37:12 nit: use double quotes when the string has a singl
raywilliams_chromium 2015/05/18 19:53:23 Done.
+
+ shutil.copy(sun_tools_jar_path, options.output)
+
+ if options.depfile:
+ build_utils.WriteDepfile(
+ options.depfile,
+ [sun_tools_jar_path] + build_utils.GetPythonDependencies())
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
« no previous file with comments | « build/android/BUILD.gn ('k') | build/android/gyp/javac.py » ('j') | build/android/gyp/javac.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698