Skip to content

Commit 4e36c3d

Browse files
authored
Merge pull request #203 from eliheuer/fontspector-issue-431
Remove `protoc` non-Rust system dependency from build script
2 parents 0adc239 + b0f7174 commit 4e36c3d

File tree

3 files changed

+168
-8
lines changed

3 files changed

+168
-8
lines changed

Cargo.lock

Lines changed: 159 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ prost-build = "0.13"
2525
protobuf-support = "3.7.1"
2626
protobuf = "3.7.1"
2727
protobuf-parse = "3.7.1"
28+
protox = "0.8"
2829
glob = "0"
2930
prettyplease = "0.2"
3031
quote = "1.0"

build.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ fn main() {
1818
let descriptor = protobuf::reflect::FileDescriptor::new_dynamic(protofile.clone(), &[])
1919
.expect("Could not create descriptor");
2020

21-
// Now we use the prost crate to compile them, so that we can
22-
// generate Rust structs.
21+
// Now we use protox + prost-build for pure Rust compilation (no protoc needed)
22+
let file_descriptors = protox::compile(
23+
["Lib/axisregistry/axes.proto"],
24+
["Lib/axisregistry"]
25+
).expect("Could not compile axes.proto with protox");
26+
2327
let mut config = prost_build::Config::new();
2428
// config.boxed(".google.axes.LanguageProto.sample_text");
2529
// config.boxed(".google.axes.LanguageProto.exemplar_chars");
@@ -34,8 +38,8 @@ fn main() {
3438
}
3539
// Let's make our structs; this produces google.axes.rs
3640
config
37-
.compile_protos(&["Lib/axisregistry/axes.proto"], &["Lib/axisregistry/"])
38-
.expect("Could not compile axes.proto");
41+
.compile_fds(file_descriptors)
42+
.expect("Could not compile proto file_descriptors");
3943

4044
let path = Path::new(&env::var("OUT_DIR").unwrap()).join("data.rs");
4145
let mut file = BufWriter::new(File::create(path).unwrap());

0 commit comments

Comments
 (0)