@@ -19,6 +19,7 @@ class Environment {
1919 required this .lcov,
2020 required this .output,
2121 required this .packagesPath,
22+ required this .packagePath,
2223 required this .prettyPrint,
2324 required this .prettyPrintFunc,
2425 required this .prettyPrintBranch,
@@ -36,6 +37,7 @@ class Environment {
3637 bool lcov;
3738 IOSink output;
3839 String ? packagesPath;
40+ String packagePath;
3941 bool prettyPrint;
4042 bool prettyPrintFunc;
4143 bool prettyPrintBranch;
@@ -54,7 +56,8 @@ Future<void> main(List<String> arguments) async {
5456 print (' # files: ${files .length }' );
5557 print (' # workers: ${env .workers }' );
5658 print (' sdk-root: ${env .sdkRoot }' );
57- print (' package-spec: ${env .packagesPath }' );
59+ print (' package-path: ${env .packagePath }' );
60+ print (' packages-path: ${env .packagesPath }' );
5861 print (' report-on: ${env .reportOn }' );
5962 print (' check-ignore: ${env .checkIgnore }' );
6063 }
@@ -63,7 +66,9 @@ Future<void> main(List<String> arguments) async {
6366 final hitmap = await HitMap .parseFiles (
6467 files,
6568 checkIgnoredLines: env.checkIgnore,
69+ // ignore: deprecated_member_use_from_same_package
6670 packagesPath: env.packagesPath,
71+ packagePath: env.packagePath,
6772 );
6873
6974 // All workers are done. Process the data.
@@ -74,7 +79,11 @@ Future<void> main(List<String> arguments) async {
7479 String output;
7580 final resolver = env.bazel
7681 ? BazelResolver (workspacePath: env.bazelWorkspace)
77- : Resolver (packagesPath: env.packagesPath, sdkRoot: env.sdkRoot);
82+ : await Resolver .create (
83+ packagesPath: env.packagesPath,
84+ packagePath: env.packagePath,
85+ sdkRoot: env.sdkRoot,
86+ );
7887 final loader = Loader ();
7988 if (env.prettyPrint) {
8089 output = await hitmap.prettyPrint (resolver, loader,
@@ -116,7 +125,10 @@ Environment parseArgs(List<String> arguments) {
116125 final parser = ArgParser ();
117126
118127 parser.addOption ('sdk-root' , abbr: 's' , help: 'path to the SDK root' );
119- parser.addOption ('packages' , help: 'path to the package spec file' );
128+ parser.addOption ('packages' ,
129+ help: '[DEPRECATED] path to the package spec file' );
130+ parser.addOption ('package' ,
131+ help: 'root directory of the package' , defaultsTo: '.' );
120132 parser.addOption ('in' , abbr: 'i' , help: 'input(s): may be file or directory' );
121133 parser.addOption ('out' ,
122134 abbr: 'o' , defaultsTo: 'stdout' , help: 'output: may be file or stdout' );
@@ -191,6 +203,11 @@ Environment parseArgs(List<String> arguments) {
191203 }
192204 }
193205
206+ final packagePath = args['package' ] as String ;
207+ if (! FileSystemEntity .isDirectorySync (packagePath)) {
208+ fail ('Package spec "${args ["package" ]}" not found, or not a directory.' );
209+ }
210+
194211 if (args['in' ] == null ) fail ('No input files given.' );
195212 final input = p.absolute (p.normalize (args['in' ] as String ));
196213 if (! FileSystemEntity .isDirectorySync (input) &&
@@ -254,6 +271,7 @@ Environment parseArgs(List<String> arguments) {
254271 lcov: lcov,
255272 output: output,
256273 packagesPath: packagesPath,
274+ packagePath: packagePath,
257275 prettyPrint: prettyPrint,
258276 prettyPrintFunc: prettyPrintFunc,
259277 prettyPrintBranch: prettyPrintBranch,
0 commit comments