Skip to content

Fix deprecated destinationDir property #162

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

Merged
merged 1 commit into from
Aug 15, 2021
Merged
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
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ task crossScalaVersionTest(type: Test) {
classpath = sourceSets.crossScalaVersionTest.runtimeClasspath
forkEvery = 1 // crucial to run every test in its own JVM

testLogging.showStandardStreams = true
testLogging {
events 'passed', 'failed', 'skipped'
showStandardStreams = System.env.CI == 'true'
}

mustRunAfter test
}
Expand All @@ -96,7 +99,10 @@ task functionalTest(type: Test) {
testClassesDirs = sourceSets.functionalTest.output
classpath = sourceSets.functionalTest.runtimeClasspath

testLogging.showStandardStreams = true
testLogging {
events 'passed', 'failed', 'skipped'
showStandardStreams = System.env.CI == 'true'
}

mustRunAfter crossScalaVersionTest
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Tag;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.scoverage.ScoverageFunctionalTest;
import org.scoverage.ScoveragePlugin;

import java.io.File;

public class ScalaCrossVersionAggregationTest extends ScoverageFunctionalTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void reportComposite() {

private AssertableBuildResult runComposite(String... arguments) {

List<String> fullArguments = new ArrayList<String>();
List<String> fullArguments = new ArrayList<>();
fullArguments.add("-p");
fullArguments.add("proj1");
fullArguments.add("--include-build");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.scoverage;

import org.gradle.testkit.runner.TaskOutcome;
import org.junit.Assert;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.scoverage;

import groovy.util.Node;
import groovy.util.XmlParser;
import groovy.xml.XmlParser;
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.BuildTask;
import org.gradle.testkit.runner.GradleRunner;
Expand Down Expand Up @@ -87,7 +87,7 @@ protected AssertableBuildResult runAndFail(String... arguments) {

protected AssertableBuildResult dryRun(String... arguments) {

List<String> withDryArgument = new ArrayList<String>(Arrays.asList(arguments));
List<String> withDryArgument = new ArrayList<>(Arrays.asList(arguments));
withDryArgument.add("--dry-run");
return run(withDryArgument.toArray(new String[]{}));
}
Expand Down Expand Up @@ -119,14 +119,15 @@ private Double coverage(File reportDir, CoverageType coverageType) throws IOExce

private void configureArguments(String... arguments) {

List<String> fullArguments = new ArrayList<String>();
List<String> fullArguments = new ArrayList<>();

fullArguments.add("-PscalaVersionMajor=2");
fullArguments.add("-PscalaVersionMinor=12");
fullArguments.add("-PscalaVersionBuild=8");
fullArguments.add("-PjunitVersion=5.3.2");
fullArguments.add("-PjunitPlatformVersion=1.3.2");
fullArguments.add("-PscalatestVersion=3.0.8");
fullArguments.add("--warning-mode=all");
fullArguments.addAll(Arrays.asList(arguments));

runner.withArguments(fullArguments);
Expand Down
2 changes: 1 addition & 1 deletion src/main/groovy/org/scoverage/CoverageChecker.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.scoverage


import groovy.xml.XmlParser
import org.gradle.api.GradleException
import org.gradle.api.logging.Logger
import org.gradle.internal.impldep.com.google.common.annotations.VisibleForTesting
Expand Down
9 changes: 6 additions & 3 deletions src/main/groovy/org/scoverage/ScoveragePlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ScoveragePlugin implements Plugin<PluginAware> {

static final String DEFAULT_REPORT_DIR = 'reports' + File.separatorChar + 'scoverage'

private final ConcurrentHashMap<Task, Set<? extends Task>> taskDependencies = new ConcurrentHashMap<>();
private final ConcurrentHashMap<Task, Set<? extends Task>> taskDependencies = new ConcurrentHashMap<>()

@Override
void apply(PluginAware pluginAware) {
Expand Down Expand Up @@ -232,9 +232,10 @@ class ScoveragePlugin implements Plugin<PluginAware> {
compileTask.configure {
if (!graph.hasTask(originalCompileTask)) {
project.logger.info("Making scoverage compilation the primary compilation task (instead of compileScala)")
destinationDir = originalCompileTask.destinationDir
destinationDirectory = originalCompileTask.destinationDirectory
} else {
doFirst {
def destinationDir = destinationDirectory.get().asFile
destinationDir.deleteDir()
}

Expand All @@ -243,7 +244,9 @@ class ScoveragePlugin implements Plugin<PluginAware> {
project.logger.info("Deleting classes compiled by scoverage but non-instrumented (identical to normal compilation)")
def originalCompileTaskName = project.sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME)
.getCompileTaskName("scala")
def originalDestinationDir = project.tasks[originalCompileTaskName].destinationDir
def originalDestinationDirectory = project.tasks[originalCompileTaskName].destinationDirectory
def originalDestinationDir = originalDestinationDirectory.get().asFile
def destinationDir = destinationDirectory.get().asFile

def findFiles = { File dir, Closure<Boolean> condition = null ->
def files = []
Expand Down
2 changes: 1 addition & 1 deletion src/main/groovy/org/scoverage/ScoverageRunner.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ScoverageRunner {
method.setAccessible(true)

runtimeClasspath.files.each { f ->
def url = f.toURL()
def url = f.toURI().toURL()
if (!cloader.getURLs().contains(url)) {
method.invoke(cloader, url)
}
Expand Down