consistently include proto's in built artifacts - #746
Conversation
0378395 to
597d334
Compare
Code Reviewπ΄ Removing
|
Earlier it would depend on the task ordering between the download task and the resource discovery task, this should make it deterministic
597d334 to
5383e21
Compare
We have to add them to the
If that were true shouldn't the scripted tests have caught this?
That doesn't make any sense - the behavior of proto's not being included in the jar with
I doubt projects will have so many
On the other hand this makes it clearer this parameter is the string-typed representation of the target path. I'll change it when other changes are needed in that area. |
| //#languages-both | ||
|
|
||
| // Make sure proto's reliably make it into the artifact: | ||
| TaskKey[Unit]("checkJar") := { |
| val binary = (Compile / packageBin).value | ||
| IO.withTemporaryDirectory { dir => | ||
| val files = IO.unzip(binary, dir, "*.proto") | ||
| assert(files.contains(dir / "google/protobuf/duration.proto")) |
| IO.withTemporaryDirectory { dir => | ||
| val files = IO.unzip(binary, dir, "*.proto") |
There was a problem hiding this comment.
|
Thanks for the clarifications β you're right on the main points:
The approach of using One remaining minor note: the scripted test assertion using Overall the direction looks good. Looking forward to the final version once the |
| if (seen.contains(string)) { | ||
| withoutDuplicates(soFar, seen, toAdd.tail) | ||
| } else { | ||
| withoutDuplicates((file, string) :: soFar, seen + string, toAdd.tail) |
| @@ -1 +1,2 @@ | |||
| > checkJar | |||
He-Pin
left a comment
There was a problem hiding this comment.
Looks good to me. I reviewed the current head 5383e21 and found no must-fix issues.\n\nVerified locally:\n- git diff --check\n- sbt "sbt-plugin / scripted gen-scala-server/00-interop"\n- sbt "sbt-plugin / scripted gen-scala-server/03-test-config"
Fixes #345
I observed the directory with the proto's was part of the
unmanagedResourceDirectories. That might explain why they weren't included consistently: 'unmanaged' directories are for files that are expected to 'just exist' on disk, to there's no guard to make sure sbt reads that directory after it's been populated. This seemed to be caused by some code added in https://github.com/akka/akka-grpc/pull/149/changes which is intended to cover a fringe use case that probably doesn't really exist anymore, has this problem, and makes things complicated. This PRs simplifies things and makes sure the external proto directory is part of the managed classpath - but testing withgoogle-cloud-pub-sub-grpcit seems to actually consistently not include the resources in the jar π . More detective work needed.This perhaps begs the question: are we sure we want to include the proto's in the artifacts? The generated API's should be fully usable just by the generated code, right?