File tree Expand file tree Collapse file tree 2 files changed +41
-3
lines changed
Expand file tree Collapse file tree 2 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,24 @@ import 'dart:io';
99
1010import 'package:path/path.dart' as path;
1111
12+ /// Return a resolved path including the home directory in place of tilde
13+ /// references.
14+ String resolveTildePath (String originalPath) {
15+ if (originalPath == null || ! originalPath.startsWith ('~/' )) {
16+ return originalPath;
17+ }
18+
19+ String homeDir;
20+
21+ if (Platform .isWindows) {
22+ homeDir = path.absolute (Platform .environment['USERPROFILE' ]);
23+ } else {
24+ homeDir = path.absolute (Platform .environment['HOME' ]);
25+ }
26+
27+ return path.join (homeDir, originalPath.substring (2 ));
28+ }
29+
1230/// Returns the path to the SDK repository this script is a part of.
1331final String thisSdkRepo = () {
1432 var maybeSdkRepoDir = Platform .script.toFilePath ();
@@ -24,6 +42,14 @@ final String thisSdkRepo = () {
2442
2543Uri get thisSdkUri => Uri .file (thisSdkRepo);
2644
45+ /// Abstraction for an unmanaged package.
46+ class ManualPackage extends Package {
47+ ManualPackage (this .packagePath) : super (packagePath);
48+
49+ @override
50+ final String packagePath;
51+ }
52+
2753/// Abstraction for a package fetched via Github.
2854class GitHubPackage extends Package {
2955 GitHubPackage (String name, [String label]) : super (name) {
Original file line number Diff line number Diff line change @@ -32,6 +32,15 @@ main(List<String> args) async {
3232 help: 'Select the root of the SDK to analyze against for this run '
3333 '(compiled with --nnbd). For example: ../../xcodebuild/DebugX64NNBD/dart-sdk' );
3434
35+ argParser.addMultiOption (
36+ 'manual_packages' ,
37+ abbr: 'm' ,
38+ defaultsTo: [],
39+ help: 'Run migration against packages in these directories. Does not '
40+ 'run pub get, any git commands, or any other preparation.' ,
41+ splitCommas: true ,
42+ );
43+
3544 argParser.addMultiOption (
3645 'packages' ,
3746 abbr: 'p' ,
@@ -75,9 +84,12 @@ main(List<String> args) async {
7584 warnOnNoAssertions ();
7685 warnOnNoSdkNnbd (sdk);
7786
78- List <Package > packages = (parsedArgs['packages' ] as Iterable <String >)
79- .map ((n) => SdkPackage (n))
80- .toList (growable: false );
87+ List <Package > packages = [
88+ for (String package in parsedArgs['packages' ] as Iterable <String >)
89+ SdkPackage (package),
90+ for (String package in parsedArgs['manual_packages' ] as Iterable <String >)
91+ ManualPackage (package),
92+ ];
8193
8294 String categoryOfInterest =
8395 parsedArgs.rest.isEmpty ? null : parsedArgs.rest.single;
You can’t perform that action at this time.
0 commit comments