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

Unified Diff: test/codegen_test.dart

Issue 1982853002: Allow the SDK to be set via a summary file (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Address comments Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pubspec.yaml ('k') | tool/build_sdk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen_test.dart
diff --git a/test/codegen_test.dart b/test/codegen_test.dart
index cf67d164bf04ab808287b4d87d590d9f2694204f..8e13891b9f76236f3e7181f2383ed90e07c2b6b3 100644
--- a/test/codegen_test.dart
+++ b/test/codegen_test.dart
@@ -50,9 +50,11 @@ main(arguments) {
var multitests = expandMultiTests(testDirs, filePattern);
// Build packages tests depend on
- var generatedSdkDir = path.join(testDirectory, '..', 'tool', 'generated_sdk');
+ var sdkSummaryFile =
+ path.join(testDirectory, '..', 'lib', 'runtime', 'dart_sdk.sum');
var analyzerOptions = new AnalyzerOptions(
- customUrlMappings: packageUrlMappings, dartSdkPath: generatedSdkDir);
+ customUrlMappings: packageUrlMappings,
+ dartSdkSummaryPath: sdkSummaryFile);
var compiler = new ModuleCompiler(analyzerOptions);
group('dartdevc package', () {
@@ -63,7 +65,14 @@ main(arguments) {
});
test('unittest', () {
- _buildPackage(compiler, expectDir, "unittest");
+ // Only build files applicable to the web - html_*.dart and its
+ // internal dependences.
+ _buildPackage(compiler, expectDir, "unittest", packageFiles: [
+ 'unittest.dart',
+ 'html_config.dart',
+ 'html_individual_config.dart',
+ 'html_enhanced_config.dart'
+ ]);
});
test('stack_trace', () {
@@ -128,6 +137,8 @@ main(arguments) {
if (codeCoverage) {
test('build_sdk code coverage', () {
+ var generatedSdkDir =
+ path.join(testDirectory, '..', 'tool', 'generated_sdk');
return build_sdk.main(['--dart-sdk', generatedSdkDir, '-o', expectDir]);
});
}
@@ -198,21 +209,33 @@ void _buildPackages(ModuleCompiler compiler, String expectDir) {
}
}
-void _buildPackage(ModuleCompiler compiler, String expectDir, packageName) {
+void _buildPackage(ModuleCompiler compiler, String expectDir, packageName,
+ {List<String> packageFiles}) {
var options = new CompilerOptions(sourceMap: false, summarizeApi: false);
var packageRoot = path.join(inputDir, 'packages');
var packageInputDir = path.join(packageRoot, packageName);
- var files = new Directory(packageInputDir).listSync(recursive: true);
-
- var unit = new BuildUnit(
- packageName,
- packageInputDir,
- files
- .where((entry) => entry.path.endsWith('dart'))
- .map((entry) => entry.path)
- .toList(),
- _moduleForLibrary);
+ List<String> files;
+ if (packageFiles != null) {
+ // Only collect files transitively reachable from packageFiles
+ var reachable = new Set<String>();
+ for (var f in packageFiles) {
+ f = path.join(packageInputDir, f);
+ _collectTransitiveImports(new File(f).readAsStringSync(), reachable,
+ packageRoot: packageRoot, from: f);
+ }
+ files = reachable.toList();
+ } else {
+ // Collect all files in the packages directory
+ files = new Directory(packageInputDir)
+ .listSync(recursive: true)
+ .where((entry) => entry.path.endsWith('.dart'))
+ .map((entry) => entry.path)
+ .toList();
+ }
+
+ var unit =
+ new BuildUnit(packageName, packageInputDir, files, _moduleForLibrary);
var module = compiler.compile(unit, options);
var outPath = path.join(expectDir, packageName, packageName);
« no previous file with comments | « pubspec.yaml ('k') | tool/build_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698