Skip to content

Do not fail on missing scoverage compile task in dependency #137

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
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.scoverage;

import org.junit.Test;

public class ScalaMultiModuleWithPartialScoverageUseTest extends ScoverageFunctionalTest {

public ScalaMultiModuleWithPartialScoverageUseTest() {
super("scala-multi-module-with-partial-scoverage-use");
}

@Test
public void reportScoverage() {

AssertableBuildResult result = dryRun("clean", ScoveragePlugin.getREPORT_NAME());

result.assertTaskExists(ScoveragePlugin.getREPORT_NAME());
result.assertTaskExists("b:" + ScoveragePlugin.getREPORT_NAME());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.hello.a

class WorldA {

def fooA(): String = {
"a"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.hello.b

class WorldB {

def fooB(): String = {
"b"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
plugins {
id 'org.scoverage' apply false
}

description = 'a multi-module Scala project that builds successfully and has modules which does not use scoverate plugin'

allprojects { p ->
repositories {
jcenter()
}

apply plugin: 'java'
apply plugin: 'scala'

if (p.name != 'a') {
apply plugin: 'org.scoverage'
}

dependencies {

compile group: 'org.scala-lang', name: 'scala-library', version: "${scalaVersionMajor}.${scalaVersionMinor}.${scalaVersionBuild}"

testCompile group: 'org.junit.platform', name: 'junit-platform-runner'

testCompile group: 'org.scalatest', name: "scalatest_${scalaVersionMajor}.${scalaVersionMinor}"
}
}

dependencies {
compile project(':a')
compile project(':b')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include 'a', 'b'
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.hello

import org.hello.a.WorldA
import org.hello.a.WorldB

class World {

def foo(): String = {
WorldA.foo() + WorldB.foo()
}
}
4 changes: 2 additions & 2 deletions src/main/groovy/org/scoverage/ScoveragePlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ class ScoveragePlugin implements Plugin<PluginAware> {
it instanceof ScalaCompile
}
originalCompilationDependencies.each {
def dependencyProjectCompileTask = it.project.tasks[COMPILE_NAME]
def dependencyProjectReportTask = it.project.tasks[REPORT_NAME]
def dependencyProjectCompileTask = it.project.tasks.findByName(COMPILE_NAME)
def dependencyProjectReportTask = it.project.tasks.findByName(REPORT_NAME)
if (dependencyProjectCompileTask != null) {
compileTask.dependsOn(dependencyProjectCompileTask)
// we don't want this project's tests to affect the other project's report
Expand Down