From 08555623d4de2578a4f4dda7ade45baad4c1a137 Mon Sep 17 00:00:00 2001 From: Brice Jaglin Date: Mon, 15 Feb 2021 08:28:49 +0100 Subject: [PATCH] bump sbt-protoc for better integration with common-protos Fixes scripted 10-scalapb-validate, see * https://github.com/scalapb/ScalaPB/pull/873#issuecomment-769968656 * https://github.com/scalapb/scalapb-validate/issues/70 Other changes * cacheClassLoaders is now deprecated, see https://github.com/thesamet/sbt-protoc/commit/2a730a4 * Forcing recompilation is no longer necessary as the cache gets invalidated if a sandbox genererator classpath is updated, see https://github.com/thesamet/sbt-protoc/commit/80824b0 * The new classloader caching implementation resolves sandboxed generators artifacts earlier, even if they are no sources. That is the case for Test / protocGenerate, which was starting before codeGenProject / Compile / publishLocal, causing: > Error downloading com.lightbend.akka.grpc:akka-grpc-codegen_2.12: > 1.1.0-5-c5975cd5 --- benchmark-java/build.sbt | 2 +- project/ReflectiveCodeGen.scala | 3 --- project/plugins.sbt | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/benchmark-java/build.sbt b/benchmark-java/build.sbt index ec3d1f8fd..3613d71cc 100644 --- a/benchmark-java/build.sbt +++ b/benchmark-java/build.sbt @@ -29,7 +29,7 @@ val root = project.in(file(".")) "org.scalatest" %% "scalatest" % "3.1.2" % "test", "org.scalatestplus" %% "junit-4-12" % "3.1.2.0" % "test" ), - Compile / PB.generate := ((Compile / PB.generate) dependsOn ( + PB.artifactResolver := (PB.artifactResolver dependsOn ( codeGenProject / Compile / publishLocal)).value ) diff --git a/project/ReflectiveCodeGen.scala b/project/ReflectiveCodeGen.scala index 8ce40c1da..435634f45 100644 --- a/project/ReflectiveCodeGen.scala +++ b/project/ReflectiveCodeGen.scala @@ -64,8 +64,6 @@ object ReflectiveCodeGen extends AutoPlugin { } } }.value, - // Reload generators on each invocation - PB.cacheClassLoaders := false, setCodeGenerator := loadAndSetGenerator( // the magic sauce: use the output classpath from the the sbt-plugin project and instantiate generators from there (fullClasspath in Compile in ProjectRef(file("."), "sbt-akka-grpc")).value, @@ -76,7 +74,6 @@ object ReflectiveCodeGen extends AutoPlugin { codeGeneratorSettings.value, PB.targets.value.asInstanceOf[ListBuffer[Target]], scalaBinaryVersion.value), - PB.recompile ~= (_ => true), PB.protoSources in Compile := PB.protoSources.value ++ Seq( PB.externalIncludePath.value, sourceDirectory.value / "proto"))) ++ Seq( diff --git a/project/plugins.sbt b/project/plugins.sbt index ceef5c8e4..dea714677 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ enablePlugins(BuildInfoPlugin) -val sbtProtocV = "1.0.0" +val sbtProtocV = "1.0.1" buildInfoKeys := Seq[BuildInfoKey]("sbtProtocVersion" -> sbtProtocV)