jj/lib/build.rs
Martin von Zweigbergk ffc57310f6 cargo: upgrade protobuf crates to 3.0.1
The biggest difference in the API is that fields are now public. The
exception from that is `oneof` fields, which still require setters and
getters.

I couldn't measure any difference in performance. I didn't expect any
difference either, but it's good that it didn't seem to regress. I
timed `jj debug operation <some hash prefix>`, which will read the
whole operation log (to check that the prefix is unambiguous).
2022-05-04 17:02:11 -07:00

49 lines
1.5 KiB
Rust

// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
extern crate protobuf_codegen;
extern crate version_check;
use std::path::Path;
fn main() {
let out_dir = format!("{}/protos", std::env::var("OUT_DIR").unwrap());
if Path::new(&out_dir).exists() {
std::fs::remove_dir_all(&out_dir).unwrap();
}
std::fs::create_dir(&out_dir).unwrap();
let input = &[
"protos/op_store.proto",
"protos/store.proto",
"protos/working_copy.proto",
];
protobuf_codegen::Codegen::new()
.pure()
.out_dir(out_dir)
.inputs(input)
.include("protos")
.cargo_out_dir("protos")
.run()
.expect("protoc");
println!("cargo:rerun-if-changed=build.rs");
for file in input {
println!("cargo:rerun-if-changed={}", file);
}
if let Some(true) = version_check::supports_feature("map_first_last") {
println!("cargo:rustc-cfg=feature=\"map_first_last\"");
}
}