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 18 matching lines...) Expand all Loading... | |
29 import sys | 29 import sys |
30 | 30 |
31 self_dir = os.path.dirname(__file__) | 31 self_dir = os.path.dirname(__file__) |
32 classpath = [{classpath}] | 32 classpath = [{classpath}] |
33 if os.getcwd() != self_dir: | 33 if os.getcwd() != self_dir: |
34 offset = os.path.relpath(self_dir, os.getcwd()) | 34 offset = os.path.relpath(self_dir, os.getcwd()) |
35 classpath = [os.path.join(offset, p) for p in classpath] | 35 classpath = [os.path.join(offset, p) for p in classpath] |
36 java_args = [ | 36 java_args = [ |
37 "java", | 37 "java", |
38 "-classpath", ":".join(classpath), | 38 "-classpath", ":".join(classpath), |
39 "-enableassertions", | |
cjhopman
2015/06/17 21:50:15
So this enables assertions for all java binaries.
Bernhard Bauer
2015/06/18 16:37:25
Hm, I don't really see an advantage in having asse
cjhopman
2015/06/19 22:39:07
Well, this isn't just for tests. I'd agree that fo
| |
39 \"{main_class}\"] + sys.argv[1:] | 40 \"{main_class}\"] + sys.argv[1:] |
40 os.execvp("java", java_args) | 41 os.execvp("java", java_args) |
41 """ | 42 """ |
42 | 43 |
43 def main(argv): | 44 def main(argv): |
44 argv = build_utils.ExpandFileArgs(argv) | 45 argv = build_utils.ExpandFileArgs(argv) |
45 parser = optparse.OptionParser() | 46 parser = optparse.OptionParser() |
46 build_utils.AddDepfileOption(parser) | 47 build_utils.AddDepfileOption(parser) |
47 parser.add_option('--output', help='Output path for executable script.') | 48 parser.add_option('--output', help='Output path for executable script.') |
48 parser.add_option('--jar-path', help='Path to the main jar.') | 49 parser.add_option('--jar-path', help='Path to the main jar.') |
(...skipping 18 matching lines...) Expand all Loading... | |
67 os.chmod(options.output, 0750) | 68 os.chmod(options.output, 0750) |
68 | 69 |
69 if options.depfile: | 70 if options.depfile: |
70 build_utils.WriteDepfile( | 71 build_utils.WriteDepfile( |
71 options.depfile, | 72 options.depfile, |
72 build_utils.GetPythonDependencies()) | 73 build_utils.GetPythonDependencies()) |
73 | 74 |
74 | 75 |
75 if __name__ == '__main__': | 76 if __name__ == '__main__': |
76 sys.exit(main(sys.argv[1:])) | 77 sys.exit(main(sys.argv[1:])) |
OLD | NEW |