Skip to content

Commit

Permalink
Move protos to sdk-core-protos, add symlink in root
Browse files Browse the repository at this point in the history
Nix sandboxes builds such that they cannot escape their manifest
directory. By moving the `protos` into `sdk-core-protos` and adding a
symlink in the root to this new location, Nix will be able to build
crates that depend on `sdk-core-protos`.

Otherwise, the build script will fail:

    Error: Custom { kind: Other, error: "protoc failed: Could not make proto path relative: ../protos/local/temporal/sdk/core/core_interface.proto: No such file or directory\n" }
  • Loading branch information
cole-h committed Nov 20, 2023
1 parent 2da4d2f commit c873c3a
Show file tree
Hide file tree
Showing 71 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ equivalent.

## Proto files

This repo uses a subtree for upstream protobuf files. The path `protos/api_upstream` is a
This repo uses a subtree for upstream protobuf files. The path `sdk-core-protos/protos/api_upstream` is a
subtree. To update it, use:

`git pull --squash -s subtree ssh://[email protected]/temporalio/api.git master --allow-unrelated-histories`
Expand All @@ -100,9 +100,9 @@ subdirectory of that repo, we just copy the files with read-tree:
# add sdk-java as a remote if you have not already
git remote add -f -t master --no-tags testsrv-protos [email protected]:temporalio/sdk-java.git
# delete existing protos
git rm -rf protos/testsrv_upstream
git rm -rf sdk-core-protos/protos/testsrv_upstream
# pull from upstream & commit
git read-tree --prefix protos/testsrv_upstream -u testsrv-protos/master:temporal-test-server/src/main/proto
git read-tree --prefix sdk-core-protos/protos/testsrv_upstream -u testsrv-protos/master:temporal-test-server/src/main/proto
git commit
```

Expand Down
1 change: 1 addition & 0 deletions protos
20 changes: 10 additions & 10 deletions sdk-core-protos/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ static ALWAYS_SERDE: &str = "#[cfg_attr(not(feature = \"serde_serialize\"), \
derive(::serde::Serialize, ::serde::Deserialize))]";

fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("cargo:rerun-if-changed=../protos");
println!("cargo:rerun-if-changed=./protos");
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
let descriptor_file = out.join("descriptors.bin");
tonic_build::configure()
Expand Down Expand Up @@ -115,17 +115,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.file_descriptor_set_path(#[allow(clippy::needless_borrow)] &descriptor_file)
.compile(
&[
"../protos/local/temporal/sdk/core/core_interface.proto",
"../protos/api_upstream/temporal/api/workflowservice/v1/service.proto",
"../protos/api_upstream/temporal/api/operatorservice/v1/service.proto",
"../protos/testsrv_upstream/temporal/api/testservice/v1/service.proto",
"../protos/grpc/health/v1/health.proto",
"./protos/local/temporal/sdk/core/core_interface.proto",
"./protos/api_upstream/temporal/api/workflowservice/v1/service.proto",
"./protos/api_upstream/temporal/api/operatorservice/v1/service.proto",
"./protos/testsrv_upstream/temporal/api/testservice/v1/service.proto",
"./protos/grpc/health/v1/health.proto",
],
&[
"../protos/api_upstream",
"../protos/local",
"../protos/testsrv_upstream",
"../protos/grpc",
"./protos/api_upstream",
"./protos/local",
"./protos/testsrv_upstream",
"./protos/grpc",
],
)?;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c873c3a

Please sign in to comment.