| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 /// Tests basic functionality of the API tree-shaker. | 5 /// Tests basic functionality of the API tree-shaker. |
| 6 /// | 6 /// |
| 7 /// Each input file is built and tree-shaken, then we check that the set of | 7 /// Each input file is built and tree-shaken, then we check that the set of |
| 8 /// libraries, classes, and members that are retained match those declared in an | 8 /// libraries, classes, and members that are retained match those declared in an |
| 9 /// expectations file. | 9 /// expectations file. |
| 10 /// | 10 /// |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 class BuildProgram | 88 class BuildProgram |
| 89 extends Step<TestDescription, _IntermediateData, TreeShakerContext> { | 89 extends Step<TestDescription, _IntermediateData, TreeShakerContext> { |
| 90 const BuildProgram(); | 90 const BuildProgram(); |
| 91 String get name => "build program"; | 91 String get name => "build program"; |
| 92 Future<Result<_IntermediateData>> run( | 92 Future<Result<_IntermediateData>> run( |
| 93 TestDescription description, TreeShakerContext context) async { | 93 TestDescription description, TreeShakerContext context) async { |
| 94 try { | 94 try { |
| 95 var platformOutline = context.loadPlatformOutline(); | 95 var platformOutline = context.loadPlatformOutline(); |
| 96 platformOutline.unbindCanonicalNames(); | 96 platformOutline.unbindCanonicalNames(); |
| 97 var dillTarget = new DillTarget( | 97 var dillTarget = new DillTarget( |
| 98 new Ticker(isVerbose: false), context.uriTranslator, "vm"); | 98 new Ticker(isVerbose: false), context.uriTranslator, "vm_fasta"); |
| 99 dillTarget.loader.appendLibraries(platformOutline); | 99 dillTarget.loader.appendLibraries(platformOutline); |
| 100 var sourceTarget = new KernelTarget(PhysicalFileSystem.instance, | 100 var sourceTarget = new KernelTarget(PhysicalFileSystem.instance, |
| 101 dillTarget, context.uriTranslator, false); | 101 dillTarget, context.uriTranslator, false); |
| 102 await dillTarget.buildOutlines(); | 102 await dillTarget.buildOutlines(); |
| 103 | 103 |
| 104 var inputUri = description.uri; | 104 var inputUri = description.uri; |
| 105 | 105 |
| 106 /// We treat the lib.dart library as a special dependency that was | 106 /// We treat the lib.dart library as a special dependency that was |
| 107 /// previously built. To do so, we build it and append it back to the | 107 /// previously built. To do so, we build it and append it back to the |
| 108 /// dillTarget before building the actual test. | 108 /// dillTarget before building the actual test. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 """ | 232 """ |
| 233 Please create file ${expectedFile.path} with this content: | 233 Please create file ${expectedFile.path} with this content: |
| 234 $buffer"""); | 234 $buffer"""); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 /// A special library used only to test the shaker. The suite above will | 239 /// A special library used only to test the shaker. The suite above will |
| 240 /// tree-shake the contents of this library. | 240 /// tree-shake the contents of this library. |
| 241 const _specialLibraryPath = 'pkg/front_end/testcases/shaker/lib/lib.dart'; | 241 const _specialLibraryPath = 'pkg/front_end/testcases/shaker/lib/lib.dart'; |
| OLD | NEW |