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

Side by Side Diff: pkg/compiler/lib/src/mirrors/analyze.dart

Issue 1162363004: Support Package Resolution Configuration files. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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/compiler/lib/src/dart2js.dart ('k') | pkg/compiler/lib/src/warnings.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 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.source_mirrors.analyze; 5 library dart2js.source_mirrors.analyze;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'source_mirrors.dart'; 9 import 'source_mirrors.dart';
10 import 'dart2js_mirrors.dart' show Dart2JsMirrorSystem; 10 import 'dart2js_mirrors.dart' show Dart2JsMirrorSystem;
11 import '../../compiler.dart' as api; 11 import '../../compiler.dart' as api;
12 import '../apiimpl.dart' as apiimpl; 12 import '../apiimpl.dart' as apiimpl;
13 import '../dart2jslib.dart' show Compiler; 13 import '../dart2jslib.dart' show Compiler;
14 14
15 //------------------------------------------------------------------------------ 15 //------------------------------------------------------------------------------
16 // Analysis entry point. 16 // Analysis entry point.
17 //------------------------------------------------------------------------------ 17 //------------------------------------------------------------------------------
18 18
19 /** 19 /**
20 * Analyzes set of libraries and provides a mirror system which can be used for 20 * Analyzes set of libraries and provides a mirror system which can be used for
21 * static inspection of the source code. 21 * static inspection of the source code.
22 */ 22 */
23 // TODO(johnniwinther): Move this to [compiler/compiler.dart]. 23 // TODO(johnniwinther): Move this to [compiler/compiler.dart].
24 Future<MirrorSystem> analyze(List<Uri> libraries, 24 Future<MirrorSystem> analyze(List<Uri> libraries,
25 Uri libraryRoot, 25 Uri libraryRoot,
26 Uri packageRoot, 26 Uri packageRoot,
27 api.CompilerInputProvider inputProvider, 27 api.CompilerInputProvider inputProvider,
28 api.DiagnosticHandler diagnosticHandler, 28 api.DiagnosticHandler diagnosticHandler,
29 [List<String> options = const <String>[]]) { 29 [List<String> options = const <String>[],
30 Uri packageConfig,
31 api.PackagesDiscoveryProvider findPackages]) {
30 if (!libraryRoot.path.endsWith("/")) { 32 if (!libraryRoot.path.endsWith("/")) {
31 throw new ArgumentError("libraryRoot must end with a /"); 33 throw new ArgumentError("libraryRoot must end with a /");
32 } 34 }
33 if (packageRoot != null && !packageRoot.path.endsWith("/")) { 35 if (packageRoot != null && !packageRoot.path.endsWith("/")) {
34 throw new ArgumentError("packageRoot must end with a /"); 36 throw new ArgumentError("packageRoot must end with a /");
35 } 37 }
36 options = new List<String>.from(options); 38 options = new List<String>.from(options);
37 options.add('--analyze-only'); 39 options.add('--analyze-only');
38 options.add('--analyze-signatures-only'); 40 options.add('--analyze-signatures-only');
39 options.add('--analyze-all'); 41 options.add('--analyze-all');
40 options.add('--categories=Client,Server'); 42 options.add('--categories=Client,Server');
41 options.add('--enable-async'); 43 options.add('--enable-async');
42 options.add('--allow-native-extensions'); 44 options.add('--allow-native-extensions');
43 45
44 bool compilationFailed = false; 46 bool compilationFailed = false;
45 void internalDiagnosticHandler(Uri uri, int begin, int end, 47 void internalDiagnosticHandler(Uri uri, int begin, int end,
46 String message, api.Diagnostic kind) { 48 String message, api.Diagnostic kind) {
47 if (kind == api.Diagnostic.ERROR || 49 if (kind == api.Diagnostic.ERROR ||
48 kind == api.Diagnostic.CRASH) { 50 kind == api.Diagnostic.CRASH) {
49 compilationFailed = true; 51 compilationFailed = true;
50 } 52 }
51 diagnosticHandler(uri, begin, end, message, kind); 53 diagnosticHandler(uri, begin, end, message, kind);
52 } 54 }
53 55
54 Compiler compiler = new apiimpl.Compiler(inputProvider, 56 Compiler compiler = new apiimpl.Compiler(inputProvider,
55 null, 57 null,
56 internalDiagnosticHandler, 58 internalDiagnosticHandler,
57 libraryRoot, packageRoot, 59 libraryRoot,
60 packageRoot,
58 options, 61 options,
59 const {}); 62 const {},
63 packageConfig,
64 findPackages);
60 compiler.librariesToAnalyzeWhenRun = libraries; 65 compiler.librariesToAnalyzeWhenRun = libraries;
61 return compiler.run(null).then((bool success) { 66 return compiler.run(null).then((bool success) {
62 if (success && !compilationFailed) { 67 if (success && !compilationFailed) {
63 return new Dart2JsMirrorSystem(compiler); 68 return new Dart2JsMirrorSystem(compiler);
64 } else { 69 } else {
65 throw new StateError('Failed to create mirror system.'); 70 throw new StateError('Failed to create mirror system.');
66 } 71 }
67 }); 72 });
68 } 73 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart2js.dart ('k') | pkg/compiler/lib/src/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698