Skip to content

Commit 3deaa5c

Browse files
David Tolnayfacebook-github-bot
authored andcommitted
Update autocargo component on FBS:master
Reviewed By: zertosh Differential Revision: D56655848 fbshipit-source-id: 3ff1c47bd562e6fa88e17432f1535dd7002044f5
1 parent 645fb87 commit 3deaa5c

File tree

8 files changed

+96
-220
lines changed

8 files changed

+96
-220
lines changed
Lines changed: 23 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,35 @@
11
// @generated by autocargo
2+
23
use std::env;
34
use std::fs;
45
use std::path::Path;
5-
66
use thrift_compiler::Config;
77
use thrift_compiler::GenContext;
8-
8+
const CRATEMAP: &str = "\
9+
fb303_core crate //fb303/thrift:fb303_core-rust
10+
";
911
#[rustfmt::skip]
1012
fn main() {
11-
// Rerun if this gets rewritten.
1213
println!("cargo:rerun-if-changed=thrift_build.rs");
13-
1414
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
15-
let out_dir: &Path = out_dir.as_ref();
16-
fs::write(
17-
out_dir.join("cratemap"),
18-
"fb303_core crate //fb303/thrift:fb303_core-rust",
19-
).expect("Failed to write cratemap");
20-
21-
let conf = {
22-
let mut conf = Config::from_env(GenContext::Clients).expect("Failed to instantiate thrift_compiler::Config");
23-
24-
let path_from_manifest_to_base: &Path = "../../..".as_ref();
25-
let cargo_manifest_dir =
26-
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not provided");
27-
let cargo_manifest_dir: &Path = cargo_manifest_dir.as_ref();
28-
let base_path = cargo_manifest_dir
29-
.join(path_from_manifest_to_base)
30-
.canonicalize()
31-
.expect("Failed to canonicalize base_path");
32-
// TODO: replace canonicalize() with std::path::absolute() when
33-
// https://github.com/rust-lang/rust/pull/91673 is available (~Rust 1.60)
34-
// and remove this block.
35-
#[cfg(windows)]
36-
let base_path = Path::new(
37-
base_path
38-
.as_path()
39-
.to_string_lossy()
40-
.trim_start_matches(r"\\?\"),
41-
)
42-
.to_path_buf();
43-
44-
conf.base_path(base_path);
45-
46-
conf.types_crate("fb303_core__types");
47-
conf.clients_crate("fb303_core__clients");
48-
conf.services_crate("fb303_core__services");
49-
50-
let options = "deprecated_default_enum_min_i32,serde";
51-
if !options.is_empty() {
52-
conf.options(options);
53-
}
54-
55-
let types_include_srcs = vec![
56-
57-
];
58-
conf.types_include_srcs(types_include_srcs);
59-
60-
conf
61-
};
62-
63-
let srcs: &[&str] = &[
64-
"../fb303_core.thrift"
65-
];
15+
let cratemap_path = Path::new(&out_dir).join("cratemap");
16+
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
17+
let mut conf = Config::from_env(GenContext::Clients)
18+
.expect("Failed to instantiate thrift_compiler::Config");
19+
let cargo_manifest_dir = env::var_os("CARGO_MANIFEST_DIR")
20+
.expect("CARGO_MANIFEST_DIR not provided");
21+
let mut base_path = Path::new(&cargo_manifest_dir)
22+
.join("../../..")
23+
.canonicalize()
24+
.expect("Failed to canonicalize base_path");
25+
if cfg!(windows) {
26+
base_path = base_path.to_string_lossy().trim_start_matches(r"\\?\").into();
27+
}
28+
conf.base_path(base_path);
29+
conf.types_crate("fb303_core__types");
30+
conf.clients_crate("fb303_core__clients");
31+
conf.services_crate("fb303_core__services");
32+
conf.options("deprecated_default_enum_min_i32,serde");
33+
let srcs = &["../fb303_core.thrift"];
6634
conf.run(srcs).expect("Failed while running thrift compilation");
6735
}

fb303/thrift/clients/thrift_lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// @generated by autocargo
2+
23
::codegen_includer_proc_macro::include!();

fb303/thrift/mocks/thrift_build.rs

Lines changed: 23 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,35 @@
11
// @generated by autocargo
2+
23
use std::env;
34
use std::fs;
45
use std::path::Path;
5-
66
use thrift_compiler::Config;
77
use thrift_compiler::GenContext;
8-
8+
const CRATEMAP: &str = "\
9+
fb303_core crate //fb303/thrift:fb303_core-rust
10+
";
911
#[rustfmt::skip]
1012
fn main() {
11-
// Rerun if this gets rewritten.
1213
println!("cargo:rerun-if-changed=thrift_build.rs");
13-
1414
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
15-
let out_dir: &Path = out_dir.as_ref();
16-
fs::write(
17-
out_dir.join("cratemap"),
18-
"fb303_core crate //fb303/thrift:fb303_core-rust",
19-
).expect("Failed to write cratemap");
20-
21-
let conf = {
22-
let mut conf = Config::from_env(GenContext::Mocks).expect("Failed to instantiate thrift_compiler::Config");
23-
24-
let path_from_manifest_to_base: &Path = "../../..".as_ref();
25-
let cargo_manifest_dir =
26-
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not provided");
27-
let cargo_manifest_dir: &Path = cargo_manifest_dir.as_ref();
28-
let base_path = cargo_manifest_dir
29-
.join(path_from_manifest_to_base)
30-
.canonicalize()
31-
.expect("Failed to canonicalize base_path");
32-
// TODO: replace canonicalize() with std::path::absolute() when
33-
// https://github.com/rust-lang/rust/pull/91673 is available (~Rust 1.60)
34-
// and remove this block.
35-
#[cfg(windows)]
36-
let base_path = Path::new(
37-
base_path
38-
.as_path()
39-
.to_string_lossy()
40-
.trim_start_matches(r"\\?\"),
41-
)
42-
.to_path_buf();
43-
44-
conf.base_path(base_path);
45-
46-
conf.types_crate("fb303_core__types");
47-
conf.clients_crate("fb303_core__clients");
48-
conf.services_crate("fb303_core__services");
49-
50-
let options = "deprecated_default_enum_min_i32,serde";
51-
if !options.is_empty() {
52-
conf.options(options);
53-
}
54-
55-
let types_include_srcs = vec![
56-
57-
];
58-
conf.types_include_srcs(types_include_srcs);
59-
60-
conf
61-
};
62-
63-
let srcs: &[&str] = &[
64-
"../fb303_core.thrift"
65-
];
15+
let cratemap_path = Path::new(&out_dir).join("cratemap");
16+
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
17+
let mut conf = Config::from_env(GenContext::Mocks)
18+
.expect("Failed to instantiate thrift_compiler::Config");
19+
let cargo_manifest_dir = env::var_os("CARGO_MANIFEST_DIR")
20+
.expect("CARGO_MANIFEST_DIR not provided");
21+
let mut base_path = Path::new(&cargo_manifest_dir)
22+
.join("../../..")
23+
.canonicalize()
24+
.expect("Failed to canonicalize base_path");
25+
if cfg!(windows) {
26+
base_path = base_path.to_string_lossy().trim_start_matches(r"\\?\").into();
27+
}
28+
conf.base_path(base_path);
29+
conf.types_crate("fb303_core__types");
30+
conf.clients_crate("fb303_core__clients");
31+
conf.services_crate("fb303_core__services");
32+
conf.options("deprecated_default_enum_min_i32,serde");
33+
let srcs = &["../fb303_core.thrift"];
6634
conf.run(srcs).expect("Failed while running thrift compilation");
6735
}

fb303/thrift/mocks/thrift_lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// @generated by autocargo
2+
23
::codegen_includer_proc_macro::include!();
Lines changed: 23 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,35 @@
11
// @generated by autocargo
2+
23
use std::env;
34
use std::fs;
45
use std::path::Path;
5-
66
use thrift_compiler::Config;
77
use thrift_compiler::GenContext;
8-
8+
const CRATEMAP: &str = "\
9+
fb303_core crate //fb303/thrift:fb303_core-rust
10+
";
911
#[rustfmt::skip]
1012
fn main() {
11-
// Rerun if this gets rewritten.
1213
println!("cargo:rerun-if-changed=thrift_build.rs");
13-
1414
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
15-
let out_dir: &Path = out_dir.as_ref();
16-
fs::write(
17-
out_dir.join("cratemap"),
18-
"fb303_core crate //fb303/thrift:fb303_core-rust",
19-
).expect("Failed to write cratemap");
20-
21-
let conf = {
22-
let mut conf = Config::from_env(GenContext::Services).expect("Failed to instantiate thrift_compiler::Config");
23-
24-
let path_from_manifest_to_base: &Path = "../../..".as_ref();
25-
let cargo_manifest_dir =
26-
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not provided");
27-
let cargo_manifest_dir: &Path = cargo_manifest_dir.as_ref();
28-
let base_path = cargo_manifest_dir
29-
.join(path_from_manifest_to_base)
30-
.canonicalize()
31-
.expect("Failed to canonicalize base_path");
32-
// TODO: replace canonicalize() with std::path::absolute() when
33-
// https://github.com/rust-lang/rust/pull/91673 is available (~Rust 1.60)
34-
// and remove this block.
35-
#[cfg(windows)]
36-
let base_path = Path::new(
37-
base_path
38-
.as_path()
39-
.to_string_lossy()
40-
.trim_start_matches(r"\\?\"),
41-
)
42-
.to_path_buf();
43-
44-
conf.base_path(base_path);
45-
46-
conf.types_crate("fb303_core__types");
47-
conf.clients_crate("fb303_core__clients");
48-
conf.services_crate("fb303_core__services");
49-
50-
let options = "deprecated_default_enum_min_i32,serde";
51-
if !options.is_empty() {
52-
conf.options(options);
53-
}
54-
55-
let types_include_srcs = vec![
56-
57-
];
58-
conf.types_include_srcs(types_include_srcs);
59-
60-
conf
61-
};
62-
63-
let srcs: &[&str] = &[
64-
"../fb303_core.thrift"
65-
];
15+
let cratemap_path = Path::new(&out_dir).join("cratemap");
16+
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
17+
let mut conf = Config::from_env(GenContext::Services)
18+
.expect("Failed to instantiate thrift_compiler::Config");
19+
let cargo_manifest_dir = env::var_os("CARGO_MANIFEST_DIR")
20+
.expect("CARGO_MANIFEST_DIR not provided");
21+
let mut base_path = Path::new(&cargo_manifest_dir)
22+
.join("../../..")
23+
.canonicalize()
24+
.expect("Failed to canonicalize base_path");
25+
if cfg!(windows) {
26+
base_path = base_path.to_string_lossy().trim_start_matches(r"\\?\").into();
27+
}
28+
conf.base_path(base_path);
29+
conf.types_crate("fb303_core__types");
30+
conf.clients_crate("fb303_core__clients");
31+
conf.services_crate("fb303_core__services");
32+
conf.options("deprecated_default_enum_min_i32,serde");
33+
let srcs = &["../fb303_core.thrift"];
6634
conf.run(srcs).expect("Failed while running thrift compilation");
6735
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// @generated by autocargo
2+
23
::codegen_includer_proc_macro::include!();

fb303/thrift/thrift_build.rs

Lines changed: 23 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,35 @@
11
// @generated by autocargo
2+
23
use std::env;
34
use std::fs;
45
use std::path::Path;
5-
66
use thrift_compiler::Config;
77
use thrift_compiler::GenContext;
8-
8+
const CRATEMAP: &str = "\
9+
fb303_core crate //fb303/thrift:fb303_core-rust
10+
";
911
#[rustfmt::skip]
1012
fn main() {
11-
// Rerun if this gets rewritten.
1213
println!("cargo:rerun-if-changed=thrift_build.rs");
13-
1414
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
15-
let out_dir: &Path = out_dir.as_ref();
16-
fs::write(
17-
out_dir.join("cratemap"),
18-
"fb303_core crate //fb303/thrift:fb303_core-rust",
19-
).expect("Failed to write cratemap");
20-
21-
let conf = {
22-
let mut conf = Config::from_env(GenContext::Types).expect("Failed to instantiate thrift_compiler::Config");
23-
24-
let path_from_manifest_to_base: &Path = "../..".as_ref();
25-
let cargo_manifest_dir =
26-
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not provided");
27-
let cargo_manifest_dir: &Path = cargo_manifest_dir.as_ref();
28-
let base_path = cargo_manifest_dir
29-
.join(path_from_manifest_to_base)
30-
.canonicalize()
31-
.expect("Failed to canonicalize base_path");
32-
// TODO: replace canonicalize() with std::path::absolute() when
33-
// https://github.com/rust-lang/rust/pull/91673 is available (~Rust 1.60)
34-
// and remove this block.
35-
#[cfg(windows)]
36-
let base_path = Path::new(
37-
base_path
38-
.as_path()
39-
.to_string_lossy()
40-
.trim_start_matches(r"\\?\"),
41-
)
42-
.to_path_buf();
43-
44-
conf.base_path(base_path);
45-
46-
conf.types_crate("fb303_core__types");
47-
conf.clients_crate("fb303_core__clients");
48-
conf.services_crate("fb303_core__services");
49-
50-
let options = "deprecated_default_enum_min_i32,serde";
51-
if !options.is_empty() {
52-
conf.options(options);
53-
}
54-
55-
let types_include_srcs = vec![
56-
57-
];
58-
conf.types_include_srcs(types_include_srcs);
59-
60-
conf
61-
};
62-
63-
let srcs: &[&str] = &[
64-
"fb303_core.thrift"
65-
];
15+
let cratemap_path = Path::new(&out_dir).join("cratemap");
16+
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
17+
let mut conf = Config::from_env(GenContext::Types)
18+
.expect("Failed to instantiate thrift_compiler::Config");
19+
let cargo_manifest_dir = env::var_os("CARGO_MANIFEST_DIR")
20+
.expect("CARGO_MANIFEST_DIR not provided");
21+
let mut base_path = Path::new(&cargo_manifest_dir)
22+
.join("../..")
23+
.canonicalize()
24+
.expect("Failed to canonicalize base_path");
25+
if cfg!(windows) {
26+
base_path = base_path.to_string_lossy().trim_start_matches(r"\\?\").into();
27+
}
28+
conf.base_path(base_path);
29+
conf.types_crate("fb303_core__types");
30+
conf.clients_crate("fb303_core__clients");
31+
conf.services_crate("fb303_core__services");
32+
conf.options("deprecated_default_enum_min_i32,serde");
33+
let srcs = &["fb303_core.thrift"];
6634
conf.run(srcs).expect("Failed while running thrift compilation");
6735
}

fb303/thrift/thrift_lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// @generated by autocargo
2+
23
::codegen_includer_proc_macro::include!();

0 commit comments

Comments
 (0)