From 8529a5500c16672a593e9c4da6b1ecd14d15d806 Mon Sep 17 00:00:00 2001 From: Nadav Samet Date: Tue, 16 Feb 2021 08:22:39 -0800 Subject: [PATCH] Add validate-options.proto to ensure consistent package options See #70 --- build.sbt | 6 +++++- core/src/main/protobuf/scalapb/validate-options.proto | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 core/src/main/protobuf/scalapb/validate-options.proto diff --git a/build.sbt b/build.sbt index 67150e6..836761f 100644 --- a/build.sbt +++ b/build.sbt @@ -48,7 +48,11 @@ lazy val core = projectMatrix Compile / PB.targets := Seq( PB.gens.java -> (Compile / sourceManaged).value / "scalapb", scalapb.gen() -> (Compile / sourceManaged).value / "scalapb" - ) + ), + Compile / packageBin / packageOptions += { + Package.ManifestAttributes("ScalaPB-Options-Proto" -> + "scalapb/validate-options.proto") + } ) .jvmPlatform(scalaVersions = Seq(Scala212, Scala213)) diff --git a/core/src/main/protobuf/scalapb/validate-options.proto b/core/src/main/protobuf/scalapb/validate-options.proto new file mode 100644 index 0000000..392b8fa --- /dev/null +++ b/core/src/main/protobuf/scalapb/validate-options.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package scalapb.validate; + +import "scalapb/scalapb.proto"; +option (scalapb.options) = { + scope: PACKAGE + flat_package: false + lenses: true + java_conversions: true + preserve_unknown_fields: true +};