- Notifications
You must be signed in to change notification settings - Fork36
Proto types#81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Draft
flokli wants to merge2 commits intocel-rust:masterChoose a base branch fromflokli:proto-types
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Draft
Proto types#81
Changes from1 commit
Commits
Show all changes
2 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
PrevPrevious commit
add cel_interpreter::proto and proto feature flag
This adds the cel_interpreter::proto mod, exposing the cel.expr protobuftypes, as well as the necessary plumbing to generate the typedefinitions at compile time.The outcome can be best explored by invoking `cargo doc` with the`proto` feature enabled, and starting at the`cel_interpreter::proto::[Parsed]Expr` struct.
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit8419e0b8902dca69bec0249fc2986ffda1f9cc75
There are no files selected for viewing
9 changes: 9 additions & 0 deletionsinterpreter/Cargo.toml
This file contains hidden or 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
30 changes: 30 additions & 0 deletionsinterpreter/build.rs
This file contains hidden or 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,30 @@ | ||
use prost_wkt_build::*; | ||
use std::{env, path::PathBuf}; | ||
fn main() { | ||
let out = PathBuf::from(env::var("OUT_DIR").unwrap()); | ||
let descriptor_file = out.join("descriptors.bin"); | ||
let mut prost_build = prost_build::Config::new(); | ||
prost_build | ||
.type_attribute(".", "#[derive(serde::Serialize,serde::Deserialize)]") | ||
.extern_path(".google.protobuf.Any", "::prost_wkt_types::Any") | ||
.extern_path(".google.protobuf.Duration", "::prost_wkt_types::Duration") | ||
.extern_path(".google.protobuf.Timestamp", "::prost_wkt_types::Timestamp") | ||
.extern_path(".google.protobuf.Value", "::prost_wkt_types::Value") | ||
.file_descriptor_set_path(&descriptor_file) | ||
.compile_protos( | ||
&[ | ||
"../proto/cel/expr/syntax.proto", | ||
"../proto/cel/expr/checked.proto", | ||
"../proto/cel/expr/value.proto", | ||
], | ||
&["../proto/"], | ||
) | ||
.unwrap(); | ||
let descriptor_bytes = std::fs::read(descriptor_file).unwrap(); | ||
let descriptor = FileDescriptorSet::decode(&descriptor_bytes[..]).unwrap(); | ||
prost_wkt_build::add_serde(out, descriptor); | ||
} |
2 changes: 2 additions & 0 deletionsinterpreter/src/lib.rs
This file contains hidden or 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
1 change: 1 addition & 0 deletionsinterpreter/src/proto.rs
This file contains hidden or 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 @@ | ||
include!(concat!(env!("OUT_DIR"), "/cel.expr.rs")); |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.