-
Notifications
You must be signed in to change notification settings - Fork 126
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
converting source path from absolute to relative #275
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker, but: is it possible to cover this with a test?
// instead of the canonical path. This is required to make it work with | ||
// remoting or in a distributed environment. | ||
def getRelativePath(filePath: String): String = { | ||
val base = new File(".").getCanonicalPath + File.separator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This operation is relativize
: https://docs.oracle.com/javase/tutorial/essential/io/pathOps.html#relativize
Hi guys You assumed that current working directory is project's root directory. This is not always true. For example in Maven you can specify |
@gslowikowski |
Co-authored-by: Ny Saechao <[email protected]> The problem is also referenced here : scoverage/scalac-scoverage-plugin#275 ### Problem Currently, at compile time, scoverage stores (as a string) the conical sourcePath (path for the source file) for a statement inside the instrument file `scoverage.coverage`. This string is then again required during report generation to get the source file in `ScoverageHtmlWriter` . This breaks in a distributed environment where report generation is happening on a different machine and is unable to locate the source file due to the absolute path. ### Solution The current fix makes the path relative when storing and turns it back to a conical one (w.r.t cwd) on retrieving. For now, the fix is merged in twitter forked version of scoverage (version 1.0.2-twitter). ### Result Scoverage can now work in a distributed environment.
Co-authored-by: Ny Saechao <[email protected]> The problem is also referenced here : scoverage/scalac-scoverage-plugin#275 ### Problem Currently, at compile time, scoverage stores (as a string) the conical sourcePath (path for the source file) for a statement inside the instrument file `scoverage.coverage`. This string is then again required during report generation to get the source file in `ScoverageHtmlWriter` . This breaks in a distributed environment where report generation is happening on a different machine and is unable to locate the source file due to the absolute path. ### Solution The current fix makes the path relative when storing and turns it back to a conical one (w.r.t cwd) on retrieving. For now, the fix is merged in twitter forked version of scoverage (version 1.0.2-twitter). ### Result Scoverage can now work in a distributed environment.
Co-authored-by: Ny Saechao <[email protected]> The problem is also referenced here : scoverage/scalac-scoverage-plugin#275 ### Problem Currently, at compile time, scoverage stores (as a string) the conical sourcePath (path for the source file) for a statement inside the instrument file `scoverage.coverage`. This string is then again required during report generation to get the source file in `ScoverageHtmlWriter` . This breaks in a distributed environment where report generation is happening on a different machine and is unable to locate the source file due to the absolute path. ### Solution The current fix makes the path relative when storing and turns it back to a conical one (w.r.t cwd) on retrieving. For now, the fix is merged in twitter forked version of scoverage (version 1.0.2-twitter). ### Result Scoverage can now work in a distributed environment.
Still needed? |
I'm going to go ahead and close this in favor of #385, which will be merged into the V2 branch. The idea is exactly the same, but we avoid the issue raised here about assuming the source directory being |
Necessary for #265 :
Currently, at compile time, scoverage stores (as a string) the conical sourcePath (path for the source file) for a statement inside the instrument file
scoverage.coverage
. This string is then again required during report generation to get the source file inScoverageHtmlWriter
. This breaks in a distributed environment where report generation is happening on a different machine and is unable to locate the source file due to the absolute path.The current fix makes the path relative when storing and turns it back to a conical one (w.r.t cwd) on retrieving. Thanks