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

Side by Side Diff: pkg/dev_compiler/tool/build_pkgs.dart

Issue 2757753002: Migrate DDC to the new analysis driver.
Patch Set: Rebase Created 3 years, 6 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 | « pkg/dev_compiler/test/options/options_test.dart ('k') | pkg/dev_compiler/tool/build_sdk.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 import 'dart:async';
2 import 'dart:io'; 3 import 'dart:io';
3 4
4 import 'package:dev_compiler/src/compiler/command.dart'; 5 import 'package:dev_compiler/src/compiler/command.dart';
5 6
6 /// Compiles the packages that the DDC tests use to JS into: 7 /// Compiles the packages that the DDC tests use to JS into:
7 /// 8 ///
8 /// gen/codegen_output/pkg/... 9 /// gen/codegen_output/pkg/...
9 /// 10 ///
10 /// Assumes the working directory is pkg/dev_compiler. 11 /// Assumes the working directory is pkg/dev_compiler.
11 /// 12 ///
12 /// If no arguments are passed, builds the all of the modules tested on Travis. 13 /// If no arguments are passed, builds the all of the modules tested on Travis.
13 /// If "test" is passed, only builds the modules needed by the tests. 14 /// If "test" is passed, only builds the modules needed by the tests.
14 void main(List<String> arguments) { 15 Future<Null> main(List<String> arguments) async {
15 var test = arguments.length == 1 && arguments[0] == 'test'; 16 var test = arguments.length == 1 && arguments[0] == 'test';
16 17
17 new Directory("gen/codegen_output/pkg").createSync(recursive: true); 18 new Directory("gen/codegen_output/pkg").createSync(recursive: true);
18 19
19 // Build leaf packages. These have no other package dependencies. 20 // Build leaf packages. These have no other package dependencies.
20 21
21 // Under pkg. 22 // Under pkg.
22 compileModule('async_helper'); 23 await compileModule('async_helper');
23 compileModule('expect', libs: ['minitest']); 24 await compileModule('expect', libs: ['minitest']);
24 compileModule('js', libs: ['js_util']); 25 await compileModule('js', libs: ['js_util']);
25 compileModule('meta'); 26 await compileModule('meta');
26 if (!test) { 27 if (!test) {
27 compileModule('lookup_map'); 28 await compileModule('lookup_map');
28 compileModule('microlytics', libs: ['html_channels']); 29 await compileModule('microlytics', libs: ['html_channels']);
29 compileModule('typed_mock'); 30 await compileModule('typed_mock');
30 } 31 }
31 32
32 // Under third_party/pkg. 33 // Under third_party/pkg.
33 compileModule('collection'); 34 await compileModule('collection');
34 compileModule('matcher'); 35 await compileModule('matcher');
35 compileModule('path'); 36 await compileModule('path');
36 if (!test) { 37 if (!test) {
37 compileModule('args', libs: ['command_runner']); 38 await compileModule('args', libs: ['command_runner']);
38 compileModule('charcode'); 39 await compileModule('charcode');
39 compileModule('fixnum'); 40 await compileModule('fixnum');
40 compileModule('logging'); 41 await compileModule('logging');
41 compileModule('markdown'); 42 await compileModule('markdown');
42 compileModule('mime'); 43 await compileModule('mime');
43 compileModule('plugin', libs: ['manager']); 44 await compileModule('plugin', libs: ['manager']);
44 compileModule('typed_data'); 45 await compileModule('typed_data');
45 compileModule('usage'); 46 await compileModule('usage');
46 compileModule('utf'); 47 await compileModule('utf');
47 compileModule('when'); 48 await compileModule('when');
48 } 49 }
49 50
50 // Composite packages with dependencies. 51 // Composite packages with dependencies.
51 compileModule('stack_trace', deps: ['path']); 52 await compileModule('stack_trace', deps: ['path']);
52 if (!test) { 53 if (!test) {
53 compileModule('async', deps: ['collection']); 54 await compileModule('async', deps: ['collection']);
54 } 55 }
55 56
56 if (test) { 57 if (test) {
57 compileModule('unittest', 58 await compileModule('unittest',
58 deps: ['matcher', 'path', 'stack_trace'], 59 deps: ['matcher', 'path', 'stack_trace'],
59 libs: ['html_config', 'html_individual_config', 'html_enhanced_config'], 60 libs: ['html_config', 'html_individual_config', 'html_enhanced_config'],
60 unsafeForceCompile: true); 61 unsafeForceCompile: true);
61 } 62 }
62 } 63 }
63 64
64 /// Compiles a [module] with a single matching ".dart" library and additional 65 /// Compiles a [module] with a single matching ".dart" library and additional
65 /// [libs] and [deps] on other modules. 66 /// [libs] and [deps] on other modules.
66 void compileModule(String module, 67 Future<Null> compileModule(String module,
67 {List<String> libs, List<String> deps, bool unsafeForceCompile: false}) { 68 {List<String> libs,
69 List<String> deps,
70 bool unsafeForceCompile: false}) async {
68 var args = [ 71 var args = [
69 '--dart-sdk-summary=lib/sdk/ddc_sdk.sum', 72 '--dart-sdk-summary=lib/sdk/ddc_sdk.sum',
70 '-ogen/codegen_output/pkg/$module.js' 73 '-ogen/codegen_output/pkg/$module.js'
71 ]; 74 ];
72 75
73 // There is always a library that matches the module. 76 // There is always a library that matches the module.
74 args.add('package:$module/$module.dart'); 77 args.add('package:$module/$module.dart');
75 78
76 // Add any additional libraries. 79 // Add any additional libraries.
77 if (libs != null) { 80 if (libs != null) {
(...skipping 13 matching lines...) Expand all
91 args.add('--unsafe-force-compile'); 94 args.add('--unsafe-force-compile');
92 } 95 }
93 96
94 // TODO(rnystrom): Hack. DDC has its own forked copy of async_helper that 97 // TODO(rnystrom): Hack. DDC has its own forked copy of async_helper that
95 // has a couple of differences from pkg/async_helper. We should unfork them, 98 // has a couple of differences from pkg/async_helper. We should unfork them,
96 // but I'm not sure how they'll affect the other non-DDC tests. For now, just 99 // but I'm not sure how they'll affect the other non-DDC tests. For now, just
97 // use ours. 100 // use ours.
98 if (module == 'async_helper') { 101 if (module == 'async_helper') {
99 args.add('--url-mapping=package:async_helper/async_helper.dart,' 102 args.add('--url-mapping=package:async_helper/async_helper.dart,'
100 'test/codegen/async_helper.dart'); 103 'test/codegen/async_helper.dart');
104 // The custom url-mapping option in Analyzer has changed.
105 // Now the package URI gets turned into a file URI during resolution.
106 //
107 // Because of that, we need a library-root to find the correct root
108 // directory for this package, and thus find the library's name.
109 args.add('--library-root=test/codegen/');
101 } 110 }
102 111
103 compile(args); 112 await compile(args);
104 } 113 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/test/options/options_test.dart ('k') | pkg/dev_compiler/tool/build_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698