Skip to content

Commit

Permalink
fixing scoverage sourcePath to be relative in OSS
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nsaechao authored and wisechengyi committed May 4, 2020
1 parent 539c83f commit 7509289
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions 3rdparty/jvm/com/twitter/scoverage/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
# https://github.com/twitter-forks/scalac-scoverage-plugin. PR for the modifications
# on original scoverage repo here: https://github.com/scoverage/scalac-scoverage-plugin/pull/267.
# In future, we should ping OSS Scoverage to get that PR merged and consume scoverage directly
# from there.
# from there. Version 1.0.2 incorporates the changes in the following PR:
# https://github.com/scoverage/scalac-scoverage-plugin/pull/275.

jar_library(name='scalac-scoverage-plugin',
jars=[
scala_jar(org='com.twitter.scoverage', name='scalac-scoverage-plugin', rev='1.0.1-twitter'),
scala_jar(org='com.twitter.scoverage', name='scalac-scoverage-plugin', rev='1.0.2-twitter'),
],
)
4 changes: 2 additions & 2 deletions src/python/pants/backend/jvm/subsystems/scoverage_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ def scoverage_jar(self):
JarDependency(
org="com.twitter.scoverage",
name="scalac-scoverage-plugin_2.12",
rev="1.0.1-twitter",
rev="1.0.2-twitter",
),
JarDependency(
org="com.twitter.scoverage",
name="scalac-scoverage-runtime_2.12",
rev="1.0.1-twitter",
rev="1.0.2-twitter",
),
]

Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/jvm/tasks/coverage/scoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def register_options(cls, register):

def scoverage_jar(name, **kwargs):
return JarDependency(
org="com.twitter.scoverage", name=name, rev="1.0.1-twitter", **kwargs
org="com.twitter.scoverage", name=name, rev="1.0.2-twitter", **kwargs
)

def slf4j_jar(name):
Expand Down

0 comments on commit 7509289

Please sign in to comment.