-
-
Notifications
You must be signed in to change notification settings - Fork 2
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 PekkoInlinePlugin #2
Conversation
One of the main reasons for this SBT plugin is to allow 1.0 builds to test with 1.1 builds from other Pekko modules. As a result, I would prefer if the inline support was opt-in - i.e. not enabled by default. |
Making it opt-in by default is not solving any real problem since by design you would just enable The better way to solve this issue is to put in a check to make sure that the inliner is only enabled if the version of the sbt module is 1.1.0 or higher, its also codifying what has been agreed upon i.e. that only pekko module's which are version 1.1.0 or higher have the inliner enabled. Is this acceptable to you? |
@pjfanning Or are you arguing that by making it optional, it would only be enabled in the |
Yes - making it something that needs to be enabled explicitly means that we can enable it where we need to and that we don't need to go and disable explicitly in places where we don't want it. |
658d6cd
to
1126f87
Compare
@pjfanning I have just updated the PR, basically adding an sbt setting called One thing that needs to made is that the inlining should only be set globally, i.e. either the entire sbt build should have every project with inline enabled or every project should have inlined disabled. Toggling inlining on a project by project basis is going to cause problems especially when coupled with incremental compilation (this is why in every other Scala project that uses the inliner its just enabled globally). For this reason, toggling the inliner using Now fixing this is quite simple, we can just add a The second question is whether this
That is, if the inliner is off by default it makes things much more difficult when validating releases. What the current implementation in this PR means is that for given Pekko module
The issue is if we reverse this, i.e. make In addition I have tested the inliner on wdyt? |
I would still much prefer if this was not enabled by default - that you need to explicitly enable this behaviour. We have 2 places where we want to enable it (pekko-core main and pekko-http main) and lots of modules and the 1.0.x branches on pekko-core and pekko-http where we don't want to enable it yet. |
src/main/scala/com/github/pjfanning/pekkobuild/PekkoInlinePlugin.scala
Outdated
Show resolved
Hide resolved
I understand but this causes actual technical issues as I have outlined before, otherwise I wouldn't be arguing for it.
I wasn't under the impression that this plugin is meant to be used for pekko main, if thats the case then the argument for having it enabled by default is even stronger. Also in pekko main the plugin is currently automatically enabled and it hasn't caused any issues.
This is easily solvable with one line of code, when you update to the latest version of sbt-pekko-build you just add ThisBuild / pekkoInlineEnabled := false and thats it. I fail to understand why this is such a big deal especially since in the future the common case for the inliner is going to be enabled, not disabled. Once every Pekko module has its 1.1.x release, there will not be a single place where the inliner will be disabled aside from the 1.0.x branches. Its actually best that we deal with the uncommon case (which is inliner being disabled) now as sbt-pekko-build is slowly being integrated rather than the other way around. |
1126f87
to
b1b3b75
Compare
Also now that I think of it, this sbt plugin really shouldn't be used in pekko main because its causing a circular dependency, we have code here referencing pekko http (i.e. sbt-pekko-build/src/main/scala/com/github/pjfanning/pekkobuild/PekkoHttpDependency.scala Line 16 in 0d42f2b
We should either remove |
this code does not use PekkoHttp code - it just looks at Maven Central repo to find version numbers using raw Scala code |
I know, but we have code referencing Pekko http sitting inside of Pekko which goes against basic design, i.e. no code inside of pekko should be aware of pekko-http existence and it just creates confusion. I think this problem can easily be solved by just generalizing all of this maven central lookup logic into a trait (lets call it PekkoHttpDependency extends PekkoDependency // if you want this functionality for pekko-http
PekkoConnectorsDependency extends PekkoDependency // if you want this functionality for pekko-connectors Ill make a PR for this tomorrow |
I'm still against making the inline behaviour the default. The PekkoDependency support is useful for us to put on 1.0.x branches (or main when 1.0.x is not yet forked). This will become dangerous with this PR change. Developers could easily enable inlining when they don't mean to. |
Inlining is meant to be a feature that is globally toggled, turned on and left that way, there is never a case for disabling it other than as a knob so you can see the effects which is why When I am saying I am doing so because this is how its used in the entirety of the Scala ecosystem, including massive critical projects such as the scala2 compiler and zinc inremental compiler
How, it would require a PR that has to be reviewed???? If we are talking about Pekko specifically, there is a setting to disable it for the 1.0.x branches (
With this kind of defensive reasoning you can argue anything, developers can accidentally do a lot of things that can break a project. Having it disabled in 1.0.x is in of itself an already extremely defensive/excessive/reactionary stance since tbh personally the reason I am doing such is not because of any technical justification but just because of largely subjective buy in. |
fa7bb30
to
5587a8a
Compare
I have updated the PR to handle the case when sbt-pekko-build is used for pekko-core (there is a |
bcc7234
to
59d91ad
Compare
59d91ad
to
d525231
Compare
I have just added another commit which turns The ability to determine if the project is pekko core or not is going to be a somewhat common occurance as pekko core does have a fair amount of build functionality which is bespoke to it. |
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.
lgtm
This PR automatically enables the Scala 2 inliner for Pekkos modules. Unlike pekko core's
PekkoInlinePlugin
, this version ONLY does inlining that is considered safe, i.e."-opt-inline-from:<sources>"
which only inlines sources internal within the sbt module itself (i.e. never inlines code from outside the sbt module) and the variousorg.apache.pekko.util
/org.apache.pekko.dispatch
functions which are guaranteed not to change (hence safe to inline)Note that even though this plugin is automatically enabled, in exceptional cases you can disable this plugin using
DisablePlugin(PekkoInlinePlugin)
on the sbt module.Lastly, it is intended that this inliner should only be used for the 1.1.x branches of the various Pekko modules. I can't recall on the top of my head if we started using the
sbt-pekko-build
for Pekko projects that are still sitting on 1.0.x. If this is the case then another check needs to be added to make sure that the inliner is only enabled if the version of the module is 1.1.0 or higher, @pjfanning can you confirm/deny this?