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

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

Issue 1507943002: Add ./tools/test.py -c precompiler -r dart_precompiled. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
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
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 case 'dart2analyzer': 71 case 'dart2analyzer':
72 return new DartBasedAnalyzerCompilerConfiguration( 72 return new DartBasedAnalyzerCompilerConfiguration(
73 isDebug: isDebug, isChecked: isChecked, 73 isDebug: isDebug, isChecked: isChecked,
74 isHostChecked: isHostChecked, useSdk: useSdk); 74 isHostChecked: isHostChecked, useSdk: useSdk);
75 case 'dart2js': 75 case 'dart2js':
76 return new Dart2jsCompilerConfiguration( 76 return new Dart2jsCompilerConfiguration(
77 isDebug: isDebug, isChecked: isChecked, 77 isDebug: isDebug, isChecked: isChecked,
78 isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk, 78 isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk,
79 isCsp: isCsp, extraDart2jsOptions: 79 isCsp: isCsp, extraDart2jsOptions:
80 TestUtils.getExtraOptions(configuration, 'dart2js_options')); 80 TestUtils.getExtraOptions(configuration, 'dart2js_options'));
81 case 'precompiler':
82 return new PrecompilerCompilerConfiguration(
83 isDebug: isDebug, isChecked: isChecked);
81 case 'none': 84 case 'none':
82 return new NoneCompilerConfiguration( 85 return new NoneCompilerConfiguration(
83 isDebug: isDebug, isChecked: isChecked, 86 isDebug: isDebug, isChecked: isChecked,
84 isHostChecked: isHostChecked, useSdk: useSdk, useNoopt: useNoopt); 87 isHostChecked: isHostChecked, useSdk: useSdk, useNoopt: useNoopt);
85 default: 88 default:
86 throw "Unknown compiler '$compiler'"; 89 throw "Unknown compiler '$compiler'";
87 } 90 }
88 } 91 }
89 92
90 CompilerConfiguration._subclass({ 93 CompilerConfiguration._subclass({
(...skipping 25 matching lines...) Expand all
116 119
117 CommandArtifact computeCompilationArtifact( 120 CommandArtifact computeCompilationArtifact(
118 String buildDir, 121 String buildDir,
119 String tempDir, 122 String tempDir,
120 CommandBuilder commandBuilder, 123 CommandBuilder commandBuilder,
121 List arguments, 124 List arguments,
122 Map<String, String> environmentOverrides) { 125 Map<String, String> environmentOverrides) {
123 return new CommandArtifact([], null, null); 126 return new CommandArtifact([], null, null);
124 } 127 }
125 128
129 List<String> computeCompilerArguments(vmOptions, sharedOptions, args) {
130 return new List<String>()
131 ..addAll(sharedOptions)
132 ..addAll(args);
133 }
134
126 List<String> computeRuntimeArguments( 135 List<String> computeRuntimeArguments(
127 RuntimeConfiguration runtimeConfiguration, 136 RuntimeConfiguration runtimeConfiguration,
128 String buildDir, 137 String buildDir,
129 TestInformation info, 138 TestInformation info,
130 List<String> vmOptions, 139 List<String> vmOptions,
131 List<String> sharedOptions, 140 List<String> sharedOptions,
132 List<String> originalArguments, 141 List<String> originalArguments,
133 CommandArtifact artifact) { 142 CommandArtifact artifact) {
134 return <String>[artifact.filename]; 143 return <String>[artifact.filename];
135 } 144 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 Uri sdk = useSdk ? 300 Uri sdk = useSdk ?
292 nativeDirectoryToUri(buildDir).resolve('dart-sdk/') : 301 nativeDirectoryToUri(buildDir).resolve('dart-sdk/') :
293 nativeDirectoryToUri(TestUtils.dartDir.toNativePath()).resolve('sdk/'); 302 nativeDirectoryToUri(TestUtils.dartDir.toNativePath()).resolve('sdk/');
294 Uri preambleDir = sdk.resolve( 303 Uri preambleDir = sdk.resolve(
295 'lib/_internal/js_runtime/lib/preambles/'); 304 'lib/_internal/js_runtime/lib/preambles/');
296 return runtimeConfiguration.dart2jsPreambles(preambleDir) 305 return runtimeConfiguration.dart2jsPreambles(preambleDir)
297 ..add(artifact.filename); 306 ..add(artifact.filename);
298 } 307 }
299 } 308 }
300 309
310
311 class PrecompilerCompilerConfiguration extends CompilerConfiguration {
312 PrecompilerCompilerConfiguration({
313 bool isDebug,
314 bool isChecked})
315 : super._subclass(isDebug: isDebug, isChecked: isChecked);
316
317 int computeTimeoutMultiplier() {
318 int multiplier = 2;
319 if (isDebug) multiplier *= 4;
320 if (isChecked) multiplier *= 2;
321 return multiplier;
322 }
323
324 CommandArtifact computeCompilationArtifact(
325 String buildDir,
326 String tempDir,
327 CommandBuilder commandBuilder,
328 List arguments,
329 Map<String, String> environmentOverrides) {
330 return new CommandArtifact(
331 <Command>[
332 this.computeCompilationCommand(
333 tempDir,
334 buildDir,
335 CommandBuilder.instance,
336 arguments,
337 environmentOverrides)],
338 '$tempDir',
339 'application/dart-precompiled');
340 }
341
342 CompilationCommand computeCompilationCommand(
343 String outputFileName,
Florian Schneider 2015/12/17 12:53:25 This is really the directory, right? s/outputFile
rmacnak 2015/12/17 19:20:51 Yes.
344 String buildDir,
345 CommandBuilder commandBuilder,
346 List arguments,
347 Map<String, String> environmentOverrides) {
348 var exec = "$buildDir/dart";
349 var args = new List();
350 args.add("tools/precompilation/precompiler.dart");
351 args.add("$buildDir/dart_no_snapshot");
352 args.add("--gen-precompiled-snapshot=$outputFileName");
353 args.addAll(arguments);
354
355 return commandBuilder.getCompilationCommand(
356 'precompiler.dart', outputFileName, !useSdk,
357 bootstrapDependencies(buildDir),
358 exec, args, environmentOverrides);
359 }
360
361 List<String> computeCompilerArguments(vmOptions,
362 sharedOptions,
363 originalArguments) {
364 List<String> args = [];
365 if (isChecked) {
366 args.add('--enable_asserts');
367 args.add('--enable_type_checks');
368 }
369 return args
370 ..addAll(vmOptions)
371 ..addAll(sharedOptions)
372 ..addAll(originalArguments);
373 }
374
375 List<String> computeRuntimeArguments(
376 RuntimeConfiguration runtimeConfiguration,
377 String buildDir,
378 TestInformation info,
379 List<String> vmOptions,
380 List<String> sharedOptions,
381 List<String> originalArguments,
382 CommandArtifact artifact) {
383 List<String> args = [];
384 if (isChecked) {
385 args.add('--enable_asserts');
386 args.add('--enable_type_checks');
387 }
388 return args
389 ..addAll(vmOptions)
390 ..addAll(sharedOptions)
391 ..addAll(originalArguments);
392 }
393 }
394
395
301 /// Common configuration for analyzer-based tools, such as, dartanalyzer. 396 /// Common configuration for analyzer-based tools, such as, dartanalyzer.
302 class AnalyzerCompilerConfiguration extends CompilerConfiguration { 397 class AnalyzerCompilerConfiguration extends CompilerConfiguration {
303 final String moniker; 398 final String moniker;
304 399
305 AnalyzerCompilerConfiguration( 400 AnalyzerCompilerConfiguration(
306 this.moniker, 401 this.moniker,
307 {bool isDebug, 402 {bool isDebug,
308 bool isChecked, 403 bool isChecked,
309 bool isHostChecked, 404 bool isHostChecked,
310 bool useSdk}) 405 bool useSdk})
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // shipped SDK, that is the script is not installed in 470 // shipped SDK, that is the script is not installed in
376 // "$buildDir/dart-sdk/bin/" 471 // "$buildDir/dart-sdk/bin/"
377 return '$prefix/dartanalyzer_developer$suffix'; 472 return '$prefix/dartanalyzer_developer$suffix';
378 } 473 }
379 if (useSdk) { 474 if (useSdk) {
380 prefix = '$buildDir/dart-sdk/bin'; 475 prefix = '$buildDir/dart-sdk/bin';
381 } 476 }
382 return '$prefix/dartanalyzer$suffix'; 477 return '$prefix/dartanalyzer$suffix';
383 } 478 }
384 } 479 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698