Comments (6)
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.
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.
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.
The result is amazing! 90% decrease in incremental compilation speed in many cases, and 50% reduction in clean compile.
from scalapb.
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.
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)
- Support more than 254 fields HOT 1
- Cyclic Error when compiling protobuf-java 3.24.0 on Scala 3.3.0
- Add option to generate only gRPC service and method descriptors. HOT 1
- Custom target directory breaks incremental compilation HOT 2
- ScalaPB 0.11.13 missing release note HOT 3
- problem with `-Xsource:3` and Scala 2.13.12 HOT 2
- Dockerized Native Image build failing HOT 4
- Unify ObjectLens and MessageLens in next release
- Different behavior from Google protoc generated message for accessing proto extensions HOT 15
- Scalapb.proto would result in a name clash for clearExtension method in OneofOptionsBuilder HOT 8
- allow_alias equality semantics differ between generated Scala and Java code HOT 1
- JSON serialization of Any message fails when the message has a special JSON representation HOT 2
- scalapb grpc runtime & InProcessTransport HOT 4
- Unrecognized enum serialized as int HOT 2
- Cannot name a 'oneof' field 'option' if an optional field exists HOT 1
- --jvm_0_out: protoc-gen-jvm_0: Plugin failed with status code 1. WIth Java version 11, change to 17 is fixed HOT 21
- Type Mismatch Error with `asRecognized` in versions 0.11.14 and 0.11.15 HOT 3
- sealed_oneof_companion_extends doesn't work for optional sealed oneof
- Sealed oneof "extend" for Empty case HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalapb.