Skip to content

BaseReportWriter fails with "No source root found" when source uses symbolic links #150

Closed
@nickweeds

Description

@nickweeds

Problem:
I have an sbt project that collects code coverage for source code in another project that it picks up using a symbolic link of the form
ln -s {external_root}/{project}/src/main {root}/{project}/src/main
Everything works fine until I run "sbt coverageReport", but that fails with an error of the form:
No source root found for '{root}/{project}/src/main/.../{source.scala}' (source roots: '{external_root}/{project}/src/main/scala/', ...')

Diagnosis:
The failure occurs because BaseReportWriter applies _.getCanonicalPath to sourceDirectories (when initializing formattedSourcePaths) but not to the source file in relativeSource().

Fix:
I think this can be fixed in relativeSource() by applying getCanonicalPath to the source file name before searching sourcePaths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions