Skip to content
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

Add Scala 2.13.0-M4 support #225

Closed
ghost opened this issue Jul 7, 2018 · 16 comments
Closed

Add Scala 2.13.0-M4 support #225

ghost opened this issue Jul 7, 2018 · 16 comments

Comments

@ghost
Copy link

ghost commented Jul 7, 2018

please 😺

ref typelevel/cats#2267

@xuwei-k
Copy link
Contributor

xuwei-k commented Jul 8, 2018

prepare Scala 2.13.0-M4 #224
(scala-js 0.6.22 does not support Scala 2.13.0-M4)

@xuwei-k
Copy link
Contributor

xuwei-k commented Jul 8, 2018

scalac-scoverage-plugin depends on scala-logging (only test) lightbend-labs/scala-logging#127

@SethTisue
Copy link

scala-logging 3.9.0 has now been published for M4

@gslowikowski
Copy link
Member

There is a problem with this version. Guys, I need you help.

Here are the branches:
https://github.com/scoverage/scalac-scoverage-plugin/tree/scala-2-13-0-M4
https://github.com/scoverage/sbt-scoverage/tree/scala-2-13-0-M4

Please, publish the plugin locally and try to build any project with sbt clean coverage compile
While compiling I have:

...
[info] [info] Beginning coverage instrumentation
[info] [info] Instrumentation completed [9 statements]
[error] ## Exception when compiling 1 sources to ${path\to\my\project}\target\scala-2.13.0-M4\classes
[error] scala/xml/NamespaceBinding
[error] scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:125)
[error] scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1449)
[error] scala.tools.nsc.Global$Run.compileUnits(Global.scala:1433)
[error] scala.tools.nsc.Global$Run.compileSources(Global.scala:1425)
[error] scala.tools.nsc.Global$Run.compile(Global.scala:1542)
[error] xsbt.CachedCompiler0.run(CompilerInterface.scala:130)
[error] xsbt.CachedCompiler0.run(CompilerInterface.scala:105)
[error] xsbt.CompilerInterface.run(CompilerInterface.scala:31)
[error] sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] java.lang.reflect.Method.invoke(Method.java:498)
[error] sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:237)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:111)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:90)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:83)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:134)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:74)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:117)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:305)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:305)
[error] sbt.internal.inc.Incremental$.doCompile(Incremental.scala:101)
[error] sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:82)
[error] sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:110)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:57)
[error] sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:84)
[error] sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:129)
[error] sbt.internal.inc.Incremental$.compile(Incremental.scala:75)
[error] sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:61)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:309)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:267)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:158)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:237)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:68)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1427)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1401)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] sbt.std.Transform$$anon$4.work(System.scala:66)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] sbt.Execute.work(Execute.scala:271)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] java.lang.Thread.run(Thread.java:748)
[error]
[error] java.lang.NoClassDefFoundError: scala/xml/NamespaceBinding
[error]         at scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:125)
[error]         at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1449)
...

@SethTisue
Copy link

looks like you're doing XML stuff but don't have scala-xml on the classpath. as of 2.13.0-M4, scala-compiler no longer depends on scala-xml, that seems like a likely root cause

idk, but perhaps this line of code needs updating? val scalaJars = List("scala-compiler", "scala-library", "scala-reflect")

@gslowikowski
Copy link
Member

I have scala-xml dependency, here. It was always there, only the version changes.

For me it looks like something has changed with plugin's classloader/classpath.

@SethTisue
Copy link

I don't know of any Scala change that might cause that, other than the one I mentioned. Perhaps there is an implicit assumption in your code that loading the scala-compiler classes also causes the scala-xml classes to be loaded in the same classloader.

@gslowikowski
Copy link
Member

gslowikowski commented Jul 17, 2018

I found it, scala-compiler does not depend on scala-xml anymore (since this commit).

Project's dependency on scala-xml is not used in scalac compilation context, but Scala compiler provided it anyway up to version 2.13.0-M3.

@JanBessai
Copy link
Contributor

JanBessai commented Jul 18, 2018

Tests in the 2.13.0-M4 tree seem to work fine, except for the yielder. Adding some embarrassing printf-debugging code, I was able to obtain a direct comparison. You can see that the new collections API eliminates two calls to canBuildFrom(), which were counted previously (but not mentioned in the test comment).
I guess you can fix this in two ways: the hard way would be a split of the test-base and the easy way would be to expect two statements less.
Also, the explanation for the test seems to be a little misleading, since it counts canBuildFrom as map and flatMap.

@SethTisue
Copy link

SethTisue commented Jul 18, 2018

the hard way would be a split of the test-base

(maybe not so hard — I'm not sure how widely known it is that you can have src/test/scala-2.11, src/test/scala-2.12 and so forth and sbt will pick up the version-specific sources automatically. see my comment at twitter/util#219 (comment))

@JanBessai
Copy link
Contributor

Now pull-request #228 tests fine in Travis. Splitting the test-base as suggested by @SethTisue would be an alternative, but perhaps it is a bit much for a problem validly solvable with a simple weakening of a single == to <=.
Maybe the split could become a long-term todo, if more need for it arises. For now it would be great to have a working pre-release compatible with Scala 2.13.0-M4.

@gslowikowski
Copy link
Member

@JanBessai's changes are merged to master.

Now we come to the point I've described above

How to solve it? Scoverage needs scala-xml, but scalac plugins cannot have dependencies in the context of compilation.

@JanBessai
Copy link
Contributor

Not sure, if the license allows for it, but could you perhaps use sbt-assembly and bundle scala-xml with the plugin jar?

@gslowikowski
Copy link
Member

I don't want to do it.

Actually I have experimental version of scoverage with plain text format of internal files. I've prepared it to compare performance with and without xml, but maybe now it's time to use it.

@JanBessai
Copy link
Contributor

JanBessai commented Jul 22, 2018

If changing the file format is an option, you might also look at Jsoniter, which can generate runtime-dependency free json (un)parsers.

@gslowikowski
Copy link
Member

Version 1.4.0-M4 released (with sbt-scoverage version 1.6.0-M4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants