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

Side by Side Diff: tools/testing/dart/compiler_configuration.dart

Issue 176883023: Revert "Dart2js testing: Add prefix files when running dart2js output on d8 or jsshell." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library compiler_configuration; 5 library compiler_configuration;
6 6
7 import 'dart:io' show 7 import 'dart:io' show
8 Platform; 8 Platform;
9 9
10 import 'runtime_configuration.dart' show 10 import 'runtime_configuration.dart' show
11 RuntimeConfiguration; 11 RuntimeConfiguration;
12 12
13 import 'test_runner.dart' show 13 import 'test_runner.dart' show
14 Command, 14 Command,
15 CommandBuilder, 15 CommandBuilder,
16 CompilationCommand; 16 CompilationCommand;
17 17
18 import 'test_suite.dart' show 18 import 'test_suite.dart' show
19 TestInformation, 19 TestInformation;
20 TestUtils;
21 20
22 /// Grouping of a command with its expected result. 21 /// Grouping of a command with its expected result.
23 class CommandArtifact { 22 class CommandArtifact {
24 final List<Command> commands; 23 final List<Command> commands;
25 24
26 /// Expected result of running [command]. 25 /// Expected result of running [command].
27 final String filename; 26 final String filename;
28 27
29 /// MIME type of [filename]. 28 /// MIME type of [filename].
30 final String mimeType; 29 final String mimeType;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 String buildDir, 117 String buildDir,
119 String tempDir, 118 String tempDir,
120 CommandBuilder commandBuilder, 119 CommandBuilder commandBuilder,
121 List arguments, 120 List arguments,
122 Map<String, String> environmentOverrides) { 121 Map<String, String> environmentOverrides) {
123 return new CommandArtifact([], null, null); 122 return new CommandArtifact([], null, null);
124 } 123 }
125 124
126 List<String> computeRuntimeArguments( 125 List<String> computeRuntimeArguments(
127 RuntimeConfiguration runtimeConfiguration, 126 RuntimeConfiguration runtimeConfiguration,
128 String buildDir,
129 TestInformation info, 127 TestInformation info,
130 List<String> vmOptions, 128 List<String> vmOptions,
131 List<String> sharedOptions, 129 List<String> sharedOptions,
132 List<String> originalArguments, 130 List<String> originalArguments,
133 CommandArtifact artifact) { 131 CommandArtifact artifact) {
134 return <String>[artifact.filename]; 132 return <String>[artifact.filename];
135 } 133 }
136 } 134 }
137 135
138 /// The "none" compiler. 136 /// The "none" compiler.
139 class NoneCompilerConfiguration extends CompilerConfiguration { 137 class NoneCompilerConfiguration extends CompilerConfiguration {
140 NoneCompilerConfiguration({ 138 NoneCompilerConfiguration({
141 bool isDebug, 139 bool isDebug,
142 bool isChecked, 140 bool isChecked,
143 bool isHostChecked, 141 bool isHostChecked,
144 bool useSdk}) 142 bool useSdk})
145 : super._subclass( 143 : super._subclass(
146 isDebug: isDebug, isChecked: isChecked, 144 isDebug: isDebug, isChecked: isChecked,
147 isHostChecked: isHostChecked, useSdk: useSdk); 145 isHostChecked: isHostChecked, useSdk: useSdk);
148 146
149 bool get hasCompiler => false; 147 bool get hasCompiler => false;
150 148
151 List<String> computeRuntimeArguments( 149 List<String> computeRuntimeArguments(
152 RuntimeConfiguration runtimeConfiguration, 150 RuntimeConfiguration runtimeConfiguration,
153 String buildDir,
154 TestInformation info, 151 TestInformation info,
155 List<String> vmOptions, 152 List<String> vmOptions,
156 List<String> sharedOptions, 153 List<String> sharedOptions,
157 List<String> originalArguments, 154 List<String> originalArguments,
158 CommandArtifact artifact) { 155 CommandArtifact artifact) {
159 return <String>[] 156 return <String>[]
160 ..addAll(vmOptions) 157 ..addAll(vmOptions)
161 ..addAll(sharedOptions) 158 ..addAll(sharedOptions)
162 ..addAll(originalArguments); 159 ..addAll(originalArguments);
163 } 160 }
164 } 161 }
165 162
166 /// Common configuration for dart2js-based tools, such as, dart2js and 163 /// Common configuration for dart2js-based tools, such as, dart2js and
167 /// dart2dart. 164 /// dart2dart.
168 class Dart2xCompilerConfiguration extends CompilerConfiguration { 165 class Dart2xCompilerConfiguration extends CompilerConfiguration {
169 final String moniker; 166 final String moniker;
170 167
171 Dart2xCompilerConfiguration( 168 Dart2xCompilerConfiguration(
172 this.moniker, 169 this.moniker,
173 {bool isDebug, 170 {bool isDebug,
174 bool isChecked, 171 bool isChecked,
175 bool isHostChecked, 172 bool isHostChecked,
176 bool useSdk}) 173 bool useSdk})
177 : super._subclass( 174 : super._subclass(
178 isDebug: isDebug, isChecked: isChecked, 175 isDebug: isDebug, isChecked: isChecked,
179 isHostChecked: isHostChecked, useSdk: useSdk); 176 isHostChecked: isHostChecked, useSdk: useSdk);
180 177
181 String computeCompilerPath(String buildDir) { 178 String computeCompilerPath(String buildDir) {
182 var prefix = 'sdk/bin'; 179 var prefix = 'sdk/bin/';
183 String suffix = executableScriptSuffix; 180 String suffix = executableScriptSuffix;
184 if (isHostChecked) { 181 if (isHostChecked) {
185 // The script dart2js_developer is not included in the 182 // The script dart2js_developer is not included in the
186 // shipped SDK, that is the script is not installed in 183 // shipped SDK, that is the script is not installed in
187 // "$buildDir/dart-sdk/bin/" 184 // "$buildDir/dart-sdk/bin/"
188 return '$prefix/dart2js_developer$suffix'; 185 return '$prefix/dart2js_developer$suffix';
189 } else { 186 } else {
190 if (useSdk) { 187 if (useSdk) {
191 prefix = '$buildDir/dart-sdk/bin'; 188 prefix = '$buildDir/dart-sdk/bin';
192 } 189 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 CommandBuilder.instance, 255 CommandBuilder.instance,
259 arguments, 256 arguments,
260 environmentOverrides)], 257 environmentOverrides)],
261 // dart2js always produce both out.js and out.precompiled.js. To avoid 258 // dart2js always produce both out.js and out.precompiled.js. To avoid
262 // recompiling the CSP version, we always tell the CompilationCommand 259 // recompiling the CSP version, we always tell the CompilationCommand
263 // to track the timestamp of out.js, but select which one to run based 260 // to track the timestamp of out.js, but select which one to run based
264 // on CSP mode. 261 // on CSP mode.
265 isCsp ? cspOutput : normalOutput, 262 isCsp ? cspOutput : normalOutput,
266 'application/javascript'); 263 'application/javascript');
267 } 264 }
268
269 List<String> computeRuntimeArguments(
270 RuntimeConfiguration runtimeConfiguration,
271 String buildDir,
272 TestInformation info,
273 List<String> vmOptions,
274 List<String> sharedOptions,
275 List<String> originalArguments,
276 CommandArtifact artifact) {
277 Uri sdk = useSdk ?
278 nativeDirectoryToUri(buildDir).resolve('dart-sdk/') :
279 nativeDirectoryToUri(TestUtils.dartDir().toNativePath())
280 .resolve('sdk/');
281 Uri preambleDir = sdk.resolve('lib/_internal/lib/preambles/');
282 return runtimeConfiguration.dart2jsPreambles(preambleDir)
283 ..add(artifact.filename);
284 }
285 } 265 }
286 266
287 /// Configuration for dart2dart compiler. 267 /// Configuration for dart2dart compiler.
288 class Dart2dartCompilerConfiguration extends Dart2xCompilerConfiguration { 268 class Dart2dartCompilerConfiguration extends Dart2xCompilerConfiguration {
289 Dart2dartCompilerConfiguration({ 269 Dart2dartCompilerConfiguration({
290 bool isDebug, 270 bool isDebug,
291 bool isChecked, 271 bool isChecked,
292 bool isHostChecked, 272 bool isHostChecked,
293 bool useSdk}) 273 bool useSdk})
294 : super( 274 : super(
(...skipping 16 matching lines...) Expand all
311 buildDir, 291 buildDir,
312 CommandBuilder.instance, 292 CommandBuilder.instance,
313 arguments, 293 arguments,
314 environmentOverrides)], 294 environmentOverrides)],
315 outputFileName, 295 outputFileName,
316 'application/dart'); 296 'application/dart');
317 } 297 }
318 298
319 List<String> computeRuntimeArguments( 299 List<String> computeRuntimeArguments(
320 RuntimeConfiguration runtimeConfiguration, 300 RuntimeConfiguration runtimeConfiguration,
321 String buildDir,
322 TestInformation info, 301 TestInformation info,
323 List<String> vmOptions, 302 List<String> vmOptions,
324 List<String> sharedOptions, 303 List<String> sharedOptions,
325 List<String> originalArguments, 304 List<String> originalArguments,
326 CommandArtifact artifact) { 305 CommandArtifact artifact) {
327 // TODO(antonm): support checked. 306 // TODO(antonm): support checked.
328 return <String>[] 307 return <String>[]
329 ..addAll(vmOptions) 308 ..addAll(vmOptions)
330 ..add('--ignore-unrecognized-flags') 309 ..add('--ignore-unrecognized-flags')
331 ..add(artifact.filename); 310 ..add(artifact.filename);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 commandBuilder.getAnalysisCommand( 345 commandBuilder.getAnalysisCommand(
367 moniker, computeCompilerPath(buildDir), arguments, 346 moniker, computeCompilerPath(buildDir), arguments,
368 environmentOverrides, 347 environmentOverrides,
369 flavor: moniker)], 348 flavor: moniker)],
370 null, null); // Since this is not a real compilation, no artifacts are 349 null, null); // Since this is not a real compilation, no artifacts are
371 // produced. 350 // produced.
372 } 351 }
373 352
374 List<String> computeRuntimeArguments( 353 List<String> computeRuntimeArguments(
375 RuntimeConfiguration runtimeConfiguration, 354 RuntimeConfiguration runtimeConfiguration,
376 String buildDir,
377 TestInformation info, 355 TestInformation info,
378 List<String> vmOptions, 356 List<String> vmOptions,
379 List<String> sharedOptions, 357 List<String> sharedOptions,
380 List<String> originalArguments, 358 List<String> originalArguments,
381 CommandArtifact artifact) { 359 CommandArtifact artifact) {
382 return <String>[]; 360 return <String>[];
383 } 361 }
384 } 362 }
385 363
386 class DartBasedAnalyzerCompilerConfiguration 364 class DartBasedAnalyzerCompilerConfiguration
387 extends AnalyzerCompilerConfiguration { 365 extends AnalyzerCompilerConfiguration {
388 DartBasedAnalyzerCompilerConfiguration({ 366 DartBasedAnalyzerCompilerConfiguration({
389 bool isDebug, 367 bool isDebug,
390 bool isChecked, 368 bool isChecked,
391 bool isHostChecked, 369 bool isHostChecked,
392 bool useSdk}) 370 bool useSdk})
393 : super( 371 : super(
394 'dart2analyzer', isDebug: isDebug, isChecked: isChecked, 372 'dart2analyzer', isDebug: isDebug, isChecked: isChecked,
395 isHostChecked: isHostChecked, useSdk: useSdk); 373 isHostChecked: isHostChecked, useSdk: useSdk);
396 374
397 String computeCompilerPath(String buildDir) => 'editor/tools/analyzer'; 375 String computeCompilerPath(String buildDir) => 'editor/tools/analyzer';
398 } 376 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/preambles/jsshell.js ('k') | tools/testing/dart/runtime_configuration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698