Skip to content

Commit

Permalink
Update autocargo component on FBS:master
Browse files Browse the repository at this point in the history
Reviewed By: zertosh

Differential Revision: D56655848

fbshipit-source-id: 3ff1c47bd562e6fa88e17432f1535dd7002044f5
  • Loading branch information
David Tolnay authored and facebook-github-bot committed Apr 26, 2024
1 parent e570f58 commit 741b04e
Show file tree
Hide file tree
Showing 104 changed files with 1,268 additions and 2,916 deletions.
87 changes: 27 additions & 60 deletions thrift/lib/rust/annotation/all/clients/thrift_build.rs
@@ -1,21 +1,12 @@
// @generated by autocargo

use std::env;
use std::fs;
use std::path::Path;

use thrift_compiler::Config;
use thrift_compiler::GenContext;

#[rustfmt::skip]
fn main() {
// Rerun if this gets rewritten.
println!("cargo:rerun-if-changed=thrift_build.rs");

let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let out_dir: &Path = out_dir.as_ref();
fs::write(
out_dir.join("cratemap"),
"annotation annotations //thrift/facebook/erlang:annotations-rust
const CRATEMAP: &str = "\
annotation annotations //thrift/facebook/erlang:annotations-rust
compat compat //thrift/annotation:compat-rust
cpp cpp //thrift/annotation:cpp-rust
go go //thrift/annotation:go-rust
Expand All @@ -25,53 +16,29 @@ java java //thrift/annotation:java-rust
python python //thrift/annotation:python-rust
rust rust //thrift/annotation:rust-rust
scope scope //thrift/annotation:scope-rust
thrift thrift //thrift/annotation:thrift-rust",
).expect("Failed to write cratemap");

let conf = {
let mut conf = Config::from_env(GenContext::Clients).expect("Failed to instantiate thrift_compiler::Config");

let path_from_manifest_to_base: &Path = "../../../../../..".as_ref();
let cargo_manifest_dir =
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not provided");
let cargo_manifest_dir: &Path = cargo_manifest_dir.as_ref();
let base_path = cargo_manifest_dir
.join(path_from_manifest_to_base)
.canonicalize()
.expect("Failed to canonicalize base_path");
// TODO: replace canonicalize() with std::path::absolute() when
// https://github.com/rust-lang/rust/pull/91673 is available (~Rust 1.60)
// and remove this block.
#[cfg(windows)]
let base_path = Path::new(
base_path
.as_path()
.to_string_lossy()
.trim_start_matches(r"\\?\"),
)
.to_path_buf();

conf.base_path(base_path);

conf.types_crate("all__types");
conf.clients_crate("all__clients");
conf.services_crate("all__services");

let options = "";
if !options.is_empty() {
conf.options(options);
}

let types_include_srcs = vec![

];
conf.types_include_srcs(types_include_srcs);

conf
};

let srcs: &[&str] = &[

];
thrift thrift //thrift/annotation:thrift-rust
";
#[rustfmt::skip]
fn main() {
println!("cargo:rerun-if-changed=thrift_build.rs");
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let cratemap_path = Path::new(&out_dir).join("cratemap");
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
let mut conf = Config::from_env(GenContext::Clients)
.expect("Failed to instantiate thrift_compiler::Config");
let cargo_manifest_dir = env::var_os("CARGO_MANIFEST_DIR")
.expect("CARGO_MANIFEST_DIR not provided");
let mut base_path = Path::new(&cargo_manifest_dir)
.join("../../../../../..")
.canonicalize()
.expect("Failed to canonicalize base_path");
if cfg!(windows) {
base_path = base_path.to_string_lossy().trim_start_matches(r"\\?\").into();
}
conf.base_path(base_path);
conf.types_crate("all__types");
conf.clients_crate("all__clients");
conf.services_crate("all__services");
let srcs = &[];
conf.run(srcs).expect("Failed while running thrift compilation");
}
1 change: 1 addition & 0 deletions thrift/lib/rust/annotation/all/clients/thrift_lib.rs
@@ -1,2 +1,3 @@
// @generated by autocargo

::codegen_includer_proc_macro::include!();
87 changes: 27 additions & 60 deletions thrift/lib/rust/annotation/all/mocks/thrift_build.rs
@@ -1,21 +1,12 @@
// @generated by autocargo

use std::env;
use std::fs;
use std::path::Path;

use thrift_compiler::Config;
use thrift_compiler::GenContext;

#[rustfmt::skip]
fn main() {
// Rerun if this gets rewritten.
println!("cargo:rerun-if-changed=thrift_build.rs");

let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let out_dir: &Path = out_dir.as_ref();
fs::write(
out_dir.join("cratemap"),
"annotation annotations //thrift/facebook/erlang:annotations-rust
const CRATEMAP: &str = "\
annotation annotations //thrift/facebook/erlang:annotations-rust
compat compat //thrift/annotation:compat-rust
cpp cpp //thrift/annotation:cpp-rust
go go //thrift/annotation:go-rust
Expand All @@ -25,53 +16,29 @@ java java //thrift/annotation:java-rust
python python //thrift/annotation:python-rust
rust rust //thrift/annotation:rust-rust
scope scope //thrift/annotation:scope-rust
thrift thrift //thrift/annotation:thrift-rust",
).expect("Failed to write cratemap");

let conf = {
let mut conf = Config::from_env(GenContext::Mocks).expect("Failed to instantiate thrift_compiler::Config");

let path_from_manifest_to_base: &Path = "../../../../../..".as_ref();
let cargo_manifest_dir =
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not provided");
let cargo_manifest_dir: &Path = cargo_manifest_dir.as_ref();
let base_path = cargo_manifest_dir
.join(path_from_manifest_to_base)
.canonicalize()
.expect("Failed to canonicalize base_path");
// TODO: replace canonicalize() with std::path::absolute() when
// https://github.com/rust-lang/rust/pull/91673 is available (~Rust 1.60)
// and remove this block.
#[cfg(windows)]
let base_path = Path::new(
base_path
.as_path()
.to_string_lossy()
.trim_start_matches(r"\\?\"),
)
.to_path_buf();

conf.base_path(base_path);

conf.types_crate("all__types");
conf.clients_crate("all__clients");
conf.services_crate("all__services");

let options = "";
if !options.is_empty() {
conf.options(options);
}

let types_include_srcs = vec![

];
conf.types_include_srcs(types_include_srcs);

conf
};

let srcs: &[&str] = &[

];
thrift thrift //thrift/annotation:thrift-rust
";
#[rustfmt::skip]
fn main() {
println!("cargo:rerun-if-changed=thrift_build.rs");
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let cratemap_path = Path::new(&out_dir).join("cratemap");
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
let mut conf = Config::from_env(GenContext::Mocks)
.expect("Failed to instantiate thrift_compiler::Config");
let cargo_manifest_dir = env::var_os("CARGO_MANIFEST_DIR")
.expect("CARGO_MANIFEST_DIR not provided");
let mut base_path = Path::new(&cargo_manifest_dir)
.join("../../../../../..")
.canonicalize()
.expect("Failed to canonicalize base_path");
if cfg!(windows) {
base_path = base_path.to_string_lossy().trim_start_matches(r"\\?\").into();
}
conf.base_path(base_path);
conf.types_crate("all__types");
conf.clients_crate("all__clients");
conf.services_crate("all__services");
let srcs = &[];
conf.run(srcs).expect("Failed while running thrift compilation");
}
1 change: 1 addition & 0 deletions thrift/lib/rust/annotation/all/mocks/thrift_lib.rs
@@ -1,2 +1,3 @@
// @generated by autocargo

::codegen_includer_proc_macro::include!();
87 changes: 27 additions & 60 deletions thrift/lib/rust/annotation/all/services/thrift_build.rs
@@ -1,21 +1,12 @@
// @generated by autocargo

use std::env;
use std::fs;
use std::path::Path;

use thrift_compiler::Config;
use thrift_compiler::GenContext;

#[rustfmt::skip]
fn main() {
// Rerun if this gets rewritten.
println!("cargo:rerun-if-changed=thrift_build.rs");

let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let out_dir: &Path = out_dir.as_ref();
fs::write(
out_dir.join("cratemap"),
"annotation annotations //thrift/facebook/erlang:annotations-rust
const CRATEMAP: &str = "\
annotation annotations //thrift/facebook/erlang:annotations-rust
compat compat //thrift/annotation:compat-rust
cpp cpp //thrift/annotation:cpp-rust
go go //thrift/annotation:go-rust
Expand All @@ -25,53 +16,29 @@ java java //thrift/annotation:java-rust
python python //thrift/annotation:python-rust
rust rust //thrift/annotation:rust-rust
scope scope //thrift/annotation:scope-rust
thrift thrift //thrift/annotation:thrift-rust",
).expect("Failed to write cratemap");

let conf = {
let mut conf = Config::from_env(GenContext::Services).expect("Failed to instantiate thrift_compiler::Config");

let path_from_manifest_to_base: &Path = "../../../../../..".as_ref();
let cargo_manifest_dir =
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not provided");
let cargo_manifest_dir: &Path = cargo_manifest_dir.as_ref();
let base_path = cargo_manifest_dir
.join(path_from_manifest_to_base)
.canonicalize()
.expect("Failed to canonicalize base_path");
// TODO: replace canonicalize() with std::path::absolute() when
// https://github.com/rust-lang/rust/pull/91673 is available (~Rust 1.60)
// and remove this block.
#[cfg(windows)]
let base_path = Path::new(
base_path
.as_path()
.to_string_lossy()
.trim_start_matches(r"\\?\"),
)
.to_path_buf();

conf.base_path(base_path);

conf.types_crate("all__types");
conf.clients_crate("all__clients");
conf.services_crate("all__services");

let options = "";
if !options.is_empty() {
conf.options(options);
}

let types_include_srcs = vec![

];
conf.types_include_srcs(types_include_srcs);

conf
};

let srcs: &[&str] = &[

];
thrift thrift //thrift/annotation:thrift-rust
";
#[rustfmt::skip]
fn main() {
println!("cargo:rerun-if-changed=thrift_build.rs");
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let cratemap_path = Path::new(&out_dir).join("cratemap");
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
let mut conf = Config::from_env(GenContext::Services)
.expect("Failed to instantiate thrift_compiler::Config");
let cargo_manifest_dir = env::var_os("CARGO_MANIFEST_DIR")
.expect("CARGO_MANIFEST_DIR not provided");
let mut base_path = Path::new(&cargo_manifest_dir)
.join("../../../../../..")
.canonicalize()
.expect("Failed to canonicalize base_path");
if cfg!(windows) {
base_path = base_path.to_string_lossy().trim_start_matches(r"\\?\").into();
}
conf.base_path(base_path);
conf.types_crate("all__types");
conf.clients_crate("all__clients");
conf.services_crate("all__services");
let srcs = &[];
conf.run(srcs).expect("Failed while running thrift compilation");
}
1 change: 1 addition & 0 deletions thrift/lib/rust/annotation/all/services/thrift_lib.rs
@@ -1,2 +1,3 @@
// @generated by autocargo

::codegen_includer_proc_macro::include!();

0 comments on commit 741b04e

Please sign in to comment.