scalapb / scalapb-validate

ScalaPB generator for PGV
Apache License 2.0
14 stars 10 forks source link

Invalid reference in jar manifest of scalapb-validate-core_2.13-0.3.4 #301

Open reid-spencer opened 1 year ago

reid-spencer commented 1 year ago

It occurs to me that scalapb-validate-core_2.13-0.3.4 references something that it doesn't unpack: validate-options.proto

As you can see in the error message below, the manifest references: /Users/reid/Code/Ossum/amenities/property/target/protobuf_external_src/scalapb/validate-options.proto but this is actually unpacked to /Users/reid/Code/Ossum/amenities/property/target/protobuf_external/scalapb/validate-options.proto

The difference being the target/protobuf_external_src path in the manifest, and the actual file location is just target/protobuf_external

I've been scratching my head for a few days trying to figure out how to overcome this using sbt, but my sbt foo isn't quite that good. Help, please? And, if I'm doing something wrong, I'd appreciate being corrected. Thanks!

java.io.IOException: Dependency /Users/reid/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4.jar manifest references a non-existant proto /Users/reid/Code/Ossum/amenities/property/target/protobuf_external_src/scalapb/validate-options.proto
[error]     at sbtprotoc.ProtocPlugin$.$anonfun$getOptionProtos$6(ProtocPlugin.scala:524)
[error]     at sbtprotoc.ProtocPlugin$.$anonfun$getOptionProtos$6$adapted(ProtocPlugin.scala:521)
[error]     at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
[error]     at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
[error]     at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
[error]     at sbtprotoc.ProtocPlugin$.getOptionProtos(ProtocPlugin.scala:521)
[error]     at sbtprotoc.ProtocPlugin$.$anonfun$unpack$4(ProtocPlugin.scala:503)
[error]     at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:286)
[error]     at scala.collection.Iterator.foreach(Iterator.scala:943)
[error]     at scala.collection.Iterator.foreach$(Iterator.scala:943)
[error]     at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
[error]     at scala.collection.IterableLike.foreach(IterableLike.scala:74)
[error]     at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
[error]     at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
[error]     at scala.collection.TraversableLike.map(TraversableLike.scala:286)
[error]     at scala.collection.TraversableLike.map$(TraversableLike.scala:279)
[error]     at scala.collection.AbstractTraversable.map(Traversable.scala:108)
[error]     at sbtprotoc.ProtocPlugin$.unpack(ProtocPlugin.scala:500)
[error]     at sbtprotoc.ProtocPlugin$.$anonfun$unpackDependenciesTask$1(ProtocPlugin.scala:724)
[error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]     at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]     at sbt.Execute.work(Execute.scala:292)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]     at java.base/java.lang.Thread.run(Thread.java:829)
[error] (property / protocUnpackDependencies) java.io.IOException: Dependency /Users/reid/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4.jar manifest references a non-existant proto /Users/reid/Code/Ossum/amenities/property/target/protobuf_external_src/scalapb/validate-options.proto
reid-spencer commented 1 year ago

FYI, I'm running sbt 1.9.4

reid-spencer commented 1 year ago

After working on this more, I discovered that in build.sbt whenyou want to pull in proto files from another module, if you use, e.g.

dependsOn(common % "protobuf-src")  

instead of

.dependsOn(common % "protobuf")

Then you'll get the problem. without the "-src" suffix, the problem goes away (but other things come up!)

the correct way

thesamet commented 1 year ago

Hey @reid-spencer , sorry for getting so late to this. Can you put together the minimal steps necessary to reproduce this problem?