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

Side by Side Diff: pkg/analyzer/lib/source/pub_package_map_provider.dart

Issue 681003002: Replace ${name} with $name where possible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up also implementation Created 6 years, 1 month 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 source.pub_package_map_provider; 5 library source.pub_package_map_provider;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io' as io; 9 import 'dart:io' as io;
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // TODO(paulberry) make this asynchronous so that we can (a) do other 44 // TODO(paulberry) make this asynchronous so that we can (a) do other
45 // analysis while it's in progress, and (b) time out if it takes too long 45 // analysis while it's in progress, and (b) time out if it takes too long
46 // to respond. 46 // to respond.
47 String executable = sdk.pubExecutable.getAbsolutePath(); 47 String executable = sdk.pubExecutable.getAbsolutePath();
48 io.ProcessResult result; 48 io.ProcessResult result;
49 try { 49 try {
50 result = io.Process.runSync( 50 result = io.Process.runSync(
51 executable, [PUB_LIST_COMMAND], workingDirectory: folder.path); 51 executable, [PUB_LIST_COMMAND], workingDirectory: folder.path);
52 } on io.ProcessException catch (exception, stackTrace) { 52 } on io.ProcessException catch (exception, stackTrace) {
53 AnalysisEngine.instance.logger.logInformation( 53 AnalysisEngine.instance.logger.logInformation(
54 "Error running pub $PUB_LIST_COMMAND\n${exception}\n${stackTrace}"); 54 "Error running pub $PUB_LIST_COMMAND\n$exception\n$stackTrace");
55 } 55 }
56 if (result.exitCode != 0) { 56 if (result.exitCode != 0) {
57 AnalysisEngine.instance.logger.logInformation( 57 AnalysisEngine.instance.logger.logInformation(
58 "pub $PUB_LIST_COMMAND failed: exit code ${result.exitCode}"); 58 "pub $PUB_LIST_COMMAND failed: exit code ${result.exitCode}");
59 return _error(folder); 59 return _error(folder);
60 } 60 }
61 try { 61 try {
62 return parsePackageMap(result.stdout, folder); 62 return parsePackageMap(result.stdout, folder);
63 } catch (exception, stackTrace) { 63 } catch (exception, stackTrace) {
64 AnalysisEngine.instance.logger.logError( 64 AnalysisEngine.instance.logger.logError(
65 "Malformed output from pub $PUB_LIST_COMMAND\n${exception}\n${stackTra ce}"); 65 "Malformed output from pub $PUB_LIST_COMMAND\n$exception\n$stackTrace" );
66 } 66 }
67 67
68 return _error(folder); 68 return _error(folder);
69 } 69 }
70 70
71 /** 71 /**
72 * Decode the JSON output from pub into a package map. Paths in the 72 * Decode the JSON output from pub into a package map. Paths in the
73 * output are considered relative to [folder]. 73 * output are considered relative to [folder].
74 */ 74 */
75 PackageMapInfo parsePackageMap(String jsonText, Folder folder) { 75 PackageMapInfo parsePackageMap(String jsonText, Folder folder) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 */ 125 */
126 PackageMapInfo _error(Folder folder) { 126 PackageMapInfo _error(Folder folder) {
127 // Even if an error occurs, we still need to know the dependencies, so that 127 // Even if an error occurs, we still need to know the dependencies, so that
128 // we'll know when to try running "pub list-package-dirs" again. 128 // we'll know when to try running "pub list-package-dirs" again.
129 // Unfortunately, "pub list-package-dirs" doesn't tell us dependencies when 129 // Unfortunately, "pub list-package-dirs" doesn't tell us dependencies when
130 // an error occurs, so just assume there is one dependency, "pubspec.lock". 130 // an error occurs, so just assume there is one dependency, "pubspec.lock".
131 List<String> dependencies = <String>[join(folder.path, PUBSPEC_LOCK_NAME)]; 131 List<String> dependencies = <String>[join(folder.path, PUBSPEC_LOCK_NAME)];
132 return new PackageMapInfo(null, dependencies.toSet()); 132 return new PackageMapInfo(null, dependencies.toSet());
133 } 133 }
134 } 134 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/source/package_map_resolver.dart ('k') | pkg/analyzer/lib/src/analyzer_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698