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

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

Issue 183743032: Reapply "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: Correctly break a string that is a long line. 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;
20 21
21 /// Grouping of a command with its expected result. 22 /// Grouping of a command with its expected result.
22 class CommandArtifact { 23 class CommandArtifact {
23 final List<Command> commands; 24 final List<Command> commands;
24 25
25 /// Expected result of running [command]. 26 /// Expected result of running [command].
26 final String filename; 27 final String filename;
27 28
28 /// MIME type of [filename]. 29 /// MIME type of [filename].
29 final String mimeType; 30 final String mimeType;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 String buildDir, 118 String buildDir,
118 String tempDir, 119 String tempDir,
119 CommandBuilder commandBuilder, 120 CommandBuilder commandBuilder,
120 List arguments, 121 List arguments,
121 Map<String, String> environmentOverrides) { 122 Map<String, String> environmentOverrides) {
122 return new CommandArtifact([], null, null); 123 return new CommandArtifact([], null, null);
123 } 124 }
124 125
125 List<String> computeRuntimeArguments( 126 List<String> computeRuntimeArguments(
126 RuntimeConfiguration runtimeConfiguration, 127 RuntimeConfiguration runtimeConfiguration,
128 String buildDir,
127 TestInformation info, 129 TestInformation info,
128 List<String> vmOptions, 130 List<String> vmOptions,
129 List<String> sharedOptions, 131 List<String> sharedOptions,
130 List<String> originalArguments, 132 List<String> originalArguments,
131 CommandArtifact artifact) { 133 CommandArtifact artifact) {
132 return <String>[artifact.filename]; 134 return <String>[artifact.filename];
133 } 135 }
134 } 136 }
135 137
136 /// The "none" compiler. 138 /// The "none" compiler.
137 class NoneCompilerConfiguration extends CompilerConfiguration { 139 class NoneCompilerConfiguration extends CompilerConfiguration {
138 NoneCompilerConfiguration({ 140 NoneCompilerConfiguration({
139 bool isDebug, 141 bool isDebug,
140 bool isChecked, 142 bool isChecked,
141 bool isHostChecked, 143 bool isHostChecked,
142 bool useSdk}) 144 bool useSdk})
143 : super._subclass( 145 : super._subclass(
144 isDebug: isDebug, isChecked: isChecked, 146 isDebug: isDebug, isChecked: isChecked,
145 isHostChecked: isHostChecked, useSdk: useSdk); 147 isHostChecked: isHostChecked, useSdk: useSdk);
146 148
147 bool get hasCompiler => false; 149 bool get hasCompiler => false;
148 150
149 List<String> computeRuntimeArguments( 151 List<String> computeRuntimeArguments(
150 RuntimeConfiguration runtimeConfiguration, 152 RuntimeConfiguration runtimeConfiguration,
153 String buildDir,
151 TestInformation info, 154 TestInformation info,
152 List<String> vmOptions, 155 List<String> vmOptions,
153 List<String> sharedOptions, 156 List<String> sharedOptions,
154 List<String> originalArguments, 157 List<String> originalArguments,
155 CommandArtifact artifact) { 158 CommandArtifact artifact) {
156 return <String>[] 159 return <String>[]
157 ..addAll(vmOptions) 160 ..addAll(vmOptions)
158 ..addAll(sharedOptions) 161 ..addAll(sharedOptions)
159 ..addAll(originalArguments); 162 ..addAll(originalArguments);
160 } 163 }
161 } 164 }
162 165
163 /// Common configuration for dart2js-based tools, such as, dart2js and 166 /// Common configuration for dart2js-based tools, such as, dart2js and
164 /// dart2dart. 167 /// dart2dart.
165 class Dart2xCompilerConfiguration extends CompilerConfiguration { 168 class Dart2xCompilerConfiguration extends CompilerConfiguration {
166 final String moniker; 169 final String moniker;
167 170
168 Dart2xCompilerConfiguration( 171 Dart2xCompilerConfiguration(
169 this.moniker, 172 this.moniker,
170 {bool isDebug, 173 {bool isDebug,
171 bool isChecked, 174 bool isChecked,
172 bool isHostChecked, 175 bool isHostChecked,
173 bool useSdk}) 176 bool useSdk})
174 : super._subclass( 177 : super._subclass(
175 isDebug: isDebug, isChecked: isChecked, 178 isDebug: isDebug, isChecked: isChecked,
176 isHostChecked: isHostChecked, useSdk: useSdk); 179 isHostChecked: isHostChecked, useSdk: useSdk);
177 180
178 String computeCompilerPath(String buildDir) { 181 String computeCompilerPath(String buildDir) {
179 var prefix = 'sdk/bin/'; 182 var prefix = 'sdk/bin';
180 String suffix = executableScriptSuffix; 183 String suffix = executableScriptSuffix;
181 if (isHostChecked) { 184 if (isHostChecked) {
182 // The script dart2js_developer is not included in the 185 // The script dart2js_developer is not included in the
183 // shipped SDK, that is the script is not installed in 186 // shipped SDK, that is the script is not installed in
184 // "$buildDir/dart-sdk/bin/" 187 // "$buildDir/dart-sdk/bin/"
185 return '$prefix/dart2js_developer$suffix'; 188 return '$prefix/dart2js_developer$suffix';
186 } else { 189 } else {
187 if (useSdk) { 190 if (useSdk) {
188 prefix = '$buildDir/dart-sdk/bin'; 191 prefix = '$buildDir/dart-sdk/bin';
189 } 192 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 CommandBuilder.instance, 258 CommandBuilder.instance,
256 arguments, 259 arguments,
257 environmentOverrides)], 260 environmentOverrides)],
258 // dart2js always produce both out.js and out.precompiled.js. To avoid 261 // dart2js always produce both out.js and out.precompiled.js. To avoid
259 // recompiling the CSP version, we always tell the CompilationCommand 262 // recompiling the CSP version, we always tell the CompilationCommand
260 // to track the timestamp of out.js, but select which one to run based 263 // to track the timestamp of out.js, but select which one to run based
261 // on CSP mode. 264 // on CSP mode.
262 isCsp ? cspOutput : normalOutput, 265 isCsp ? cspOutput : normalOutput,
263 'application/javascript'); 266 'application/javascript');
264 } 267 }
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 }
265 } 285 }
266 286
267 /// Configuration for dart2dart compiler. 287 /// Configuration for dart2dart compiler.
268 class Dart2dartCompilerConfiguration extends Dart2xCompilerConfiguration { 288 class Dart2dartCompilerConfiguration extends Dart2xCompilerConfiguration {
269 Dart2dartCompilerConfiguration({ 289 Dart2dartCompilerConfiguration({
270 bool isDebug, 290 bool isDebug,
271 bool isChecked, 291 bool isChecked,
272 bool isHostChecked, 292 bool isHostChecked,
273 bool useSdk}) 293 bool useSdk})
274 : super( 294 : super(
(...skipping 16 matching lines...) Expand all
291 buildDir, 311 buildDir,
292 CommandBuilder.instance, 312 CommandBuilder.instance,
293 arguments, 313 arguments,
294 environmentOverrides)], 314 environmentOverrides)],
295 outputFileName, 315 outputFileName,
296 'application/dart'); 316 'application/dart');
297 } 317 }
298 318
299 List<String> computeRuntimeArguments( 319 List<String> computeRuntimeArguments(
300 RuntimeConfiguration runtimeConfiguration, 320 RuntimeConfiguration runtimeConfiguration,
321 String buildDir,
301 TestInformation info, 322 TestInformation info,
302 List<String> vmOptions, 323 List<String> vmOptions,
303 List<String> sharedOptions, 324 List<String> sharedOptions,
304 List<String> originalArguments, 325 List<String> originalArguments,
305 CommandArtifact artifact) { 326 CommandArtifact artifact) {
306 // TODO(antonm): support checked. 327 // TODO(antonm): support checked.
307 return <String>[] 328 return <String>[]
308 ..addAll(vmOptions) 329 ..addAll(vmOptions)
309 ..add('--ignore-unrecognized-flags') 330 ..add('--ignore-unrecognized-flags')
310 ..add(artifact.filename); 331 ..add(artifact.filename);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 commandBuilder.getAnalysisCommand( 366 commandBuilder.getAnalysisCommand(
346 moniker, computeCompilerPath(buildDir), arguments, 367 moniker, computeCompilerPath(buildDir), arguments,
347 environmentOverrides, 368 environmentOverrides,
348 flavor: moniker)], 369 flavor: moniker)],
349 null, null); // Since this is not a real compilation, no artifacts are 370 null, null); // Since this is not a real compilation, no artifacts are
350 // produced. 371 // produced.
351 } 372 }
352 373
353 List<String> computeRuntimeArguments( 374 List<String> computeRuntimeArguments(
354 RuntimeConfiguration runtimeConfiguration, 375 RuntimeConfiguration runtimeConfiguration,
376 String buildDir,
355 TestInformation info, 377 TestInformation info,
356 List<String> vmOptions, 378 List<String> vmOptions,
357 List<String> sharedOptions, 379 List<String> sharedOptions,
358 List<String> originalArguments, 380 List<String> originalArguments,
359 CommandArtifact artifact) { 381 CommandArtifact artifact) {
360 return <String>[]; 382 return <String>[];
361 } 383 }
362 } 384 }
363 385
364 class DartBasedAnalyzerCompilerConfiguration 386 class DartBasedAnalyzerCompilerConfiguration
365 extends AnalyzerCompilerConfiguration { 387 extends AnalyzerCompilerConfiguration {
366 DartBasedAnalyzerCompilerConfiguration({ 388 DartBasedAnalyzerCompilerConfiguration({
367 bool isDebug, 389 bool isDebug,
368 bool isChecked, 390 bool isChecked,
369 bool isHostChecked, 391 bool isHostChecked,
370 bool useSdk}) 392 bool useSdk})
371 : super( 393 : super(
372 'dart2analyzer', isDebug: isDebug, isChecked: isChecked, 394 'dart2analyzer', isDebug: isDebug, isChecked: isChecked,
373 isHostChecked: isHostChecked, useSdk: useSdk); 395 isHostChecked: isHostChecked, useSdk: useSdk);
374 396
375 String computeCompilerPath(String buildDir) => 'editor/tools/analyzer'; 397 String computeCompilerPath(String buildDir) => 'editor/tools/analyzer';
376 } 398 }
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