-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retrieve and build protobuf from remote URLs (#63)
Currently, this project is using cargo git dependencies to reference the proto packages from other ESDV projects such as Freyja. This has caused compatibility issues and needs to be updated. This PR makes a change to pull the content from a remote URL and build the proto files within the repo. Inspired by UProtocol: https://github.com/eclipse-uprotocol/up-rust/blob/main/build.rs Fixes #59
- Loading branch information
Showing
8 changed files
with
377 additions
and
92 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
# SPDX-License-Identifier: MIT | ||
|
||
[package] | ||
name = "cloud-connector-proto" | ||
version = "0.1.0" | ||
edition = "2021" | ||
license = "MIT" | ||
|
||
[dependencies] | ||
prost = { workspace = true } | ||
prost-types = { workspace = true } | ||
tonic = { workspace = true } | ||
|
||
[build-dependencies] | ||
freyja-build-common = { workspace = true } | ||
freyja-proto-common = { workspace = true } | ||
proto-common = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// SPDX-License-Identifier: MIT | ||
|
||
use freyja_build_common::compile_remote_proto; | ||
use freyja_proto_common::interface_url; | ||
|
||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
compile_remote_proto(interface_url!(freyja, CLOUD_CONNECTOR_INTERFACE), &[])?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// SPDX-License-Identifier: MIT | ||
|
||
// Re-export this library so consumers have access to the types used in generation | ||
pub use prost_types; | ||
|
||
pub mod v1 { | ||
tonic::include_proto!("cloud_connector"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
# SPDX-License-Identifier: MIT | ||
|
||
[package] | ||
name = "proto-common" | ||
version = "0.1.0" | ||
edition = "2021" | ||
license = "MIT" | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// SPDX-License-Identifier: MIT | ||
|
||
// This module contains constants related to remote protobuf files as well as helpers for referencing them. | ||
// This also helps manage interface versions from a central location, which is particularly helpful for Ibeji since | ||
// the interfaces are referenced in two different crates. | ||
|
||
pub const GITHUB_BASE_URL: &str = "https://raw.githubusercontent.com"; | ||
|
||
pub mod freyja { | ||
pub const REPO_NAME: &str = "eclipse-ibeji/freyja"; | ||
pub const VERSION: &str = "0.1.0"; | ||
|
||
pub mod interfaces { | ||
pub const CLOUD_CONNECTOR_INTERFACE: &str = | ||
"interfaces/cloud_connector/v1/cloud_connector.proto"; | ||
pub const MAPPING_SERVICE_INTERFACE: &str = | ||
"interfaces/mapping_service/v1/mapping_service.proto"; | ||
} | ||
} |