OLD | NEW |
---|---|
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 Platform; |
8 | 8 |
9 import 'runtime_configuration.dart' show RuntimeConfiguration; | 9 import 'runtime_configuration.dart' show RuntimeConfiguration; |
10 import 'runtime_configuration.dart' show DartPrecompiledAdbRuntimeConfiguration; | 10 import 'runtime_configuration.dart' show DartPrecompiledAdbRuntimeConfiguration; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 | 49 |
50 /// Only some subclasses support this check, but we statically allow calling | 50 /// Only some subclasses support this check, but we statically allow calling |
51 /// it on [CompilerConfiguration]. | 51 /// it on [CompilerConfiguration]. |
52 bool get useDfe { | 52 bool get useDfe { |
53 throw new UnsupportedError("This compiler does not support DFE."); | 53 throw new UnsupportedError("This compiler does not support DFE."); |
54 } | 54 } |
55 | 55 |
56 // TODO(ahe): Remove this constructor and move the switch to | 56 // TODO(ahe): Remove this constructor and move the switch to |
57 // test_options.dart. We probably want to store an instance of | 57 // test_options.dart. We probably want to store an instance of |
58 // [CompilerConfiguration] in [configuration] there. | 58 // [CompilerConfiguration] in [configuration] there. |
59 factory CompilerConfiguration(Map configuration) { | 59 factory CompilerConfiguration(Map<String, dynamic> configuration) { |
60 String compiler = configuration['compiler']; | 60 var compiler = configuration['compiler'] as String; |
61 | 61 |
62 // TODO(ahe): Move these booleans into a struction configuration object | 62 // TODO(ahe): Move these booleans into a struction configuration object |
63 // which can eventually completely replace the Map-based configuration | 63 // which can eventually completely replace the Map-based configuration |
64 // object. | 64 // object. |
65 bool isDebug = configuration['mode'] == 'debug'; | 65 var isDebug = (configuration['mode'] as String) == 'debug'; |
66 bool isChecked = configuration['checked']; | 66 var isChecked = configuration['checked'] as bool; |
Siggi Cherem (dart-lang)
2017/05/30 20:48:39
Just to double check - these are cases that will e
Bob Nystrom
2017/05/30 21:01:46
That's right. That CL is: https://codereview.chrom
| |
67 bool isStrong = configuration['strong']; | 67 var isStrong = configuration['strong'] as bool; |
68 bool isHostChecked = configuration['host_checked']; | 68 var isHostChecked = configuration['host_checked'] as bool; |
69 bool useSdk = configuration['use_sdk']; | 69 var useSdk = configuration['use_sdk'] as bool; |
70 bool isCsp = configuration['csp']; | 70 var isCsp = configuration['csp'] as bool; |
71 bool useBlobs = configuration['use_blobs']; | 71 var useBlobs = configuration['use_blobs'] as bool; |
72 bool hotReload = configuration['hot_reload']; | 72 var hotReload = configuration['hot_reload'] as bool; |
73 bool hotReloadRollback = configuration['hot_reload_rollback']; | 73 var hotReloadRollback = configuration['hot_reload_rollback'] as bool; |
74 bool useFastStartup = configuration['fast_startup']; | 74 var useFastStartup = configuration['fast_startup'] as bool; |
75 bool useKernelInDart2js = configuration['dart2js_with_kernel']; | 75 var useKernelInDart2js = configuration['dart2js_with_kernel'] as bool; |
76 | 76 |
77 switch (compiler) { | 77 switch (compiler) { |
78 case 'dart2analyzer': | 78 case 'dart2analyzer': |
79 return new AnalyzerCompilerConfiguration( | 79 return new AnalyzerCompilerConfiguration( |
80 isDebug: isDebug, | 80 isDebug: isDebug, |
81 isChecked: isChecked, | 81 isChecked: isChecked, |
82 isStrong: isStrong, | 82 isStrong: isStrong, |
83 isHostChecked: isHostChecked, | 83 isHostChecked: isHostChecked, |
84 useSdk: useSdk); | 84 useSdk: useSdk); |
85 case 'dart2js': | 85 case 'dart2js': |
86 return new Dart2jsCompilerConfiguration( | 86 return new Dart2jsCompilerConfiguration( |
87 isDebug: isDebug, | 87 isDebug: isDebug, |
88 isChecked: isChecked, | 88 isChecked: isChecked, |
89 isHostChecked: isHostChecked, | 89 isHostChecked: isHostChecked, |
90 useSdk: useSdk, | 90 useSdk: useSdk, |
91 isCsp: isCsp, | 91 isCsp: isCsp, |
92 useFastStartup: useFastStartup, | 92 useFastStartup: useFastStartup, |
93 useKernel: useKernelInDart2js, | 93 useKernel: useKernelInDart2js, |
94 extraDart2jsOptions: | 94 extraDart2jsOptions: |
95 TestUtils.getExtraOptions(configuration, 'dart2js_options')); | 95 TestUtils.getExtraOptions(configuration, 'dart2js_options')); |
96 case 'app_jit': | 96 case 'app_jit': |
97 return new AppJitCompilerConfiguration( | 97 return new AppJitCompilerConfiguration( |
98 isDebug: isDebug, isChecked: isChecked); | 98 isDebug: isDebug, isChecked: isChecked); |
99 case 'precompiler': | 99 case 'precompiler': |
100 return new PrecompilerCompilerConfiguration( | 100 return new PrecompilerCompilerConfiguration( |
101 isDebug: isDebug, | 101 isDebug: isDebug, |
102 isChecked: isChecked, | 102 isChecked: isChecked, |
103 arch: configuration['arch'], | 103 arch: configuration['arch'] as String, |
104 useBlobs: useBlobs, | 104 useBlobs: useBlobs, |
105 isAndroid: configuration['system'] == 'android'); | 105 isAndroid: configuration['system'] == 'android'); |
106 case 'dartk': | 106 case 'dartk': |
107 return new NoneCompilerConfiguration( | 107 return new NoneCompilerConfiguration( |
108 isDebug: isDebug, | 108 isDebug: isDebug, |
109 isChecked: isChecked, | 109 isChecked: isChecked, |
110 isHostChecked: isHostChecked, | 110 isHostChecked: isHostChecked, |
111 useSdk: useSdk, | 111 useSdk: useSdk, |
112 hotReload: hotReload, | 112 hotReload: hotReload, |
113 hotReloadRollback: hotReloadRollback, | 113 hotReloadRollback: hotReloadRollback, |
114 useDfe: true); | 114 useDfe: true); |
115 case 'dartkp': | 115 case 'dartkp': |
116 return new PrecompilerCompilerConfiguration( | 116 return new PrecompilerCompilerConfiguration( |
117 isDebug: isDebug, | 117 isDebug: isDebug, |
118 isChecked: isChecked, | 118 isChecked: isChecked, |
119 arch: configuration['arch'], | 119 arch: configuration['arch'] as String, |
120 useBlobs: useBlobs, | 120 useBlobs: useBlobs, |
121 isAndroid: configuration['system'] == 'android', | 121 isAndroid: configuration['system'] == 'android', |
122 useDfe: true); | 122 useDfe: true); |
123 case 'none': | 123 case 'none': |
124 return new NoneCompilerConfiguration( | 124 return new NoneCompilerConfiguration( |
125 isDebug: isDebug, | 125 isDebug: isDebug, |
126 isChecked: isChecked, | 126 isChecked: isChecked, |
127 isHostChecked: isHostChecked, | 127 isHostChecked: isHostChecked, |
128 useSdk: useSdk, | 128 useSdk: useSdk, |
129 hotReload: hotReload, | 129 hotReload: hotReload, |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
956 RuntimeConfiguration runtimeConfiguration, | 956 RuntimeConfiguration runtimeConfiguration, |
957 String buildDir, | 957 String buildDir, |
958 TestInformation info, | 958 TestInformation info, |
959 List<String> vmOptions, | 959 List<String> vmOptions, |
960 List<String> sharedOptions, | 960 List<String> sharedOptions, |
961 List<String> originalArguments, | 961 List<String> originalArguments, |
962 CommandArtifact artifact) { | 962 CommandArtifact artifact) { |
963 return <String>[]; | 963 return <String>[]; |
964 } | 964 } |
965 } | 965 } |
OLD | NEW |