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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to the latest metaconfig #1145
Conversation
Appears that we need to upgrade to scalameta v1.8 from v1.7 to complete this PR. The Scala.js linker failures indicate the current classpath is broken on the JVM potentially causing `MethodNotFoundExceptiond due to a binary incompatible change between fastparse 0.4.2 and 0.4.3. The JVM test suite didn't catch it because it is not as exhaustive as the Scala.js closed world optimizer + linker. The changes for v1.7 to v1.8 are small but enough to cause ~40 test failures. I fixed one incompatibility which brings it down to ~5 test failures. I'm gonna go ahead and publish a release with the current master before going ahead with this fix. |
All tests are passing now after upgrading to v1.8 馃帀 scalafmt can now format code splices inside of xml literals :) We are now blocked by the lack of a
writing the encoder derivation macro |
Opened https://github.com/olafurpg/metaconfig/pull/43 adding |
The upgrade to scalameta v1.8 is complete, it took a while since the changes around lambdas were quite big. Overall I think it's a nice improvement, for example it can now force the body of a HOF to be on the same line as the parameter list // before
(x: Int) =>
x + 1
// after
(x: Int) => x + 1 Now we are only blocked by lack of toHocon. |
if you're using semi automatic derivation in scalameta, maybe there is an opportunity to use the compiler plugin (without the scalaz bits) from https://gitlab.com/fommil/scalaz-deriving/ |
I am indeed using semiauto but with a a twist where I need a base default value passed into the derivation macro. This is required to apply configuration on top of a base setting, for example I took a look at scalaz deriving but struggled to figure out what required scalaz and what didn't. It would be helpful to have a section on how to use it without bringing in scalaz. |
@olafurpg the entire https://gitlab.com/fommil/scalaz-deriving/#compiler-plugin does not require scalaz. |
Once this is merged I should be able to use metals on this code-base right? |
@mads-hartmann I haven't tried, there might be other issues but removing scalameta/paradise should definitely improve the situation |
This upgrade is quite brutal since we no longer use the paradise macro annotations to generate readers.
There was a change in how Term.Function inside Term.Block are encoded, the bodies used to be `Term.Block` with a single expression but now the body is unwrapped
Previously, in v1.7 the syntax `a.map { x => y }` produced a `Term.Block` wrapping the `y` but in v1.8 there is no block. The previous commit introduced a fix for one layer of curried lambdas and this commit extends that to any layer of nested lambdas.
This fixes the last remaining failing test cases.
I thought there had been a regression when browsing the diff in scala-repos but I suspect this was a bug from before upgrading. Either way, it's fixed now.
The `case ClassTag.Double` was wrongly indented by 2 spaces. Discovered running on scala-repos.
This should likely be moved upstream to metaconfig
Released metaconfig v0.7.2 that adds a hocon printer and |
OK, this is ready for merge 馃挭 @mads-hartmann any chance you could take a look at the configuration examples to see if I messed up? |
Gonna go ahead and merge this to unblock a followup PR that upgrades scalameta to v3.7 |
@olafurpg Awesome work. As far as I can tell the show/hide config options works like expected 馃憤 |
This PR removes the dependency on scalameta/paradise macro annotations and upgrades to the latest metaconfig version (https://olafurpg.github.io/metaconfig/). This is the first step towards having configuration work the same across JVM, JS and Native.
Most of the diff is replacing the
@GenerateConfDecoder
macro annotation with the semi-automaticmetaconfig.generic.{deriveDecoder,deriveSurface}
def macros. Amazingly, 1031 out of 1032 tests passed on first compile 馃挭The surface macro is nice since it allows automatic generation of all configuration settings with explanation messages, default values and types. Example how we use it in scalafix https://scalacenter.github.io/scalafix/docs/rules/DisableSyntax
The only regression I can't avoid is the "Other" section on the website that did a best-effort to pretty-print all available configuration options as HOCON. The website links to the
ScalafmtConfig
sources instead now.