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

Side by Side Diff: pkg/compiler/bin/resolver.dart

Issue 2024473002: WIP: prototype resolver script (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 | « no previous file | 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
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'dart:io';
6
7 import 'package:args/args.dart';
8 import 'package:compiler/src/apiimpl.dart';
9 import 'package:compiler/src/dart2js.dart';
10 import 'package:compiler/src/filenames.dart';
11 import 'package:compiler/src/null_compiler_output.dart';
12 import 'package:compiler/src/source_file_provider.dart';
13 import 'package:compiler/src/options.dart';
14 import 'package:compiler/src/serialization/json_serializer.dart';
15 import 'package:package_config/discovery.dart';
16
17 main(var argv) async {
18 var parser = new ArgParser();
19 parser.addOption('deps', abbr: 'd', allowMultiple: true);
20 parser.addOption('out', abbr: 'o');
21 var args = parser.parse(argv);
22
23 var resolutionInputs =
24 args['deps'].map((uri) => currentDirectory.resolve(uri)).toList();
25 var root = uriPathToNative("../../../sdk");
26 var libraryRoot = Platform.script.resolve("$root/");
27 var options = new CompilerOptions(
28 libraryRoot: libraryRoot,
29 resolveOnly: true,
30 resolutionInputs: resolutionInputs,
31 packagesDiscoveryProvider: findPackages);
32 var inputProvider = new CompilerSourceFileProvider();
33 var outputProvider = const NullCompilerOutput();
34 var diagnostics = new FormattingDiagnosticHandler(inputProvider);
35
36 var compiler =
37 new CompilerImpl(inputProvider, outputProvider, diagnostics, options);
38
39 var inputs = args.rest.map((uri) => currentDirectory.resolve(uri)).toList();
40
41 await compiler.setupSdk();
42 await compiler.setupPackages(inputs.first);
43
44 for (var library in inputs) {
45 await compiler.libraryLoader.loadLibrary(library);
46 }
47
48 for (var library in inputs) {
49 compiler.fullyEnqueueLibrary(compiler.libraryLoader.lookupLibrary(library),
50 compiler.enqueuer.resolution);
51 }
52
53 compiler.processQueue(compiler.enqueuer.resolution, null);
54
55 var librariesToSerialize = compiler.libraryLoader.libraries
56 .where((lib) => inputs.contains(lib.canonicalUri))
Siggi Cherem (dart-lang) 2016/05/27 23:38:55 consider making inputs a set instead of a list to
Harry Terkelsen 2016/05/27 23:57:50 i realized there is a better way, just ask the lib
57 .toList();
58
59 var serializer =
60 compiler.serialization.createSerializer(librariesToSerialize);
61 var text = serializer.toText(const JsonSerializationEncoder());
62
63 var outFile = args['out'] ?? 'out.json';
64
65 await new File(outFile).writeAsString(text);
66 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698