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

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

Issue 1537653002: Remove old java-based analyzer from test scripts and status files (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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // object. 57 // object.
58 bool isDebug = configuration['mode'] == 'debug'; 58 bool isDebug = configuration['mode'] == 'debug';
59 bool isChecked = configuration['checked']; 59 bool isChecked = configuration['checked'];
60 bool isHostChecked = configuration['host_checked']; 60 bool isHostChecked = configuration['host_checked'];
61 bool useSdk = configuration['use_sdk']; 61 bool useSdk = configuration['use_sdk'];
62 bool isCsp = configuration['csp']; 62 bool isCsp = configuration['csp'];
63 bool useCps = configuration['cps_ir']; 63 bool useCps = configuration['cps_ir'];
64 bool useNoopt = configuration['noopt']; 64 bool useNoopt = configuration['noopt'];
65 65
66 switch (compiler) { 66 switch (compiler) {
67 case 'dartanalyzer': 67 case 'dart2analyzer':
68 return new AnalyzerCompilerConfiguration( 68 return new AnalyzerCompilerConfiguration(
69 'dartanalyzer', isDebug: isDebug, isChecked: isChecked,
70 isHostChecked: isHostChecked, useSdk: useSdk);
71 case 'dart2analyzer':
72 return new DartBasedAnalyzerCompilerConfiguration(
73 isDebug: isDebug, isChecked: isChecked, 69 isDebug: isDebug, isChecked: isChecked,
74 isHostChecked: isHostChecked, useSdk: useSdk); 70 isHostChecked: isHostChecked, useSdk: useSdk);
75 case 'dart2js': 71 case 'dart2js':
76 return new Dart2jsCompilerConfiguration( 72 return new Dart2jsCompilerConfiguration(
77 isDebug: isDebug, isChecked: isChecked, 73 isDebug: isDebug, isChecked: isChecked,
78 isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk, 74 isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk,
79 isCsp: isCsp, extraDart2jsOptions: 75 isCsp: isCsp, extraDart2jsOptions:
80 TestUtils.getExtraOptions(configuration, 'dart2js_options')); 76 TestUtils.getExtraOptions(configuration, 'dart2js_options'));
81 case 'none': 77 case 'none':
82 return new NoneCompilerConfiguration( 78 return new NoneCompilerConfiguration(
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 Uri sdk = useSdk ? 287 Uri sdk = useSdk ?
292 nativeDirectoryToUri(buildDir).resolve('dart-sdk/') : 288 nativeDirectoryToUri(buildDir).resolve('dart-sdk/') :
293 nativeDirectoryToUri(TestUtils.dartDir.toNativePath()).resolve('sdk/'); 289 nativeDirectoryToUri(TestUtils.dartDir.toNativePath()).resolve('sdk/');
294 Uri preambleDir = sdk.resolve( 290 Uri preambleDir = sdk.resolve(
295 'lib/_internal/js_runtime/lib/preambles/'); 291 'lib/_internal/js_runtime/lib/preambles/');
296 return runtimeConfiguration.dart2jsPreambles(preambleDir) 292 return runtimeConfiguration.dart2jsPreambles(preambleDir)
297 ..add(artifact.filename); 293 ..add(artifact.filename);
298 } 294 }
299 } 295 }
300 296
301 /// Common configuration for analyzer-based tools, such as, dartanalyzer.
302 class AnalyzerCompilerConfiguration extends CompilerConfiguration { 297 class AnalyzerCompilerConfiguration extends CompilerConfiguration {
303 final String moniker;
304
305 AnalyzerCompilerConfiguration( 298 AnalyzerCompilerConfiguration(
306 this.moniker,
307 {bool isDebug, 299 {bool isDebug,
308 bool isChecked, 300 bool isChecked,
309 bool isHostChecked, 301 bool isHostChecked,
310 bool useSdk}) 302 bool useSdk})
311 : super._subclass( 303 : super._subclass(
312 isDebug: isDebug, isChecked: isChecked, 304 isDebug: isDebug, isChecked: isChecked,
313 isHostChecked: isHostChecked, useSdk: useSdk); 305 isHostChecked: isHostChecked, useSdk: useSdk);
314 306
315 int computeTimeoutMultiplier() { 307 int computeTimeoutMultiplier() {
316 return 4; 308 return 4;
317 } 309 }
318 310
319 String computeCompilerPath(String buildDir) { 311 String computeCompilerPath(String buildDir) {
312 var prefix = 'sdk/bin';
320 String suffix = executableScriptSuffix; 313 String suffix = executableScriptSuffix;
321 return 'sdk/bin/dartanalyzer_java$suffix'; 314 if (isHostChecked) {
315 if (useSdk) {
316 throw "--host-checked and --use-sdk cannot be used together";
317 }
318 // The script dartanalyzer_developer is not included in the
319 // shipped SDK, that is the script is not installed in
320 // "$buildDir/dart-sdk/bin/"
321 return '$prefix/dartanalyzer_developer$suffix';
322 }
323 if (useSdk) {
324 prefix = '$buildDir/dart-sdk/bin';
325 }
326 return '$prefix/dartanalyzer$suffix';
322 } 327 }
323 328
324 CommandArtifact computeCompilationArtifact( 329 CommandArtifact computeCompilationArtifact(
325 String buildDir, 330 String buildDir,
326 String tempDir, 331 String tempDir,
327 CommandBuilder commandBuilder, 332 CommandBuilder commandBuilder,
328 List arguments, 333 List arguments,
329 Map<String, String> environmentOverrides) { 334 Map<String, String> environmentOverrides) {
330 arguments = new List.from(arguments); 335 arguments = new List.from(arguments);
331 if (isChecked) { 336 if (isChecked) {
332 arguments.add('--enable_type_checks'); 337 arguments.add('--enable_type_checks');
333 } 338 }
334 return new CommandArtifact( 339 return new CommandArtifact(
335 <Command>[ 340 <Command>[
336 commandBuilder.getAnalysisCommand( 341 commandBuilder.getAnalysisCommand(
337 moniker, computeCompilerPath(buildDir), arguments, 342 'dart2analyzer', computeCompilerPath(buildDir), arguments,
338 environmentOverrides, 343 environmentOverrides,
339 flavor: moniker)], 344 flavor: 'dart2analyzer')],
340 null, null); // Since this is not a real compilation, no artifacts are 345 null, null); // Since this is not a real compilation, no artifacts are
341 // produced. 346 // produced.
342 } 347 }
343 348
344 List<String> computeRuntimeArguments( 349 List<String> computeRuntimeArguments(
345 RuntimeConfiguration runtimeConfiguration, 350 RuntimeConfiguration runtimeConfiguration,
346 String buildDir, 351 String buildDir,
347 TestInformation info, 352 TestInformation info,
348 List<String> vmOptions, 353 List<String> vmOptions,
349 List<String> sharedOptions, 354 List<String> sharedOptions,
350 List<String> originalArguments, 355 List<String> originalArguments,
351 CommandArtifact artifact) { 356 CommandArtifact artifact) {
352 return <String>[]; 357 return <String>[];
353 } 358 }
354 } 359 }
355
356 class DartBasedAnalyzerCompilerConfiguration
357 extends AnalyzerCompilerConfiguration {
358 DartBasedAnalyzerCompilerConfiguration({
359 bool isDebug,
360 bool isChecked,
361 bool isHostChecked,
362 bool useSdk})
363 : super(
364 'dart2analyzer', isDebug: isDebug, isChecked: isChecked,
365 isHostChecked: isHostChecked, useSdk: useSdk);
366
367 String computeCompilerPath(String buildDir) {
368 var prefix = 'sdk/bin';
369 String suffix = executableScriptSuffix;
370 if (isHostChecked) {
371 if (useSdk) {
372 throw "--host-checked and --use-sdk cannot be used together";
373 }
374 // The script dartanalyzer_developer is not included in the
375 // shipped SDK, that is the script is not installed in
376 // "$buildDir/dart-sdk/bin/"
377 return '$prefix/dartanalyzer_developer$suffix';
378 }
379 if (useSdk) {
380 prefix = '$buildDir/dart-sdk/bin';
381 }
382 return '$prefix/dartanalyzer$suffix';
383 }
384 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698