summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authormikecase <mikecase@chromium.org>2015-10-13 14:11:04 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-13 21:11:40 +0000
commitb4809ce95223e177b13ba1569b7c2b19b1599814 (patch)
treee481961214e13e96fdc2068dec047719784ec396 /build
parentf5c8720f8385bbd6be5e1800cbab668a94102866 (diff)
downloadchromium_src-b4809ce95223e177b13ba1569b7c2b19b1599814.zip
chromium_src-b4809ce95223e177b13ba1569b7c2b19b1599814.tar.gz
chromium_src-b4809ce95223e177b13ba1569b7c2b19b1599814.tar.bz2
Adding extra-java-args to create_java_bin script for errorprone.
To use errorprone with JDK7 installed (which the bots have), you need to pass the errorprone-javac jar to the bootclasspath java arg. Adding the ability to specify extra java args in the create_java_bin script and using this to pass -Xbootclasspath/p:<javac jar path> when running errorprone. BUG= Review URL: https://codereview.chromium.org/1384873005 Cr-Commit-Position: refs/heads/master@{#353849}
Diffstat (limited to 'build')
-rwxr-xr-xbuild/android/gyp/create_java_binary_script.py28
-rw-r--r--build/config/android/internal_rules.gni14
2 files changed, 32 insertions, 10 deletions
diff --git a/build/android/gyp/create_java_binary_script.py b/build/android/gyp/create_java_binary_script.py
index 0f07a1d..b73144b8 100755
--- a/build/android/gyp/create_java_binary_script.py
+++ b/build/android/gyp/create_java_binary_script.py
@@ -30,16 +30,18 @@ import sys
self_dir = os.path.dirname(__file__)
classpath = [{classpath}]
-extra_args = {extra_args}
+extra_java_args = {extra_java_args}
+extra_program_args = {extra_program_args}
if os.getcwd() != self_dir:
offset = os.path.relpath(self_dir, os.getcwd())
classpath = [os.path.join(offset, p) for p in classpath]
-java_args = [
- "java",
- "-classpath", ":".join(classpath),
- "-enableassertions",
- \"{main_class}\"] + extra_args + sys.argv[1:]
-os.execvp("java", java_args)
+java_cmd = ["java"]
+java_cmd.extend(extra_java_args)
+java_cmd.extend(
+ ["-classpath", ":".join(classpath), "-enableassertions", \"{main_class}\"])
+java_cmd.extend(extra_program_args)
+java_cmd.extend(sys.argv[1:])
+os.execvp("java", java_cmd)
"""
def main(argv):
@@ -52,20 +54,28 @@ def main(argv):
help='Name of the java class with the "main" entry point.')
parser.add_option('--classpath', action='append',
help='Classpath for running the jar.')
- options, extra_args = parser.parse_args(argv)
+ parser.add_option('--extra-java-args',
+ help='Extra args passed to the "java" cmd')
+ options, extra_program_args = parser.parse_args(argv)
classpath = [options.jar_path]
for cp_arg in options.classpath:
classpath += build_utils.ParseGypList(cp_arg)
+ if options.extra_java_args:
+ extra_java_args = build_utils.ParseGypList(options.extra_java_args)
+ else:
+ extra_java_args = []
+
run_dir = os.path.dirname(options.output)
classpath = [os.path.relpath(p, run_dir) for p in classpath]
with open(options.output, 'w') as script:
script.write(script_template.format(
+ extra_java_args=repr(extra_java_args),
classpath=('"%s"' % '", "'.join(classpath)),
main_class=options.main_class,
- extra_args=repr(extra_args)))
+ extra_program_args=repr(extra_program_args)))
os.chmod(options.output, 0750)
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
index 19318a7..6950cca 100644
--- a/build/config/android/internal_rules.gni
+++ b/build/config/android/internal_rules.gni
@@ -166,6 +166,12 @@ template("java_binary_script") {
if (defined(invoker.wrapper_script_args)) {
args += [ "--" ] + invoker.wrapper_script_args
}
+ if (defined(invoker.extra_java_args)) {
+ args += [
+ "--extra-java-args",
+ invoker.extra_java_args,
+ ]
+ }
}
}
@@ -982,9 +988,14 @@ template("java_prebuilt_impl") {
if (defined(invoker.main_class)) {
binary_script_target_name = "${_template_name}__java_binary_script"
java_binary_script(binary_script_target_name) {
+ forward_variables_from(invoker,
+ [
+ "extra_java_args",
+ "main_class",
+ "wrapper_script_args",
+ ])
build_config = _build_config
jar_path = _jar_path
- main_class = invoker.main_class
script_name = _template_name
deps = [
":$build_config_target_name",
@@ -1322,6 +1333,7 @@ template("java_library_impl") {
java_binary_script("${_template_name}__java_binary_script") {
forward_variables_from(invoker,
[
+ "extra_java_args",
"main_class",
"wrapper_script_args",
])