OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 package com.google.dart.compiler; | 5 package com.google.dart.compiler; |
6 | 6 |
7 import com.google.common.collect.Lists; | 7 import com.google.common.collect.Lists; |
8 import com.google.dart.compiler.CompilerConfiguration.ErrorFormat; | 8 import com.google.dart.compiler.CompilerConfiguration.ErrorFormat; |
9 | 9 |
10 import org.kohsuke.args4j.Argument; | 10 import org.kohsuke.args4j.Argument; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // leave the command line flag for legacy purposes. | 72 // leave the command line flag for legacy purposes. |
73 @SuppressWarnings("unused") | 73 @SuppressWarnings("unused") |
74 @Option(name = "--noincremental", | 74 @Option(name = "--noincremental", |
75 usage = "Disable incremental compilation (default)") | 75 usage = "Disable incremental compilation (default)") |
76 private boolean noincremental = true; // not used, just a placeholder for ar
g parsing | 76 private boolean noincremental = true; // not used, just a placeholder for ar
g parsing |
77 | 77 |
78 @Option(name = "--incremental", | 78 @Option(name = "--incremental", |
79 usage = "Enable incremental compilation") | 79 usage = "Enable incremental compilation") |
80 private boolean incremental = false; | 80 private boolean incremental = false; |
81 | 81 |
82 // TODO(zundel): -out is for backward compatibility until scripts are update
d | 82 @Option(name = "--work", |
83 @Option(name = "--work", aliases = { "-out" }, | |
84 usage = "Directory to receive compiler output\n for future incremental b
uilds") | 83 usage = "Directory to receive compiler output\n for future incremental b
uilds") |
85 private File workDirectory = new File("out"); | 84 private File workDirectory = new File("out"); |
86 | 85 |
87 @Option(name = "--help", aliases = { "-?", "-help" }, | 86 @Option(name = "--help", aliases = { "-?", "-help" }, |
88 usage = "Prints this help message") | 87 usage = "Prints this help message") |
89 private boolean showHelp = false; | 88 private boolean showHelp = false; |
90 | 89 |
91 @Option(name = "--jvm-metrics", | 90 @Option(name = "--jvm-metrics", |
92 usage = "Print jvm metrics at end of compile") | 91 usage = "Print jvm metrics at end of compile") |
93 private boolean showJvmMetrics = false; | 92 private boolean showJvmMetrics = false; |
94 | 93 |
95 @Option(name = "--metrics", | 94 @Option(name = "--metrics", |
96 usage = "Print compilation metrics") | 95 usage = "Print compilation metrics") |
97 private boolean showMetrics = false; | 96 private boolean showMetrics = false; |
98 | 97 |
99 @Option(name = "--fatal-type-errors", aliases = { "-fatal-type-errors" }, | 98 @Option(name = "--fatal-type-errors", aliases = { "-fatal-type-errors" }, |
100 usage = "Treat type errors as fatal") | 99 usage = "Treat type errors as fatal") |
101 private boolean typeErrorsAreFatal = false; | 100 private boolean typeErrorsAreFatal = false; |
102 | 101 |
103 @Option(name = "--fatal-warnings", aliases = { "-Werror" }, | 102 @Option(name = "--fatal-warnings", aliases = { "-Werror" }, |
104 usage = "Treat non-type warnings as fatal") | 103 usage = "Treat non-type warnings as fatal") |
105 private boolean warningsAreFatal = false; | 104 private boolean warningsAreFatal = false; |
106 | 105 |
| 106 @Option(name = "--implementation-name", |
| 107 usage = "Implementation to analyze (e.g. dartium, vm, frog, leg)") |
| 108 private String implementationName = "dartium"; |
| 109 |
| 110 @Option(name = "--dart-sdk", |
| 111 usage = "Path to dart sdk") |
| 112 private String dartSdkPath = "../"; |
| 113 |
| 114 @Option(name = "--show-sdk-warnings", usage = "show warnings from SDK source
") |
| 115 private boolean showSdkWarnings = false; |
| 116 |
107 @Argument | 117 @Argument |
108 private final List<String> sourceFiles = new ArrayList<String>(); | 118 private final List<String> sourceFiles = new ArrayList<String>(); |
109 | 119 |
110 /** | 120 /** |
111 * @return <code>true</code> to automatically import dart:coreimpl | 121 * @return <code>true</code> to automatically import dart:coreimpl |
112 */ | 122 */ |
113 public boolean shouldExposeCoreImpl() { | 123 public boolean shouldExposeCoreImpl() { |
114 return exposeCoreImpl; | 124 return exposeCoreImpl; |
115 } | 125 } |
116 | 126 |
117 public String getJvmMetricOptions() { | 127 public String getJvmMetricOptions() { |
118 if (!showJvmMetrics) { | 128 if (!showJvmMetrics) { |
119 return null; | 129 return null; |
120 } | 130 } |
121 return jvmMetricDetail + ":" + jvmMetricFormat + ":" + jvmMetricType; | 131 return jvmMetricDetail + ":" + jvmMetricFormat + ":" + jvmMetricType; |
122 } | 132 } |
123 | 133 |
| 134 public String getImplementationName() { |
| 135 return implementationName; |
| 136 } |
| 137 |
| 138 public String getDartSdkPath() { |
| 139 return dartSdkPath; |
| 140 } |
| 141 |
| 142 /** |
| 143 * Returns whether warnings from SDK files should be suppressed. |
| 144 */ |
| 145 public boolean suppressSdkWarnings() { |
| 146 return !showSdkWarnings; |
| 147 } |
| 148 |
124 /** | 149 /** |
125 * Returns the list of files passed to the compiler. | 150 * Returns the list of files passed to the compiler. |
126 */ | 151 */ |
127 public List<String> getSourceFiles() { | 152 public List<String> getSourceFiles() { |
128 return sourceFiles; | 153 return sourceFiles; |
129 } | 154 } |
130 | 155 |
131 /** | 156 /** |
132 * Returns the path to receive compiler intermediate output. | 157 * Returns the path to receive compiler intermediate output. |
133 */ | 158 */ |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 args = newArgs.toArray(new String[newArgs.size()]); | 276 args = newArgs.toArray(new String[newArgs.size()]); |
252 cmdLineParser = new CmdLineParser(parsedOptions); | 277 cmdLineParser = new CmdLineParser(parsedOptions); |
253 continue; | 278 continue; |
254 } | 279 } |
255 } | 280 } |
256 break; | 281 break; |
257 } | 282 } |
258 return cmdLineParser; | 283 return cmdLineParser; |
259 } | 284 } |
260 } | 285 } |
OLD | NEW |