You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
For readers convenience, we are talking about BaseReportWriter class.
I implemented relativeSource method. In fact the easiest way to fix this bug would be to map src to new File(src).getCanonicatPath but I generally don't like calling getCanonicalPath if not absolutely needed.
getCanonicalPath was here since version 1.0.0 (this commit), but why was it introduced there? @sksamuel, do you remember?
Because it was here for so long, I left it here.
src parameter in relativeSource method comes from Statement.source.path and represents absolute path, not canonical. It comes from the internals of Scalac. I cannot find, where and how it's created.
Maybe we could change
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.
The text was updated successfully, but these errors were encountered: