Repository navigation
Expand file tree
/
Copy pathbuild.rs
More file actions
39 lines (39 loc) · 1.77 KB
/
Copy pathbuild.rs
File metadata and controls
39 lines (39 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(feature = "vendored-protoc")]
if std::env::var_os("PROTOC").is_none() {
let protoc = protoc_bin_vendored::protoc_bin_path()?;
std::env::set_var("PROTOC", protoc);
}
let build_proto = std::env::var("BAZEL_DIFF_BUILD_PROTO")
.unwrap_or_else(|_| "rust/proto/build.proto".to_owned());
let analysis_proto = std::env::var("BAZEL_DIFF_ANALYSIS_PROTO")
.unwrap_or_else(|_| "rust/proto/analysis_v2.proto".to_owned());
let include = std::path::Path::new(&build_proto)
.parent()
.unwrap_or_else(|| std::path::Path::new("rust/proto"));
buffa_build::Config::new()
.files(&[&build_proto, &analysis_proto])
.includes(&[include])
.include_file("proto.rs")
// Box target payloads to shrink the targets kept for the whole run: inline, every target
// was as large as its biggest payload (a Rule), though most are files. Box the attribute
// fields that are rarely set too, so each decoded Attribute is smaller to move and grow.
.box_type_in(
buffa_build::PointerRepr::Box,
&[
".blaze_query.Target.rule",
".blaze_query.Target.source_file",
".blaze_query.Target.generated_file",
".blaze_query.Target.package_group",
".blaze_query.Target.environment_group",
".blaze_query.SourceFile.license",
".blaze_query.Attribute.license",
".blaze_query.Attribute.selector_list",
],
)
.generate_views(false)
.compile()?;
println!("cargo:rerun-if-changed=rust/proto/build.proto");
println!("cargo:rerun-if-changed=rust/proto/analysis_v2.proto");
Ok(())
}