From 4b57f6e357f2dc7f73a9940fa4f1d201baea1d4e Mon Sep 17 00:00:00 2001 From: plaflamme Date: Tue, 7 Jul 2020 22:57:04 -0400 Subject: [PATCH 1/2] Deprecate FlatPackage as a GeneratorOption. This will trigger on imported files as well, which will break if a related runtime was not compiled with this option enabled. Since this is now supported as a package-level option, users can simply move to use that instead for compatibility. --- build.sbt | 5 +++++ compiler-plugin/src/main/scala/scalapb/GeneratorOption.scala | 1 + 2 files changed, 6 insertions(+) diff --git a/build.sbt b/build.sbt index bb4d52c33..5fa4cdec7 100644 --- a/build.sbt +++ b/build.sbt @@ -124,6 +124,11 @@ lazy val grpcRuntimeJVM2_12 = grpcRuntime.jvm(Scala212) lazy val compilerPlugin = (projectMatrix in file("compiler-plugin")) .settings(commonSettings) .settings( + scalacOptions ++= (if (!isDotty.value) + Seq( + "-P:silencer:globalFilters=object FlatPackage in object GeneratorOption is deprecated" + ) + else Nil), libraryDependencies ++= Seq( protocGen.withDottyCompat(scalaVersion.value), "com.google.protobuf" % "protobuf-java" % protobufCompilerVersion % "protobuf", diff --git a/compiler-plugin/src/main/scala/scalapb/GeneratorOption.scala b/compiler-plugin/src/main/scala/scalapb/GeneratorOption.scala index 4343ea65c..a78d5f9c1 100644 --- a/compiler-plugin/src/main/scala/scalapb/GeneratorOption.scala +++ b/compiler-plugin/src/main/scala/scalapb/GeneratorOption.scala @@ -3,6 +3,7 @@ package scalapb sealed trait GeneratorOption extends Product with Serializable object GeneratorOption { + @deprecated("Use package-scoped option instead. See https://scalapb.github.io/customizations.html#package-scoped-options.", "0.11") case object FlatPackage extends GeneratorOption { override def toString = "flat_package" } From 755295b1c76dc640b345dea5fa7bef839a8cd275 Mon Sep 17 00:00:00 2001 From: plaflamme Date: Tue, 7 Jul 2020 23:03:27 -0400 Subject: [PATCH 2/2] Run scalafmt. --- compiler-plugin/src/main/scala/scalapb/GeneratorOption.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler-plugin/src/main/scala/scalapb/GeneratorOption.scala b/compiler-plugin/src/main/scala/scalapb/GeneratorOption.scala index a78d5f9c1..7abd64642 100644 --- a/compiler-plugin/src/main/scala/scalapb/GeneratorOption.scala +++ b/compiler-plugin/src/main/scala/scalapb/GeneratorOption.scala @@ -3,7 +3,10 @@ package scalapb sealed trait GeneratorOption extends Product with Serializable object GeneratorOption { - @deprecated("Use package-scoped option instead. See https://scalapb.github.io/customizations.html#package-scoped-options.", "0.11") + @deprecated( + "Use package-scoped option instead. See https://scalapb.github.io/customizations.html#package-scoped-options.", + "0.11" + ) case object FlatPackage extends GeneratorOption { override def toString = "flat_package" }