Skip to content

Commit

Permalink
Merge pull request #87 from pq/remove_preview_dart2
Browse files Browse the repository at this point in the history
Remove `-preview-dart-2`
  • Loading branch information
pq authored Jul 25, 2018
2 parents 9ec1b3a + e5244a3 commit d599ae8
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ pubspec.lock

# Do not include intellij stuff
.idea
dart-coveralls.iml
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### unreleased

* Support for `--preview-dart-2` removed and SDK lower bound bumped to `2.0.0-dev.64.1`.

### 0.6.0+3

* Dart 2 fixes.
Expand Down
8 changes: 2 additions & 6 deletions bin/src/calc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ class CalcPart extends CommandLinePart {
return;
}

var previewDart2 = res['preview-dart-2'];
var collector = new LcovCollector(
packageRoot: pRoot is Directory ? pRoot.absolute.path : null,
packagesPath: pRoot is File ? pRoot.absolute.path : null,
previewDart2: previewDart2);
packagesPath: pRoot is File ? pRoot.absolute.path : null);

var r = await collector.getLcovInformation(file);

Expand All @@ -56,9 +54,7 @@ class CalcPart extends CommandLinePart {
ArgParser _initializeParser() {
ArgParser parser = new ArgParser(allowTrailingOptions: true)
..addOption("workers", help: "Ignored", defaultsTo: "1")
..addOption("output", help: "Output file path")
..addFlag("preview-dart-2",
help: "Runs code coverage in Dart 2.", negatable: false);
..addOption("output", help: "Output file path");

return CommandLinePart.addCommonOptions(parser);
}
8 changes: 2 additions & 6 deletions bin/src/report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class ReportPart extends CommandLinePart {
var throwOnConnectivityError = res["throw-on-connectivity-error"];
var excludeTestFiles = res["exclude-test-files"];
var printJson = res["print-json"];
var previewDart2 = res["preview-dart-2"];

CoverallsResult result = await Chain.capture(() async {
var commandLineClient = getCommandLineClient(res);
Expand All @@ -50,8 +49,7 @@ class ReportPart extends CommandLinePart {
retry: retry,
throwOnConnectivityError: throwOnConnectivityError,
excludeTestFiles: excludeTestFiles,
printJson: printJson,
previewDart2: previewDart2);
printJson: printJson);
}, onError: errorFunction);

if (result != null) {
Expand Down Expand Up @@ -98,8 +96,6 @@ ArgParser _initializeParser() {
..addFlag("print-json",
abbr: 'p',
help: "Pretty-print the json that will be sent to coveralls.",
negatable: false)
..addFlag("preview-dart-2",
help: "Runs code coverage in Dart 2.", negatable: false);
negatable: false);
return CommandLinePart.addCommonOptions(parser);
}
12 changes: 4 additions & 8 deletions lib/src/cli_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ class CommandLineClient {
}

Future<String> getLcovResult(String testFile,
{ProcessSystem processSystem: const ProcessSystem(),
bool previewDart2: false}) {
{ProcessSystem processSystem: const ProcessSystem()}) {
var collector = new LcovCollector(
packageRoot: packageRoot,
packagesPath: packagesPath,
processSystem: processSystem,
previewDart2: previewDart2);
processSystem: processSystem);
return collector.getLcovInformation(testFile);
}

Expand All @@ -61,10 +59,8 @@ class CommandLineClient {
bool throwOnConnectivityError: false,
int retry: 0,
bool excludeTestFiles: false,
bool printJson,
bool previewDart2: false}) async {
var rawLcov = await getLcovResult(testFile,
processSystem: processSystem, previewDart2: previewDart2);
bool printJson}) async {
var rawLcov = await getLcovResult(testFile, processSystem: processSystem);

if (rawLcov == null) {
print("Nothing to collect: Connection to VM service timed out. "
Expand Down
7 changes: 1 addition & 6 deletions lib/src/collect_lcov.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,12 @@ class LcovCollector {
final String packageRoot;
final String packagesPath;
final ProcessSystem processSystem;
final bool previewDart2;

LcovCollector(
{this.packageRoot,
this.packagesPath,
this.processSystem: const ProcessSystem(),
this.sdkRoot,
this.previewDart2: false}) {}
this.sdkRoot}) {}

Future<String> convertVmReportsToLcov(
Directory directoryContainingVmReports) async {
Expand Down Expand Up @@ -115,9 +113,6 @@ class LcovCollector {
} else {
dartArgs.add("--packages=${packagesPath}");
}
if (previewDart2) {
dartArgs.add("--preview-dart-2");
}
dartArgs.add(testFile);

Process process =
Expand Down
4 changes: 2 additions & 2 deletions lib/src/coveralls_endpoint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class CoverallsEndpoint {

MultipartRequest _getCoverallsRequest(String jsonString) {
var req = new MultipartRequest("POST", coverallsAddress);
req.files.add(
new MultipartFile.fromString("json_file", jsonString, filename: "json_file"));
req.files.add(new MultipartFile.fromString("json_file", jsonString,
filename: "json_file"));
return req;
}

Expand Down
12 changes: 7 additions & 5 deletions lib/src/coveralls_entities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ class PackageFilter {
{this.excludeTestFiles: false});

PackageFilter.from(String projectDirectory,
{this.excludeTestFiles: false, FileSystem fileSystem: const LocalFileSystem()})
{this.excludeTestFiles: false,
FileSystem fileSystem: const LocalFileSystem()})
: packageName = getPackageName(projectDirectory, fileSystem),
dartFiles = new PackageDartFiles.from(projectDirectory);

bool accept(String fileName, [FileSystem fileSystem = const LocalFileSystem()]) {
bool accept(String fileName,
[FileSystem fileSystem = const LocalFileSystem()]) {
log.info("ANALYZING $fileName");

if (fileName.startsWith(packageName)) {
Expand All @@ -50,8 +52,7 @@ class PackageFilter {
/// parses for the top level attribute name, which it then returns.
static String getPackageName(String projectDirectory,
[FileSystem fileSystem = const LocalFileSystem()]) {
var pubspecFile =
fileSystem.file(p.join(projectDirectory, "pubspec.yaml"));
var pubspecFile = fileSystem.file(p.join(projectDirectory, "pubspec.yaml"));
var pubspecContent = pubspecFile.readAsStringSync();
var yaml = loadYaml(pubspecContent);
return yaml["name"];
Expand Down Expand Up @@ -247,7 +248,8 @@ class CoverallsReport {
static CoverallsReport parse(
String repoToken, LcovDocument lcov, String projectDirectory,
{String serviceName, String serviceJobId, bool excludeTestFiles: false}) {
var gitData = GitData.getGitData(const LocalFileSystem().directory(projectDirectory));
var gitData =
GitData.getGitData(const LocalFileSystem().directory(projectDirectory));
var reports = SourceFileReports.parse(lcov, projectDirectory,
excludeTestFiles: excludeTestFiles);
return new CoverallsReport(repoToken, reports, gitData,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: |-
to LCOV and send it to coveralls
homepage: https://github.com/block-forest/dart-coveralls
environment:
sdk: '>=2.0.0-dev.55.0 <3.0.0'
sdk: '>=2.0.0-dev.64.1 <3.0.0'
dependencies:
args: '>=0.12.1 <2.0.0'
coverage: ^0.12.0
Expand Down
9 changes: 6 additions & 3 deletions test/coveralls_entities_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ void main() {
];

var fsMock = new FileSystemMock();
when(fsMock.file("/home/user/dart/dart_coveralls/test/test.dart")).thenReturn(testFiles.first);
when(fsMock.file("/home/user/dart/dart_coveralls/test/test.dart"))
.thenReturn(testFiles.first);
var packageFilter = new PackageFilter(
"dart_coveralls", new PackageDartFiles(testFiles, implFiles));
var noTestFilter = new PackageFilter(
Expand Down Expand Up @@ -209,8 +210,10 @@ void main() {
when(fileMock.existsSync()).thenReturn(false);
when(dirMock.path).thenReturn(".");
when(fileSystem.file("dart_coveralls/test.file")).thenReturn(fileMock);
when(fileSystem.file("./packages/dart_coveralls/test.file")).thenReturn(fileMock);
when(fileMock.resolveSymbolicLinksSync()).thenReturn("resolvedFile.dart");
when(fileSystem.file("./packages/dart_coveralls/test.file"))
.thenReturn(fileMock);
when(fileMock.resolveSymbolicLinksSync())
.thenReturn("resolvedFile.dart");
when(fileSystem.file("resolvedFile.dart")).thenReturn(resolvedFile);
when(resolvedFile.absolute).thenReturn(resolvedFile);

Expand Down
2 changes: 1 addition & 1 deletion test/coveralls_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void main() {
var mockDir = new DirectoryMock();
var args = ["remote", "-v"];
when(mockDir.path).thenReturn(".");
when(processSystem.runProcessSync( "git", args)).thenReturn(processResult);
when(processSystem.runProcessSync("git", args)).thenReturn(processResult);
when(processResult.stdout).thenReturn(
"origin\tgit@github.com:Adracus/dart-coveralls.git (fetch)\n" +
"origin\tgit@github.com:Adracus/dart-coveralls.git (push)");
Expand Down

0 comments on commit d599ae8

Please sign in to comment.