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

Side by Side Diff: pkg/docgen/lib/src/dart2js_mirrors.dart

Issue 18233004: Added a flag package-root for users to define where the package directory is. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « pkg/docgen/lib/docgen.dart ('k') | 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) 2012, 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 library dart2js_util;
6
7 // TODO(tmandel): This is a temporary copy of the dart2js_mirrors.dart
8 // file in the dartdoc folder. One of the two should be deleted
9 // when docgen can replace dartdoc.
10
11 import 'dart:async' show Future;
12 import 'dart:io' show Path;
13
14 import '../../../../sdk/lib/_internal/compiler/compiler.dart' as api;
15 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mi rror.dart'
16 as dart2js show analyze, Dart2JsMirrorSystem;
17 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.da rt'
18 show MirrorSystem;
19 import '../../../../sdk/lib/_internal/compiler/implementation/source_file_provid er.dart'
20 show FormattingDiagnosticHandler, SourceFileProvider;
21 import '../../../../sdk/lib/_internal/compiler/implementation/filenames.dart'
22 show appendSlash, currentDirectory;
23
24 // TODO(johnniwinther): Support client configurable providers.
25
26 /**
27 * Returns a future that completes to a non-null String when [script]
28 * has been successfully compiled.
29 */
30 // TODO(amouravski): Remove this method and call dart2js via a process instead.
31 Future<String> compile(Path script,
32 Path libraryRoot,
33 {Path packageRoot,
34 List<String> options: const <String>[],
35 api.DiagnosticHandler diagnosticHandler}) {
36 SourceFileProvider provider = new SourceFileProvider();
37 if (diagnosticHandler == null) {
38 diagnosticHandler =
39 new FormattingDiagnosticHandler(provider).diagnosticHandler;
40 }
41 Uri scriptUri = currentDirectory.resolve(script.toString());
42 Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
43 Uri packageUri = null;
44 if (packageRoot != null) {
45 packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
46 }
47 return api.compile(scriptUri, libraryUri, packageUri,
48 provider.readStringFromUri, diagnosticHandler, options);
49 }
50
51 /**
52 * Analyzes set of libraries and provides a mirror system which can be used for
53 * static inspection of the source code.
54 */
55 Future<MirrorSystem> analyze(List<Path> libraries,
56 Path libraryRoot,
57 {Path packageRoot,
58 List<String> options: const <String>[],
59 api.DiagnosticHandler diagnosticHandler}) {
60 SourceFileProvider provider = new SourceFileProvider();
61 if (diagnosticHandler == null) {
62 diagnosticHandler =
63 new FormattingDiagnosticHandler(provider).diagnosticHandler;
64 }
65 Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
66 Uri packageUri = null;
67 if (packageRoot != null) {
68 packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
69 }
70 List<Uri> librariesUri = <Uri>[];
71 for (Path library in libraries) {
72 librariesUri.add(currentDirectory.resolve(library.toString()));
73 }
74 return dart2js.analyze(librariesUri, libraryUri, packageUri,
75 provider.readStringFromUri, diagnosticHandler,
76 options);
77 }
OLDNEW
« no previous file with comments | « pkg/docgen/lib/docgen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698