Skip to content

Commit

Permalink
Merge pull request #113 from pdolega/master
Browse files Browse the repository at this point in the history
#104 Cross project build fixed
  • Loading branch information
gslowikowski authored Apr 8, 2018
2 parents 8cabe48 + 117fdf7 commit 3c506b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class CoberturaMultiSourceReader(coberturaFile: File, sourceDirs: Seq[File], enc
* It returns false if child and parent points to the same directory
*/
def isChild(child: File, parent: File): Boolean = {
val childPath = child.toURI.getPath
val parentPath = parent.toURI.getPath
val childPath = child.toPath
val parentPath = parent.toPath
childPath != parentPath && childPath.startsWith(parentPath)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ object CoverallsPlugin extends AutoPlugin {
// include all of the sources (stanard roots and multi-module roots)
val sources: Seq[File] = (sourceDirectories in Compile).value
val multiSources: Seq[File] = coverallsSourceRoots.value.flatten
val allSources = sources ++ multiSources
val allSources = (sources ++ multiSources).filter(_.isDirectory()).distinct

val reader = new CoberturaMultiSourceReader(report.file, allSources, sourcesEnc)
val sourceFiles = reader.sourceFilenames
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ class CoberturaMultiSourceReaderTest extends WordSpec with BeforeAndAfterAll wit
//catches mistakes with substrings
reader.isChild(new File(root, "srcB-2.10"), srcFoo) shouldBe false
}

"correctly recognize that paths is not a child only because it is prefix of another path" in {
reader.isChild(new File(root, "/src/main/scala-2.12"), new File(root, "/src/main/scala")) shouldBe false
reader.isChild(new File(root, "/src/aaab"), new File(root, "/src/aaa")) shouldBe false

reader.isChild(new File(root, "/src/aaa/b"), new File(root, "/src/aaa")) shouldBe true
}
}

"CoberturaMultiSourceReader" should {
Expand Down

0 comments on commit 3c506b6

Please sign in to comment.