Skip to content

Commit 0ff5ede

Browse files
fix: prost compile faild.
merge from remote branch. ref: #173 Co-authored-by: Xuewei Niu <niuxuewei.nxw@antgroup.com> Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
1 parent 8e32522 commit 0ff5ede

31 files changed

+8640
-76
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 deps
@@ -27,6 +30,9 @@ jobs:
2730
steps:
2831
- name: Checkout
2932
uses: actions/checkout@v3
33+
- name: Install Protoc
34+
run: |
35+
./install_protoc.sh
3036
- name: Build
3137
run: |
3238
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"
@@ -38,10 +38,11 @@ protobuf-codegen = "3.1.0"
3838
prost-build = { version = "0.11", optional = true }
3939

4040
[features]
41-
default = ["sync"]
41+
default = ["sync","rustprotobuf"]
4242
async = ["dep:async-trait", "dep:tokio", "dep:futures", "dep:tokio-vsock"]
4343
sync = []
4444
prost = ["dep:prost", "dep:prost-build"]
45+
rustprotobuf = ["dep:protobuf"]
4546

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

Makefile

Lines changed: 11 additions & 5 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

@@ -23,14 +23,20 @@ build: debug
2323

2424
.PHONY: test
2525
test:
26-
cargo test --features sync,async --verbose
27-
cargo test --features sync,async,prost --verbose
28-
26+
ifeq ($OS,Windows_NT)
27+
# async isn't enabled for windows, don't test that feature
28+
cargo test --verbose
29+
else
30+
# cargo test --all-features --verbose
31+
cargo test --features sync,async,rustprotobuf
32+
cargo test --no-default-features --features sync,async,prost
33+
endif
34+
2935
.PHONY: check
3036
check:
3137
cargo fmt --all -- --check
3238
cargo clippy --all-targets --features sync,async -- -D warnings
33-
cargo clippy --all-targets --features sync,async,prost -- -D warnings
39+
cargo clippy --all-targets --no-default-features --features sync,async,prost -- -D warnings
3440

3541
.PHONY: deps
3642
deps:

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)