-
-
Notifications
You must be signed in to change notification settings - Fork 155
Improve performance of multimodule build by reusing compiler objects #720
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
base: master
Are you sure you want to change the base?
Conversation
@micossow Thanks for the PR. I no longer actively maintain the plugin, especially the SBT parts. @slandelle can you look at it when you'll have time? |
@davidB would you be open to moving the repo under scala or scalameta organizations? We could provide some basic maintenance there. |
Although I do see active maintenance in the repo, it might still be less of a burden for you if we moved to an organization. There was a topic raised in https://contributors.scala-lang.org/t/scala-maven-plugin-may-need-some-care/7108 |
compiler = ZincUtil.defaultIncrementalCompiler(); | ||
} | ||
|
||
private static Compilers makeCompilers( |
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 sure if we can make use of Lazy
thing from vavr to avoid
scalaVersion, compilerAndDependencies, libraryAndDependencies); | ||
|
||
compilers = makeCompilers(scalaInstance, javaHome, compilerBridgeJar); | ||
compiler = ZincUtil.defaultIncrementalCompiler(); |
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.
prefix compilers
with this.
?
if (path.getFileName().toString().equals("classes")) { | ||
analysisStoreFileName = "compile"; | ||
|
||
} else if (path.getFileName().toString().equals("test-classes")) { |
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.
extract path.getFileName().toString()
to a varaible
import xsbti.compile.*; | ||
|
||
public final class SbtIncrementalCompilers { | ||
|
||
private static File COMPILER_BRIDGE_JAR = null; | ||
private static SbtIncrementalCompiler SBT_INCREMENTAL_COMPILER = null; |
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.
Better protect with vavr
's Lazy or a AtomicReference to avoid concurrent update
That's just a proposal, I hoped it could ease some burden on you, but totally fine not to move it. I will try to help out with some reviews instead maybe. |
Hi,
We're using the scala-maven-plugin for one of our projects having multiple maven modules with scala code.
We observed, that each invocation of scala:compile hangs the build for several seconds.
After some digging into the plugin code I found out, that it does cold start of the compiler infrastructure each time it is invoked.
I managed to rearrange some code to make it possible to share the compiler bridge jar and compiler objects via static fields.
This simple change reduces
mvn clean install
(without tests) execution time by ~50%.