Skip to content

Commit dcf4304

Browse files
try prost
ref: #173 Co-authored-by: Xuewei Niu <niuxuewei.nxw@antgroup.com> Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
1 parent 6c23956 commit dcf4304

31 files changed

+8639
-67
lines changed

.github/workflows/bvt.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ jobs:
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@v3
13+
- name: Install Protoc
14+
run: |
15+
./install_protoc.sh
1316
- name: Check
1417
run: |
1518
make check-all
@@ -23,6 +26,9 @@ jobs:
2326
steps:
2427
- name: Checkout
2528
uses: actions/checkout@v3
29+
- name: Install Protoc
30+
run: |
31+
./install_protoc.sh
2632
- name: Build
2733
run: |
2834
make

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rust-version = "1.70"
1313

1414
[dependencies]
1515
prost = { version = "0.11", optional = true }
16-
protobuf = "3.1.0"
16+
protobuf = {version = "3.1.0", optional = true}
1717
libc = { version = "0.2.59", features = [ "extra_traits" ] }
1818
nix = "0.26.2"
1919
log = "0.4"
@@ -37,10 +37,11 @@ protobuf-codegen = "3.1.0"
3737
prost-build = { version = "0.11", optional = true }
3838

3939
[features]
40-
default = ["sync"]
40+
default = ["sync","rustprotobuf"]
4141
async = ["dep:async-trait", "dep:tokio", "dep:futures", "dep:tokio-vsock"]
4242
sync = []
4343
prost = ["dep:prost", "dep:prost-build"]
44+
rustprotobuf = ["dep:protobuf"]
4445

4546
[package.metadata.docs.rs]
4647
all-features = true

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export PROTOC=${HOME}/protoc/bin/protoc
1+
PROTOC ?= $(shell which protoc 2>/dev/null || echo $(HOME)/protoc/bin/protoc)
22

33
all: debug test
44

@@ -27,14 +27,16 @@ ifeq ($OS,Windows_NT)
2727
# async isn't enabled for windows, don't test that feature
2828
cargo test --verbose
2929
else
30-
cargo test --all-features --verbose
30+
# cargo test --all-features --verbose
31+
cargo test --features sync,async,rustprotobuf
32+
cargo test --no-default-features --features sync,async,prost
3133
endif
3234

3335
.PHONY: check
3436
check:
3537
cargo fmt --all -- --check
3638
cargo clippy --all-targets --features sync,async -- -D warnings
37-
cargo clippy --all-targets --features sync,async,prost -- -D warnings
39+
cargo clippy --all-targets --no-default-features --features sync,async,prost -- -D warnings
3840

3941
.PHONY: check-all
4042
check-all:

compiler/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
include ../Makefile
1+
.PHONY: check
2+
check:
3+
cargo fmt --all -- --check
4+
cargo clippy --all-targets -- -D warnings
5+
6+
.PHONY: test
7+
test:
8+
cargo test --verbose

example/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ byteorder = "1.3.2"
1818
log = "0.4.6"
1919
simple-logging = "2.0.2"
2020
nix = "0.23.0"
21-
ttrpc = { path = "../", features = ["async"] }
21+
ttrpc = { path = "../", features = ["async","rustprotobuf"] }
2222
ctrlc = { version = "3.0", features = ["termination"] }
2323
tokio = { version = "1.0.1", features = ["signal", "time"] }
2424
async-trait = "0.1.42"

example2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ byteorder = "1.3.2"
2121
log = "0.4.6"
2222
simple-logging = "2.0.2"
2323
nix = "0.23.0"
24-
ttrpc = { path = "../", features = ["sync", "async", "prost"] }
24+
ttrpc = { path = "../", features = ["sync", "async", "prost"], default-features = false }
2525
ctrlc = { version = "3.0", features = ["termination"] }
2626
tokio = { version = "1.0.1", features = ["signal", "time"] }
2727
async-trait = "0.1.42"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
pub mod agent {
2+
include!("agent.rs");
3+
}
4+
pub mod google {
5+
pub mod protobuf {
6+
include!("google.protobuf.rs");
7+
}
8+
}
9+
pub mod health {
10+
include!("health.rs");
11+
}
12+
pub mod oci {
13+
include!("oci.rs");
14+
}
15+
pub mod streaming {
16+
include!("streaming.rs");
17+
}
18+
pub mod types {
19+
include!("types.rs");
20+
}

0 commit comments

Comments
 (0)