From 3fac97ad6b91a5f9d062b8471423bb598fd98b23 Mon Sep 17 00:00:00 2001 From: Nadav Samet Date: Wed, 11 Oct 2023 13:20:29 -0700 Subject: [PATCH 01/20] Add wildcard option for auxiliary options. For #1584 --- CHANGELOG.md | 2 ++ .../compiler/DescriptorImplicits.scala | 27 ++++++++++++------- .../compiler/DescriptorImplicitsSpec.scala | 19 +++++++++++++ docs/src/main/markdown/customizations.md | 3 ++- e2e/src/main/protobuf/scoped/wildcard.proto | 26 ++++++++++++++++++ .../scalapb/e2e/scoped/WildcardTrait.scala | 3 +++ e2e/src/test/scala/scoped/WildcardSpec.scala | 11 ++++++++ protobuf/scalapb/scalapb.proto | 12 ++++++--- 8 files changed, 88 insertions(+), 15 deletions(-) create mode 100644 e2e/src/main/protobuf/scoped/wildcard.proto create mode 100644 e2e/src/main/scala/scalapb/e2e/scoped/WildcardTrait.scala create mode 100644 e2e/src/test/scala/scoped/WildcardSpec.scala diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f35aac5a..0206cf2f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ CollectionAdapter for (#1509) - Introduced new generator parameter `scala3_sources` (also available via scalapb.proto) to generate sources that are compatible with Scala 3 (#1576) +- aux_*_options now accept "*" in the target field to match all entities in + scope. ## [0.11.13] - Added input and output message type for method descriptor (#1503) diff --git a/compiler-plugin/src/main/scala/scalapb/compiler/DescriptorImplicits.scala b/compiler-plugin/src/main/scala/scalapb/compiler/DescriptorImplicits.scala index cc8eca64b..3bd9357c5 100644 --- a/compiler-plugin/src/main/scala/scalapb/compiler/DescriptorImplicits.scala +++ b/compiler-plugin/src/main/scala/scalapb/compiler/DescriptorImplicits.scala @@ -330,7 +330,7 @@ class DescriptorImplicits private[compiler] ( (fd.getFile.scalaOptions.getAuxFieldOptionsList.asScala .collect { - case opt if opt.getTarget == fd.getFullName() => opt.getOptions + case opt if Helper.targetMatches(opt.getTarget(), fd.getFullName()) => opt.getOptions } :+ localOptions).reduce[FieldOptions]((left, right) => left.toBuilder.mergeFrom(right).build() ) @@ -532,9 +532,9 @@ class DescriptorImplicits private[compiler] ( val localOptions = message.getOptions.getExtension[MessageOptions](Scalapb.message) message.getFile.scalaOptions.getAuxMessageOptionsList.asScala - .find(_.getTarget == message.getFullName()) - .fold(localOptions)(aux => - MessageOptions.newBuilder(aux.getOptions).mergeFrom(localOptions).build + .filter(o => Helper.targetMatches(o.getTarget, message.getFullName())) + .foldLeft(localOptions)((local, aux) => + MessageOptions.newBuilder(aux.getOptions).mergeFrom(local).build ) } @@ -772,9 +772,9 @@ class DescriptorImplicits private[compiler] ( val localOptions = enumDescriptor.getOptions.getExtension[EnumOptions](Scalapb.enumOptions) enumDescriptor.getFile.scalaOptions.getAuxEnumOptionsList.asScala - .find(_.getTarget == enumDescriptor.getFullName()) - .fold(localOptions)(aux => - EnumOptions.newBuilder(aux.getOptions).mergeFrom(localOptions).build + .filter(o => Helper.targetMatches(o.getTarget, enumDescriptor.getFullName())) + .foldLeft(localOptions)((local, aux) => + EnumOptions.newBuilder(aux.getOptions).mergeFrom(local).build ) } @@ -862,9 +862,9 @@ class DescriptorImplicits private[compiler] ( val localOptions = enumValue.getOptions.getExtension[EnumValueOptions](Scalapb.enumValue) enumValue.getFile.scalaOptions.getAuxEnumValueOptionsList.asScala - .find(_.getTarget == enumValue.getFullName()) - .fold(localOptions)(aux => - EnumValueOptions.newBuilder(aux.getOptions).mergeFrom(localOptions).build + .filter(o => Helper.targetMatches(o.getTarget, enumValue.getFullName())) + .foldLeft(localOptions)((local, aux) => + EnumValueOptions.newBuilder(aux.getOptions).mergeFrom(local).build ) } @@ -1239,4 +1239,11 @@ object Helper { .replace(">", ">") .replace("\\", "&92;") } + + // Does the pattern matches the name. If the pattern is "*" the name always matches, otherwise + // must be an exact match. This may evolve in the future. + def targetMatches(pattern: String, name: String): Boolean = pattern match { + case "*" => true + case o => name == o + } } diff --git a/compiler-plugin/src/test/scala/scalapb/compiler/DescriptorImplicitsSpec.scala b/compiler-plugin/src/test/scala/scalapb/compiler/DescriptorImplicitsSpec.scala index 075e5b193..119e2a72e 100644 --- a/compiler-plugin/src/test/scala/scalapb/compiler/DescriptorImplicitsSpec.scala +++ b/compiler-plugin/src/test/scala/scalapb/compiler/DescriptorImplicitsSpec.scala @@ -122,6 +122,25 @@ class DescriptorImplicitsSpec extends AnyFlatSpec with Matchers with ProtocInvoc .find(_.getFullName() == "inside_disable_flat.proto") .get .disableOutput must be(false) + } + + "Helpers.targetMatches" should "do exact match when not *" in { + Helper.targetMatches("foo", "foo") must be(true) + Helper.targetMatches("foo", "") must be(false) + Helper.targetMatches("foo", "bar") must be(false) + Helper.targetMatches("", "") must be(true) + Helper.targetMatches("", "foo") must be(false) + } + + "Helpers.targetMatches" should "return true when *" in { + Helper.targetMatches("*", "foo") must be(true) + Helper.targetMatches("*", "bar") must be(true) + Helper.targetMatches("*", "") must be(true) + Helper.targetMatches("*", "*") must be(true) + } + "Helpers.targetMatches" should "not support * as a generic wildcard" in { + Helper.targetMatches("foo.*", "foo.bar") must be(false) + Helper.targetMatches("foo.*.bar", "bar.giz.bar") must be(false) } } diff --git a/docs/src/main/markdown/customizations.md b/docs/src/main/markdown/customizations.md index 0855ce7cb..6f5977a5c 100644 --- a/docs/src/main/markdown/customizations.md +++ b/docs/src/main/markdown/customizations.md @@ -281,7 +281,8 @@ option (scalapb.options) = { }; ``` -The list `aux_message_options` contains options targeted at different messages define under the same proto package of the package-scoped options. The `target` name needs to be fully-qualified message name in the protobuf namespace. Similar to `aux_message_options`, we also have `aux_enum_options`, `aux_enum_value_options` and `aux_field_options`. See [example usage here](https://github.com/scalapb/ScalaPB/tree/master/e2e/src/main/protobuf/scoped). +The list `aux_message_options` contains options targeted at different messages define under the same proto package of the package-scoped options. The `target` name needs to be fully-qualified message name in the protobuf namespace. Similar to `aux_message_options`, we also have `aux_enum_options`, `aux_enum_value_options` and `aux_field_options`. See [example usage here](https://github.com/scalapb/ScalaPB/tree/master/e2e/src/main/protobuf/scoped). If the target is set `*` then the options will be +applied to all the entities in the file or package (depending on the `scope` option). ## Primitive wrappers diff --git a/e2e/src/main/protobuf/scoped/wildcard.proto b/e2e/src/main/protobuf/scoped/wildcard.proto new file mode 100644 index 000000000..054032e03 --- /dev/null +++ b/e2e/src/main/protobuf/scoped/wildcard.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package scalapb.e2e.scoped; + +import "scalapb/scalapb.proto"; + +option (scalapb.options) = { + aux_message_options: [ + { + target: "scalapb.e2e.scoped.Wild2", + options: { + extends: "scalapb.e2e.scoped.SomeTrait" + } + }, + { + target: "*" + options: { + extends: "scalapb.e2e.scoped.WildcardTrait" + } + } + ] +}; + +message Wild1 {} + +message Wild2 {} \ No newline at end of file diff --git a/e2e/src/main/scala/scalapb/e2e/scoped/WildcardTrait.scala b/e2e/src/main/scala/scalapb/e2e/scoped/WildcardTrait.scala new file mode 100644 index 000000000..88643b3a9 --- /dev/null +++ b/e2e/src/main/scala/scalapb/e2e/scoped/WildcardTrait.scala @@ -0,0 +1,3 @@ +package scalapb.e2e.scoped + +trait WildcardTrait diff --git a/e2e/src/test/scala/scoped/WildcardSpec.scala b/e2e/src/test/scala/scoped/WildcardSpec.scala new file mode 100644 index 000000000..5ae150bd3 --- /dev/null +++ b/e2e/src/test/scala/scoped/WildcardSpec.scala @@ -0,0 +1,11 @@ +package scalapb.e2e.scoped + +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.must.Matchers +import scalapb.changed.scoped._ + +class WildcardSpec extends AnyFlatSpec with Matchers { + assert(Wild1().isInstanceOf[WildcardTrait]) + assert(Wild2().isInstanceOf[WildcardTrait]) + assert(Wild2().isInstanceOf[SomeTrait]) +} diff --git a/protobuf/scalapb/scalapb.proto b/protobuf/scalapb/scalapb.proto index ef5f03ca7..0680c6ff0 100644 --- a/protobuf/scalapb/scalapb.proto +++ b/protobuf/scalapb/scalapb.proto @@ -109,7 +109,8 @@ message ScalaPbOptions { // This is useful when you can't add a dependency on scalapb.proto from the proto file that // defines the message. message AuxMessageOptions { - // The fully-qualified name of the message in the proto name space. + // The fully-qualified name of the message in the proto name space. Set to `*` to apply to all + // messages in scope. optional string target = 1; // Options to apply to the message. If there are any options defined on the target message @@ -121,7 +122,8 @@ message ScalaPbOptions { // This is useful when you can't add a dependency on scalapb.proto from the proto file that // defines the field. message AuxFieldOptions { - // The fully-qualified name of the field in the proto name space. + // The fully-qualified name of the field in the proto name space. Set to `*` to apply to all + // fields in scope. optional string target = 1; // Options to apply to the field. If there are any options defined on the target message @@ -133,7 +135,8 @@ message ScalaPbOptions { // This is useful when you can't add a dependency on scalapb.proto from the proto file that // defines the enum. message AuxEnumOptions { - // The fully-qualified name of the enum in the proto name space. + // The fully-qualified name of the enum in the proto name space. Set to `*` to apply to + // all enums in scope. optional string target = 1; // Options to apply to the enum. If there are any options defined on the target enum @@ -145,7 +148,8 @@ message ScalaPbOptions { // options. This is useful when you can't add a dependency on scalapb.proto from the proto // file that defines the enum. message AuxEnumValueOptions { - // The fully-qualified name of the enum value in the proto name space. + // The fully-qualified name of the enum value in the proto name space. Set to `*` to apply + // to all enum values in scope. optional string target = 1; // Options to apply to the enum value. If there are any options defined on From 1d78ac52dada2b287c5e2109eff76b84c410bfce Mon Sep 17 00:00:00 2001 From: Nadav Samet Date: Wed, 11 Oct 2023 15:53:59 -0700 Subject: [PATCH 02/20] Update generated code. --- .../main/scala/scalapb/options/ScalaPbOptions.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scalapb-runtime/src/main/scala/scalapb/options/ScalaPbOptions.scala b/scalapb-runtime/src/main/scala/scalapb/options/ScalaPbOptions.scala index e19d0117f..9c357d5ab 100644 --- a/scalapb-runtime/src/main/scala/scalapb/options/ScalaPbOptions.scala +++ b/scalapb-runtime/src/main/scala/scalapb/options/ScalaPbOptions.scala @@ -870,7 +870,8 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options. * defines the message. * * @param target - * The fully-qualified name of the message in the proto name space. + * The fully-qualified name of the message in the proto name space. Set to `*` to apply to all + * messages in scope. * @param options * Options to apply to the message. If there are any options defined on the target message * they take precedence over the options. @@ -1019,7 +1020,8 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options. * defines the field. * * @param target - * The fully-qualified name of the field in the proto name space. + * The fully-qualified name of the field in the proto name space. Set to `*` to apply to all + * fields in scope. * @param options * Options to apply to the field. If there are any options defined on the target message * they take precedence over the options. @@ -1168,7 +1170,8 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options. * defines the enum. * * @param target - * The fully-qualified name of the enum in the proto name space. + * The fully-qualified name of the enum in the proto name space. Set to `*` to apply to + * all enums in scope. * @param options * Options to apply to the enum. If there are any options defined on the target enum * they take precedence over the options. @@ -1317,7 +1320,8 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options. * file that defines the enum. * * @param target - * The fully-qualified name of the enum value in the proto name space. + * The fully-qualified name of the enum value in the proto name space. Set to `*` to apply + * to all enum values in scope. * @param options * Options to apply to the enum value. If there are any options defined on * the target enum value they take precedence over the options. From 713416dd5c1e78fd3d8b4ffedd3c35aa2096a9cb Mon Sep 17 00:00:00 2001 From: Nadav Samet Date: Wed, 11 Oct 2023 16:35:28 -0700 Subject: [PATCH 03/20] Update CHANGELOG.md --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0206cf2f9..74b7d2a31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,10 @@ CollectionAdapter for (#1509) - Introduced new generator parameter `scala3_sources` (also available via scalapb.proto) to generate sources that are compatible with Scala 3 (#1576) -- aux_*_options now accept "*" in the target field to match all entities in +- `aux_*_options` now accept `*` in the target field to match all entities in scope. +- Add `derives` and `sealed_oneof_derives` to the message options that adds a + derived clause to generated messages and sealed oneofs. ## [0.11.13] - Added input and output message type for method descriptor (#1503) From 3eb3bf7ef34c6c7b9236746dea6fdd9abfa403ce Mon Sep 17 00:00:00 2001 From: Nadav Samet Date: Thu, 12 Oct 2023 15:10:27 -0700 Subject: [PATCH 04/20] Fixed derives for sealed oneofs For #1584 --- .../src/main/scala/scalapb/compiler/SealedOneofsGenerator.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-plugin/src/main/scala/scalapb/compiler/SealedOneofsGenerator.scala b/compiler-plugin/src/main/scala/scalapb/compiler/SealedOneofsGenerator.scala index cbfce320c..9865452f8 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 derives if (message.sealedOneofStyle != SealedOneofStyle.Optional) { val sealedOneofNonEmptyName = message.sealedOneofNonEmptyScalaType.nameSymbol From fa0c74dd94f4d13c221718cb1d5591de0982238c Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 17 Oct 2023 04:48:01 +0200 Subject: [PATCH 05/20] Update sbt-mdoc to 2.3.8 (#1592) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 0978da629..4e136f68a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -24,6 +24,6 @@ addSbtPlugin("com.thesamet" % "sbt-protoc-gen-project" % "0.1.8") addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.1") -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.7") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.8") addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.4") From c2058225c840fca9863b5c1f145fa8b4f490048c Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 17 Oct 2023 05:11:22 +0200 Subject: [PATCH 06/20] Update nscplugin, sbt-scala-native, ... to 0.4.16 (#1591) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 4e136f68a..2490ec2a6 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -8,7 +8,7 @@ addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.15") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3") From 1e6550d9ce5ef6e62fcf20a774654f5c72c3b932 Mon Sep 17 00:00:00 2001 From: Nadav Samet Date: Tue, 17 Oct 2023 09:47:34 -0700 Subject: [PATCH 07/20] scalafmt update --- .scalafmt.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 0e057824c..509943959 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.7.3 +version = 3.7.14 style = defaultWithAlign maxColumn = 100 assumeStandardLibraryStripMargin = true @@ -14,4 +14,4 @@ fileOverride { "glob:**/src/main/scala-3/**" { runner.dialect = scala3 } -} \ No newline at end of file +} From 2ccf02d17ad1c72a141b1c70f18b9eb8c9d2ece5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 10:24:20 -0700 Subject: [PATCH 08/20] Bump semver from 5.7.1 to 5.7.2 in /website (#1545) Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2. - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md) - [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2) --- updated-dependencies: - dependency-name: semver dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- website/yarn.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/website/yarn.lock b/website/yarn.lock index a919d1152..297fc4dad 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -9022,19 +9022,19 @@ semver@7.0.0: integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + version "5.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== semver@^7.3.5: - version "7.3.5" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" - integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0" From ba25726f10c256fdfed9b87501a83adfa9cef512 Mon Sep 17 00:00:00 2001 From: Nadav Samet Date: Tue, 17 Oct 2023 10:14:29 -0700 Subject: [PATCH 09/20] Bump Scala.js to 1.14.0 --- CHANGELOG.md | 1 + e2e/src/test/scala/NoBoxSpec.scala | 5 ----- e2e/src/test/scalajvm/NoBoxWithJavaSpec.scala | 6 ++++++ project/plugins.sbt | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74b7d2a31..a8227db03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ scope. - Add `derives` and `sealed_oneof_derives` to the message options that adds a derived clause to generated messages and sealed oneofs. +- Bump Scala.js to 1.14.0 ## [0.11.13] - Added input and output message type for method descriptor (#1503) diff --git a/e2e/src/test/scala/NoBoxSpec.scala b/e2e/src/test/scala/NoBoxSpec.scala index 0405d6c49..5ae180fd0 100644 --- a/e2e/src/test/scala/NoBoxSpec.scala +++ b/e2e/src/test/scala/NoBoxSpec.scala @@ -21,11 +21,6 @@ class NoBoxSpec extends AnyFlatSpec with Matchers { scalaCar.tyre1 must be(Tyre.defaultInstance) } - "Scala message with a no_box field with null value" should "throw exception when being serialized" in { - val car = Car(tyre1 = null) - a[Exception] shouldBe thrownBy(car.toByteArray) - } - "Scala message with a no_box reference" should "generate correct types" in { val car = Car() car.dontBoxMeDef mustBe (DontBoxMe.defaultInstance) diff --git a/e2e/src/test/scalajvm/NoBoxWithJavaSpec.scala b/e2e/src/test/scalajvm/NoBoxWithJavaSpec.scala index 5110ff92d..43dc62520 100644 --- a/e2e/src/test/scalajvm/NoBoxWithJavaSpec.scala +++ b/e2e/src/test/scalajvm/NoBoxWithJavaSpec.scala @@ -21,4 +21,10 @@ class NoBoxWithJavaSpec extends AnyFlatSpec with Matchers { val p = Person("", Money(BigDecimal("123.123"))) Person.fromJavaProto(Person.toJavaProto(p)) must be(p) } + + "Scala message with a no_box field with null value" should "throw exception when being serialized" in { + val car = Car(tyre1 = null) + a[Exception] shouldBe thrownBy(car.toByteArray) + } + } diff --git a/project/plugins.sbt b/project/plugins.sbt index 2490ec2a6..60de3aa0f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.12.0") +val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.14.0") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10") From 34169436206f2520fc89cf047df7e996c95c2939 Mon Sep 17 00:00:00 2001 From: Nadav Samet Date: Tue, 17 Oct 2023 10:21:20 -0700 Subject: [PATCH 10/20] Add docs for derives --- docs/src/main/markdown/customizations.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/src/main/markdown/customizations.md b/docs/src/main/markdown/customizations.md index 6f5977a5c..fa816f278 100644 --- a/docs/src/main/markdown/customizations.md +++ b/docs/src/main/markdown/customizations.md @@ -807,3 +807,22 @@ enum BarEnum { BarValue = 1 [(scalapb.enum_value).annotations = "@annotation4"]; } ``` + +## Adding derives clause + +In ScalaPB 0.11.14, it is possible to add a `derives` clause to generated messages and +sealed oneofs: + +```protobuf +message Foo { + option (scalapb.message).derives = "yourpkg.Show"; + ... +}}} + +message Expr { + option (scalapb.message).sealed_oneof_derives = "yourpkg.Show"; + oneof sealed_value { + ... + } +} +``` From de5e75decea2888b49c275860f5cfcb28ad05f94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 10:41:34 -0700 Subject: [PATCH 11/20] Bump @babel/traverse from 7.12.12 to 7.23.2 in /website (#1593) Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.12.12 to 7.23.2. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- website/yarn.lock | 178 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 141 insertions(+), 37 deletions(-) diff --git a/website/yarn.lock b/website/yarn.lock index 297fc4dad..5bd7f463c 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -132,13 +132,21 @@ dependencies: "@babel/highlight" "^7.8.3" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.11", "@babel/code-frame@^7.16.7": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== dependencies: "@babel/highlight" "^7.16.7" +"@babel/code-frame@^7.22.13": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" + integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== + dependencies: + "@babel/highlight" "^7.22.13" + chalk "^2.4.2" + "@babel/compat-data@^7.13.11", "@babel/compat-data@^7.16.4", "@babel/compat-data@^7.16.8": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.16.8.tgz#31560f9f29fdf1868de8cb55049538a1b9732a60" @@ -187,7 +195,7 @@ semver "^6.3.0" source-map "^0.5.0" -"@babel/generator@^7.12.11", "@babel/generator@^7.12.5", "@babel/generator@^7.16.8": +"@babel/generator@^7.12.5", "@babel/generator@^7.16.8": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.16.8.tgz#359d44d966b8cd059d543250ce79596f792f2ebe" integrity sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw== @@ -196,6 +204,16 @@ jsesc "^2.5.1" source-map "^0.5.0" +"@babel/generator@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420" + integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g== + dependencies: + "@babel/types" "^7.23.0" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + "@babel/helper-annotate-as-pure@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz#bb2339a7534a9c128e3102024c60760a3a7f3862" @@ -263,6 +281,11 @@ dependencies: "@babel/types" "^7.16.7" +"@babel/helper-environment-visitor@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" + integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== + "@babel/helper-explode-assignable-expression@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.7.tgz#12a6d8522fdd834f194e868af6354e8650242b7a" @@ -270,7 +293,7 @@ dependencies: "@babel/types" "^7.16.7" -"@babel/helper-function-name@^7.12.11", "@babel/helper-function-name@^7.16.7": +"@babel/helper-function-name@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz#f1ec51551fb1c8956bc8dd95f38523b6cf375f8f" integrity sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA== @@ -279,6 +302,14 @@ "@babel/template" "^7.16.7" "@babel/types" "^7.16.7" +"@babel/helper-function-name@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== + dependencies: + "@babel/template" "^7.22.15" + "@babel/types" "^7.23.0" + "@babel/helper-get-function-arity@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz#ea08ac753117a669f1508ba06ebcc49156387419" @@ -293,6 +324,13 @@ dependencies: "@babel/types" "^7.16.7" +"@babel/helper-hoist-variables@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" + integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-member-expression-to-functions@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.7.tgz#42b9ca4b2b200123c3b7e726b0ae5153924905b0" @@ -372,18 +410,35 @@ dependencies: "@babel/types" "^7.16.0" -"@babel/helper-split-export-declaration@^7.12.11", "@babel/helper-split-export-declaration@^7.16.7": +"@babel/helper-split-export-declaration@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz#0b648c0c42da9d3920d85ad585f2778620b8726b" integrity sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw== dependencies: "@babel/types" "^7.16.7" +"@babel/helper-split-export-declaration@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" + integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== + dependencies: + "@babel/types" "^7.22.5" + +"@babel/helper-string-parser@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" + integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== + "@babel/helper-validator-identifier@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== +"@babel/helper-validator-identifier@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== + "@babel/helper-validator-option@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23" @@ -417,16 +472,30 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.12.11", "@babel/parser@^7.12.7", "@babel/parser@^7.16.10", "@babel/parser@^7.16.12", "@babel/parser@^7.16.7": - version "7.16.12" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.12.tgz#9474794f9a650cf5e2f892444227f98e28cdf8b6" - integrity sha512-VfaV15po8RiZssrkPweyvbGVSe4x2y+aciFCgn0n0/SJMR22cwofRV1mtnJQYcSB1wUTaA/X1LnA3es66MCO5A== +"@babel/highlight@^7.22.13": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54" + integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg== + dependencies: + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" + js-tokens "^4.0.0" "@babel/parser@^7.12.5": version "7.12.11" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.11.tgz#9ce3595bcd74bc5c466905e86c535b8b25011e79" integrity sha512-N3UxG+uuF4CMYoNj8AhnbAcJF0PiuJ9KHuy1lQmkYsxTer/MAH9UBNHsBoAX/4s6NvlDD047No8mYVGGzLL4hg== +"@babel/parser@^7.12.7", "@babel/parser@^7.16.12", "@babel/parser@^7.16.7": + version "7.16.12" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.12.tgz#9474794f9a650cf5e2f892444227f98e28cdf8b6" + integrity sha512-VfaV15po8RiZssrkPweyvbGVSe4x2y+aciFCgn0n0/SJMR22cwofRV1mtnJQYcSB1wUTaA/X1LnA3es66MCO5A== + +"@babel/parser@^7.22.15", "@babel/parser@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" + integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.7.tgz#4eda6d6c2a0aa79c70fa7b6da67763dfe2141050" @@ -1146,38 +1215,32 @@ "@babel/parser" "^7.16.7" "@babel/types" "^7.16.7" -"@babel/traverse@^7.12.5", "@babel/traverse@^7.13.0", "@babel/traverse@^7.16.10", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8": - version "7.16.10" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.16.10.tgz#448f940defbe95b5a8029975b051f75993e8239f" - integrity sha512-yzuaYXoRJBGMlBhsMJoUW7G1UmSb/eXr/JHYM/MsOJgavJibLwASijW7oXBdw3NQ6T0bW7Ty5P/VarOs9cHmqw== - dependencies: - "@babel/code-frame" "^7.16.7" - "@babel/generator" "^7.16.8" - "@babel/helper-environment-visitor" "^7.16.7" - "@babel/helper-function-name" "^7.16.7" - "@babel/helper-hoist-variables" "^7.16.7" - "@babel/helper-split-export-declaration" "^7.16.7" - "@babel/parser" "^7.16.10" - "@babel/types" "^7.16.8" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/traverse@^7.12.9": - version "7.12.12" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.12.tgz#d0cd87892704edd8da002d674bc811ce64743376" - integrity sha512-s88i0X0lPy45RrLM8b9mz8RPH5FqO9G9p7ti59cToE44xFm1Q+Pjh5Gq4SXBbtb88X7Uy7pexeqRIQDDMNkL0w== - dependencies: - "@babel/code-frame" "^7.12.11" - "@babel/generator" "^7.12.11" - "@babel/helper-function-name" "^7.12.11" - "@babel/helper-split-export-declaration" "^7.12.11" - "@babel/parser" "^7.12.11" - "@babel/types" "^7.12.12" +"@babel/template@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" + integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/parser" "^7.22.15" + "@babel/types" "^7.22.15" + +"@babel/traverse@^7.12.5", "@babel/traverse@^7.12.9", "@babel/traverse@^7.13.0", "@babel/traverse@^7.16.10", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8": + version "7.23.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" + integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.23.0" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.23.0" + "@babel/types" "^7.23.0" debug "^4.1.0" globals "^11.1.0" - lodash "^4.17.19" -"@babel/types@^7.12.12", "@babel/types@^7.12.6", "@babel/types@^7.12.7", "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.4.4": +"@babel/types@^7.12.6", "@babel/types@^7.12.7", "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.4.4": version "7.16.8" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.16.8.tgz#0ba5da91dd71e0a4e7781a30f22770831062e3c1" integrity sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg== @@ -1185,6 +1248,15 @@ "@babel/helper-validator-identifier" "^7.16.7" to-fast-properties "^2.0.0" +"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.0.tgz#8c1f020c9df0e737e4e247c0619f58c68458aaeb" + integrity sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg== + dependencies: + "@babel/helper-string-parser" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@csstools/convert-colors@^1.4.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7" @@ -1558,6 +1630,38 @@ dependencies: "@hapi/hoek" "^9.0.0" +"@jridgewell/gen-mapping@^0.3.2": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" + integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== + dependencies: + "@jridgewell/set-array" "^1.0.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" + integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== + +"@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== + +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": + version "0.3.19" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz#f8a3249862f91be48d3127c3cfe992f79b4b8811" + integrity sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + "@mdx-js/mdx@^1.6.21": version "1.6.22" resolved "https://registry.yarnpkg.com/@mdx-js/mdx/-/mdx-1.6.22.tgz#8a723157bf90e78f17dc0f27995398e6c731f1ba" From fc025807a1896d63b07d5b31e768e5f7bd83e77e Mon Sep 17 00:00:00 2001 From: Nadav Samet Date: Tue, 17 Oct 2023 16:35:04 -0700 Subject: [PATCH 12/20] Workflows: switch from hub to gh --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 430700784..cf525089c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -131,4 +131,4 @@ jobs: set -x assets=$(find ./artifacts -name "*.zip" -printf "-a %p ") RELEASE_NAME=${GITHUB_REF#refs/tags/} - hub release create ${assets} -m "$RELEASE_NAME" "$RELEASE_NAME" + gh release create "$RELEASE_NAME" --generate-notes ${assets} From 38e81654b4463f8013e96141a4c786a0141451f9 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 19 Oct 2023 02:47:52 +0200 Subject: [PATCH 13/20] Update sbt-mdoc to 2.4.0 (#1594) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 60de3aa0f..74c331ccb 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -24,6 +24,6 @@ addSbtPlugin("com.thesamet" % "sbt-protoc-gen-project" % "0.1.8") addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.1") -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.8") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.4.0") addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.4") From 57e8641864232d37df482f0edbc4754ac0b01c52 Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Fri, 20 Oct 2023 13:02:43 +0900 Subject: [PATCH 14/20] add dependabot.yml (#1595) --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..5ace4600a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From 717af8229648164d16f95d1860b74d09c50c9da2 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Sat, 21 Oct 2023 00:38:12 +0200 Subject: [PATCH 15/20] Update grpc-netty, grpc-protobuf, grpc-stub to 1.59.0 (#1598) --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 280c141c9..ac13cf91e 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -4,7 +4,7 @@ import Keys._ object Dependencies { object versions { - val grpc = "1.58.0" + val grpc = "1.59.0" val protobuf = "3.19.6" val silencer = "1.7.14" val collectionCompat = "2.11.0" From f20940a2fc70c5f7d457000612b5173de0ed1f40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Oct 2023 16:44:35 -0700 Subject: [PATCH 16/20] Bump actions/checkout from 3 to 4 (#1597) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 8 ++++---- .github/workflows/test.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf525089c..b80879134 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: publish: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Scala caches @@ -56,7 +56,7 @@ jobs: scalapbc: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-java@v3 @@ -80,7 +80,7 @@ jobs: arch: osx-x86_64 runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: olafurpg/setup-scala@v13 @@ -114,7 +114,7 @@ jobs: runs-on: ubuntu-20.04 needs: [native, scalapbc] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Download artifacts diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 436287014..b0adbb482 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: script: scala3_compat_test steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-java@v3 with: @@ -46,7 +46,7 @@ jobs: conformance: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/cache@v3 id: conformance-cache with: From b8632f4a461ef8501d4a23d5101f79859b80c43a Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 25 Oct 2023 06:52:40 +0200 Subject: [PATCH 17/20] Update sbt to 1.9.7 (#1599) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 27430827b..e8a1e246e 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.6 +sbt.version=1.9.7 From deaa7c1eb1162ef800232aadfc970f614102b01e Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Fri, 27 Oct 2023 13:37:07 +0900 Subject: [PATCH 18/20] avoid deprecated old sbt syntax (#1601) --- CONTRIBUTING.md | 2 +- build.sbt | 2 +- examples_and_formatting.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c3495e86f..9d88d7d44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -71,7 +71,7 @@ Wrapping up your PR while working on this. Add the exclusions to `build.sbt`. Binary incompatibilities are expected when modifying `scalapb.proto` and in the meantime we have some tolerance for certain type of incompatabilities. -* In SBT, run `scalafmt` and `test:scalafmt` to ensure the code compiles +* In SBT, run `scalafmtAll` to ensure the code compiles cleanly. * Run `./make_plugin_proto.sh` to re-generate all the generated code that ships with ScalaPB. diff --git a/build.sbt b/build.sbt index 9deb82454..204f17aa1 100644 --- a/build.sbt +++ b/build.sbt @@ -17,7 +17,7 @@ inThisBuild( ) ) -addCommandAlias("fmt", "all scalafmtSbt scalafmt test:scalafmt") +addCommandAlias("fmt", "all scalafmtSbt scalafmtAll") lazy val sharedNativeSettings = List( nativeLinkStubs := true // for utest diff --git a/examples_and_formatting.sh b/examples_and_formatting.sh index cc99346f5..ecc2784ec 100755 --- a/examples_and_formatting.sh +++ b/examples_and_formatting.sh @@ -2,4 +2,4 @@ set -e ./test_generated_code_checked_in.sh for d in examples/*; do cd "$d" && sbt test && cd ../..; done -sbt -J-Xmx4500M scalafmtCheck test:scalafmtCheck scalafmtSbtCheck +sbt -J-Xmx4500M scalafmtCheckAll scalafmtSbtCheck From f288507eddd4084a24bde8089d5f914b0368c4a6 Mon Sep 17 00:00:00 2001 From: phkorn <1607865+phkorn@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:34:21 +0100 Subject: [PATCH 19/20] fix PhoneType generated example, add link to basic example (#1604) --- docs/src/main/markdown/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/main/markdown/getting-started.md b/docs/src/main/markdown/getting-started.md index ab808412b..fb1c65920 100644 --- a/docs/src/main/markdown/getting-started.md +++ b/docs/src/main/markdown/getting-started.md @@ -30,7 +30,7 @@ Protocol buffers are the flexible, efficient, automated solution to solve exactl ## Where to Find the Example Code The example code for this tutorial is under the `examples/basic` directory -in ScalaPB's repo. To get your copy: +in [ScalaPB's repo](https://github.com/scalapb/ScalaPB/tree/master/examples/basic). To get your copy: ```bash git clone https://github.com/scalapb/ScalaPB.git @@ -135,7 +135,7 @@ object PhoneType { case object HOME extends PhoneType(1) { val index = 1 val name = "HOME" - override def isMobile: Boolean = true + override def isHome: Boolean = true } // ... From f2f7472c4eb38f124c0a34b579f6be9090df98ca Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Mon, 6 Nov 2023 21:36:32 +0100 Subject: [PATCH 20/20] Update mockito-core to 5.7.0 (#1605) --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index ac13cf91e..954619d2f 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -16,7 +16,7 @@ object Dependencies { // For testing val annotationApi = "1.3.2" val cats = "2.6.1" - val mockito = "5.6.0" + val mockito = "5.7.0" val munit = "1.0.0-M8" val scalaTest = "3.2.17" val scalaTestPlusMockito = "3.1.0.0"