| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Creates a simple script to run a java "binary". | 7 """Creates a simple script to run a java "binary". |
| 8 | 8 |
| 9 This creates a script that sets up the java command line for running a java | 9 This creates a script that sets up the java command line for running a java |
| 10 jar. This includes correctly setting the classpath and the main class. | 10 jar. This includes correctly setting the classpath and the main class. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 options, extra_program_args = parser.parse_args(argv) | 82 options, extra_program_args = parser.parse_args(argv) |
| 83 | 83 |
| 84 if (options.noverify): | 84 if (options.noverify): |
| 85 noverify_flag = 'java_cmd.append("-noverify")' | 85 noverify_flag = 'java_cmd.append("-noverify")' |
| 86 else: | 86 else: |
| 87 noverify_flag = '' | 87 noverify_flag = '' |
| 88 | 88 |
| 89 classpath = [options.jar_path] | 89 classpath = [options.jar_path] |
| 90 for cp_arg in options.classpath: | 90 for cp_arg in options.classpath: |
| 91 classpath += build_utils.ParseGypList(cp_arg) | 91 classpath += build_utils.ParseGnList(cp_arg) |
| 92 | 92 |
| 93 bootclasspath = [] | 93 bootclasspath = [] |
| 94 for bootcp_arg in options.bootclasspath: | 94 for bootcp_arg in options.bootclasspath: |
| 95 bootclasspath += build_utils.ParseGypList(bootcp_arg) | 95 bootclasspath += build_utils.ParseGnList(bootcp_arg) |
| 96 | 96 |
| 97 run_dir = os.path.dirname(options.output) | 97 run_dir = os.path.dirname(options.output) |
| 98 bootclasspath = [os.path.relpath(p, run_dir) for p in bootclasspath] | 98 bootclasspath = [os.path.relpath(p, run_dir) for p in bootclasspath] |
| 99 classpath = [os.path.relpath(p, run_dir) for p in classpath] | 99 classpath = [os.path.relpath(p, run_dir) for p in classpath] |
| 100 | 100 |
| 101 with open(options.output, 'w') as script: | 101 with open(options.output, 'w') as script: |
| 102 script.write(script_template.format( | 102 script.write(script_template.format( |
| 103 classpath=('"%s"' % '", "'.join(classpath)), | 103 classpath=('"%s"' % '", "'.join(classpath)), |
| 104 bootclasspath=('"%s"' % '", "'.join(bootclasspath) | 104 bootclasspath=('"%s"' % '", "'.join(bootclasspath) |
| 105 if bootclasspath else ''), | 105 if bootclasspath else ''), |
| 106 main_class=options.main_class, | 106 main_class=options.main_class, |
| 107 extra_program_args=repr(extra_program_args), | 107 extra_program_args=repr(extra_program_args), |
| 108 noverify_flag=noverify_flag)) | 108 noverify_flag=noverify_flag)) |
| 109 | 109 |
| 110 os.chmod(options.output, 0750) | 110 os.chmod(options.output, 0750) |
| 111 | 111 |
| 112 if options.depfile: | 112 if options.depfile: |
| 113 build_utils.WriteDepfile( | 113 build_utils.WriteDepfile( |
| 114 options.depfile, | 114 options.depfile, |
| 115 build_utils.GetPythonDependencies()) | 115 build_utils.GetPythonDependencies()) |
| 116 | 116 |
| 117 | 117 |
| 118 if __name__ == '__main__': | 118 if __name__ == '__main__': |
| 119 sys.exit(main(sys.argv[1:])) | 119 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |