Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update package dependencies, deprecate --package-root. #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions bin/src/command_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ abstract class CommandLinePart {
return true;
}

/// Performs checks on options --packages, --package-root and --token
/// Performs checks on options --packages and --token
/// before returning a `CommandLineClient` instance.
CommandLineClient getCommandLineClient(ArgResults res) {
var token = res["token"];
Expand All @@ -79,21 +79,14 @@ abstract class CommandLinePart {
}

FileSystemEntity handlePackages(ArgResults res) {
FileSystemEntity pRoot;
String type;
String pFilePath = res["packages"] ?? ".packages";
FileSystemEntity pRoot = File(pFilePath);
String type = "file";

if (res["package-root"] != null) {
if (res["packages"] != null) {
print(
"You cannot use both --packages and --package-root options at the same time.");
return null;
}
pRoot = new Directory(res["package-root"]);
type = "directory";
} else {
String pFilePath = res["packages"] ?? ".packages";
pRoot = new File(pFilePath);
type = "file";
throw ArgumentError("package-root has been deprecated, use --packages.");
}

if (!pRoot.existsSync()) {
print("Packages $type does not exist");
return null;
Expand All @@ -110,11 +103,11 @@ abstract class CommandLinePart {
..addOption(
"packages",
help:
'Specifies the path to the package resolution configuration file. This option cannot be used with --package-root.',
'Specifies the path to the package resolution configuration file.',
)
..addOption("package-root",
help:
'Specifies where to find imported libraries. This option cannot be used with --packages.');
'Specifies where to find imported libraries (deprecated, use --packages).');
}

Future parseAndExecute(List<String> args) => execute(parser.parse(args));
Expand Down
8 changes: 4 additions & 4 deletions lib/src/collect_lcov.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ class LcovCollector {
}

Map<String, Map<int, int>> hitmap = {};
mergeHitmaps(createHitmap(reportFile), hitmap);
mergeHitmaps(await createHitmap(reportFile), hitmap);
return await _formatCoverageJson(hitmap);
}

/// Formats coverage hitmap json to an lcov string
Future<String> _formatCoverageJson(Map<dynamic, dynamic> hitmap) {
var resolver;
if (packageRoot != null) {
resolver = new Resolver(packageRoot: packageRoot, sdkRoot: sdkRoot);
throw ArgumentError("packageRoot has been deprecated");
} else {
resolver = new Resolver(packagesPath: packagesPath, sdkRoot: sdkRoot);
}
Expand All @@ -109,7 +109,7 @@ class LcovCollector {

var dartArgs = ["--pause-isolates-on-exit", "--enable-vm-service"];
if (packageRoot != null) {
dartArgs.add("--package-root=${packageRoot}");
throw ArgumentError("packageRoot has been deprecated");
} else {
dartArgs.add("--packages=${packagesPath}");
}
Expand All @@ -135,7 +135,7 @@ class LcovCollector {

try {
Map<String, dynamic> coverageResults =
await collect(host, true, true, timeout: new Duration(seconds: 60));
await collect(host, true, true, false, null, timeout: new Duration(seconds: 60));
return coverageResults['coverage'];
} catch (e) {
print(e);
Expand Down
22 changes: 11 additions & 11 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ homepage: https://github.com/block-forest/dart-coveralls
environment:
sdk: '>=2.0.0-dev.64.1 <3.0.0'
dependencies:
args: '>=0.12.1 <2.0.0'
coverage: ^0.12.0
crypto: ^2.0.1
file: ^5.0.0
http: '>=0.11.1+1 <0.12.0'
logging: '>=0.9.2 <0.12.0'
path: ^1.3.0
stack_trace: ^1.3.2
yaml: ^2.1.2
args: ^2.0.0
coverage: ^1.0.1
crypto: ^3.0.0
file: ^6.1.0
http: ^0.13.0
logging: ^1.0.0
path: ^1.8.0
stack_trace: ^1.10.0
yaml: ^3.1.0
dev_dependencies:
mockito: ^3.0.0-beta+3
test: ^1.0.0
mockito: ^5.0.0
test: ^1.16.5
executables:
dart_coveralls: null