Code Monkey home page Code Monkey logo

Comments (6)

thesamet avatar thesamet commented on May 24, 2024 1

Perfect. Will close the issue now and cut a release soon. Don't hesitate to start a new issue or comment here if anything left unresolved.

from scalapb.

thesamet avatar thesamet commented on May 24, 2024

Hi Oscar, thanks for suggesting this feature and contributing the PR. I had started to work on this in parallel, looked at your code and made adjustments in mine as necessary. One difference is that I refrained from introducing target_regex in aux_message_options but expanded target to accept * to indicate to apply to all messages in scope. Will this work for you?

I'd really appreciate before I cut a release if you will be able to try out the snapshot release 0.11.13+88-1d78ac52-SNAPSHOT and see if it works for? Some documentation is at https://github.com/scalapb/ScalaPB/blob/master/CHANGELOG.md#01114 , and

from scalapb.

oscar-broman avatar oscar-broman commented on May 24, 2024

Hi, thanks!

While I was unable to try the snapshot you published due to scalapb-runtime_3 missing for that version, I published it locally and tried it out.

There's one thing that's preventing me from not importing io.circe.generic.auto.* and that is the derives clause for GeneratedSealedOneof. Currently, only NonEmpty has the clause (and rightfully so!), but it's also needed for the top-level type.

However, I changed all sealed_value messages into sealed_value_optional and while it did increase boilerplate a bit, I got rid of some rather complex type-class derivation logic.

In the end, I'm left with the following diff required to make things work:

diff --git a/compiler-plugin/src/main/scala/scalapb/compiler/SealedOneofsGenerator.scala b/compiler-plugin/src/main/scala/scalapb/compiler/SealedOneofsGenerator.scala
index cbfce320..2f65388d 100644
--- a/compiler-plugin/src/main/scala/scalapb/compiler/SealedOneofsGenerator.scala
+++ b/compiler-plugin/src/main/scala/scalapb/compiler/SealedOneofsGenerator.scala
@@ -31,7 +31,7 @@ class SealedOneofsGenerator(message: Descriptor, implicits: DescriptorImplicits)
       val bases =
         if (baseClasses.nonEmpty)
           s"extends ${baseClasses.mkString(" with ")} $derives"
-        else ""
+        else s"$derives"
 
       if (message.sealedOneofStyle != SealedOneofStyle.Optional) {
         val sealedOneofNonEmptyName = message.sealedOneofNonEmptyScalaType.nameSymbol

from scalapb.

oscar-broman avatar oscar-broman commented on May 24, 2024

The result is amazing! 90% decrease in incremental compilation speed in many cases, and 50% reduction in clean compile.

from scalapb.

thesamet avatar thesamet commented on May 24, 2024

The previous commit has the diff you posted. Can you try again? I'm not sure why you were not able to use scalapb_runtime-3. Tthe new version is published on sonatype, but also the previous version did. Are your resolvers configured correctly for the project/

from scalapb.

oscar-broman avatar oscar-broman commented on May 24, 2024

Correct! I had the Sonatype snapshots configured only for the build project, and not for the project that used ScalaPB.

It works now.

from scalapb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.