如何为示例 gRPC Java TLS server/client 创建启动脚本?

How to create a start script for the example gRPC Java TLS server/client?

我正在尝试遵循 README.md 的 grpc-java 的 TLS 示例,https://github.com/grpc/grpc-java/tree/master/examples/example-tls。它指出 运行

../gradlew installDist

This creates the scripts hello-world-tls-server, hello-world-tls-client, in the build/install/example-tls/bin/ directory that run the example. The example requires the server to be running before starting the client.

但是,在 examples 目录和 运行 该命令中的所有地方将 gRPC 版本 1.36.0-SNAPSHOT 替换为 1.35.0 之后, build/install/examples/bin 目录不包含这样的脚本:

~/D/S/g/examples (master)> tree build/install/examples/bin
build/install/examples/bin
├── compressing-hello-world-client
├── compressing-hello-world-client.bat
├── hedging-hello-world-client
├── hedging-hello-world-client.bat
├── hedging-hello-world-server
├── hedging-hello-world-server.bat
├── hello-world-client
├── hello-world-client.bat
├── hello-world-server
├── hello-world-server.bat
├── retrying-hello-world-client
├── retrying-hello-world-client.bat
├── retrying-hello-world-server
├── retrying-hello-world-server.bat
├── route-guide-client
├── route-guide-client.bat
├── route-guide-server
└── route-guide-server.bat

0 directories, 18 files

在我的本地存储库中,我已将这一行 https://github.com/grpc/grpc-java/blob/1b23cf4f39ab26728336edbda8bb6af22dfe0a01/examples/example-tls/build.gradle#L58 更改为

startScripts.enabled = true

然而,再次运行 ./gradlew installDist之后,仍然找不到预期的启动脚本。我仔细阅读了 CreateStartScriptshttps://docs.gradle.org/current/dsl/org.gradle.jvm.application.tasks.CreateStartScripts.html 上的文档,但我没有立即看出哪里不对劲。知道为什么没有为 TLS 示例创建启动脚本吗?

用于检出 git 标签的文档 recommends

You are strongly encouraged to check out a git release tag, since there will already be a build of grpc available

❯ git checkout v1.35.0
❯ cd examples/example-tls
❯ ../gradlew installDist

然后您将能够在 build/install/example-tls/bin:

中找到二进制文件
❯ tree build/install/example-tls/bin
build/install/example-tls/bin
├── hello-world-tls-client
├── hello-world-tls-client.bat
├── hello-world-tls-server
└── hello-world-tls-server.bat