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

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

Issue 1903583002: GN Build fixes for Flutter + gen_snapshot fix (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « runtime/vm/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 Platform; 7 import 'dart:io' show Directory, Platform;
8 8
9 import 'runtime_configuration.dart' show RuntimeConfiguration; 9 import 'runtime_configuration.dart' show RuntimeConfiguration;
10 10
11 import 'test_runner.dart' show Command, CommandBuilder, CompilationCommand; 11 import 'test_runner.dart' show Command, CommandBuilder, CompilationCommand;
12 12
13 import 'test_suite.dart' show TestInformation, TestUtils; 13 import 'test_suite.dart' show TestInformation, TestUtils;
14 14
15 /// Grouping of a command with its expected result. 15 /// Grouping of a command with its expected result.
16 class CommandArtifact { 16 class CommandArtifact {
17 final List<Command> commands; 17 final List<Command> commands;
(...skipping 22 matching lines...) Expand all
40 // TODO(ahe): Remove this constructor and move the switch to 40 // TODO(ahe): Remove this constructor and move the switch to
41 // test_options.dart. We probably want to store an instance of 41 // test_options.dart. We probably want to store an instance of
42 // [CompilerConfiguration] in [configuration] there. 42 // [CompilerConfiguration] in [configuration] there.
43 factory CompilerConfiguration(Map configuration) { 43 factory CompilerConfiguration(Map configuration) {
44 String compiler = configuration['compiler']; 44 String compiler = configuration['compiler'];
45 45
46 // TODO(ahe): Move these booleans into a struction configuration object 46 // TODO(ahe): Move these booleans into a struction configuration object
47 // which can eventually completely replace the Map-based configuration 47 // which can eventually completely replace the Map-based configuration
48 // object. 48 // object.
49 bool isDebug = configuration['mode'] == 'debug'; 49 bool isDebug = configuration['mode'] == 'debug';
50 bool isProduct = configuration['mode'] == 'product';
50 bool isChecked = configuration['checked']; 51 bool isChecked = configuration['checked'];
51 bool isHostChecked = configuration['host_checked']; 52 bool isHostChecked = configuration['host_checked'];
52 bool useSdk = configuration['use_sdk']; 53 bool useSdk = configuration['use_sdk'];
53 bool isCsp = configuration['csp']; 54 bool isCsp = configuration['csp'];
54 bool useCps = configuration['cps_ir']; 55 bool useCps = configuration['cps_ir'];
55 56
56 switch (compiler) { 57 switch (compiler) {
57 case 'dart2analyzer': 58 case 'dart2analyzer':
58 return new AnalyzerCompilerConfiguration( 59 return new AnalyzerCompilerConfiguration(
59 isDebug: isDebug, 60 isDebug: isDebug,
(...skipping 10 matching lines...) Expand all
70 isCsp: isCsp, 71 isCsp: isCsp,
71 extraDart2jsOptions: 72 extraDart2jsOptions:
72 TestUtils.getExtraOptions(configuration, 'dart2js_options')); 73 TestUtils.getExtraOptions(configuration, 'dart2js_options'));
73 case 'dart2app': 74 case 'dart2app':
74 return new Dart2AppSnapshotCompilerConfiguration( 75 return new Dart2AppSnapshotCompilerConfiguration(
75 isDebug: isDebug, isChecked: isChecked); 76 isDebug: isDebug, isChecked: isChecked);
76 case 'precompiler': 77 case 'precompiler':
77 return new PrecompilerCompilerConfiguration( 78 return new PrecompilerCompilerConfiguration(
78 isDebug: isDebug, 79 isDebug: isDebug,
79 isChecked: isChecked, 80 isChecked: isChecked,
81 isProduct: isProduct,
80 arch: configuration['arch']); 82 arch: configuration['arch']);
81 case 'none': 83 case 'none':
82 return new NoneCompilerConfiguration( 84 return new NoneCompilerConfiguration(
83 isDebug: isDebug, 85 isDebug: isDebug,
84 isChecked: isChecked, 86 isChecked: isChecked,
85 isHostChecked: isHostChecked, 87 isHostChecked: isHostChecked,
86 useSdk: useSdk); 88 useSdk: useSdk);
87 default: 89 default:
88 throw "Unknown compiler '$compiler'"; 90 throw "Unknown compiler '$compiler'";
89 } 91 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 : nativeDirectoryToUri(TestUtils.dartDir.toNativePath()) 294 : nativeDirectoryToUri(TestUtils.dartDir.toNativePath())
293 .resolve('sdk/'); 295 .resolve('sdk/');
294 Uri preambleDir = sdk.resolve('lib/_internal/js_runtime/lib/preambles/'); 296 Uri preambleDir = sdk.resolve('lib/_internal/js_runtime/lib/preambles/');
295 return runtimeConfiguration.dart2jsPreambles(preambleDir) 297 return runtimeConfiguration.dart2jsPreambles(preambleDir)
296 ..add(artifact.filename); 298 ..add(artifact.filename);
297 } 299 }
298 } 300 }
299 301
300 class PrecompilerCompilerConfiguration extends CompilerConfiguration { 302 class PrecompilerCompilerConfiguration extends CompilerConfiguration {
301 final String arch; 303 final String arch;
304 final bool isProduct;
302 305
303 PrecompilerCompilerConfiguration({bool isDebug, bool isChecked, String arch}) 306 PrecompilerCompilerConfiguration(
307 {bool isDebug, bool isChecked, bool isProduct, String arch})
304 : super._subclass(isDebug: isDebug, isChecked: isChecked), 308 : super._subclass(isDebug: isDebug, isChecked: isChecked),
309 isProduct = isProduct,
305 arch = arch; 310 arch = arch;
306 311
307 int computeTimeoutMultiplier() { 312 int computeTimeoutMultiplier() {
308 int multiplier = 2; 313 int multiplier = 2;
309 if (isDebug) multiplier *= 4; 314 if (isDebug) multiplier *= 4;
310 if (isChecked) multiplier *= 2; 315 if (isChecked) multiplier *= 2;
311 return multiplier; 316 return multiplier;
312 } 317 }
313 318
314 CommandArtifact computeCompilationArtifact( 319 CommandArtifact computeCompilationArtifact(
(...skipping 11 matching lines...) Expand all
326 CommandBuilder.instance, arguments, environmentOverrides) 331 CommandBuilder.instance, arguments, environmentOverrides)
327 ], '$tempDir', 'application/dart-precompiled'); 332 ], '$tempDir', 'application/dart-precompiled');
328 } 333 }
329 334
330 CompilationCommand computeCompilationCommand( 335 CompilationCommand computeCompilationCommand(
331 String tempDir, 336 String tempDir,
332 String buildDir, 337 String buildDir,
333 CommandBuilder commandBuilder, 338 CommandBuilder commandBuilder,
334 List arguments, 339 List arguments,
335 Map<String, String> environmentOverrides) { 340 Map<String, String> environmentOverrides) {
336 var exec = "$buildDir/dart_bootstrap"; 341 var sourceDir = Directory.current.path;
342 var exec = "$buildDir/gen_snapshot";
337 var args = new List(); 343 var args = new List();
338 args.add("--gen-precompiled-snapshot=$tempDir"); 344
345 var precompiledVMIsolate = "$tempDir/precompiled.vmisolate";
346 var precompiledIsolate = "$tempDir/precompiled.isolate";
347 var precompiledInstructions = "$tempDir/precompiled.S";
348 var dartProductEntries = "$sourceDir/runtime/bin/dart_product_entries.txt";
349 var dartEntries = "$sourceDir/runtime/bin/dart_entries.txt";
350 var vmServiceIoMain = "$sourceDir/runtime/bin/vmservice/vmservice_io.dart";
351
352 args.add("--embedder_entry_points_manifest=$dartProductEntries");
353 if (!isProduct) {
354 args.add("--embedder_entry_points_manifest=$dartEntries");
355 }
356 args.add("--vm_isolate_snapshot=$precompiledVMIsolate");
357 args.add("--isolate_snapshot=$precompiledIsolate");
358 args.add("--instructions_snapshot=$precompiledInstructions");
359 args.add("--url_mapping=dart:vmservice_io,$vmServiceIoMain");
339 args.addAll(arguments); 360 args.addAll(arguments);
340 361
341 return commandBuilder.getCompilationCommand('precompiler', tempDir, !useSdk, 362 return commandBuilder.getCompilationCommand('precompiler', tempDir, !useSdk,
342 bootstrapDependencies(buildDir), exec, args, environmentOverrides); 363 bootstrapDependencies(buildDir), exec, args, environmentOverrides);
343 } 364 }
344 365
345 CompilationCommand computeAssembleCommand( 366 CompilationCommand computeAssembleCommand(
346 String tempDir, 367 String tempDir,
347 String buildDir, 368 String buildDir,
348 CommandBuilder commandBuilder, 369 CommandBuilder commandBuilder,
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 RuntimeConfiguration runtimeConfiguration, 610 RuntimeConfiguration runtimeConfiguration,
590 String buildDir, 611 String buildDir,
591 TestInformation info, 612 TestInformation info,
592 List<String> vmOptions, 613 List<String> vmOptions,
593 List<String> sharedOptions, 614 List<String> sharedOptions,
594 List<String> originalArguments, 615 List<String> originalArguments,
595 CommandArtifact artifact) { 616 CommandArtifact artifact) {
596 return <String>[]; 617 return <String>[];
597 } 618 }
598 } 619 }
OLDNEW
« no previous file with comments | « runtime/vm/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698