mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
add autocargo for hgclientconf
Summary: Generate cargo files for hgclientconf Reviewed By: yancouto Differential Revision: D33843589 fbshipit-source-id: d9b3452be684fcaa727c0c0a1175c1d8954bf9f2
This commit is contained in:
parent
eda968ebe4
commit
8eaf3b3d64
@ -45,12 +45,15 @@ libcurl
|
||||
|
||||
[shipit.pathmap]
|
||||
fbcode/common/rust/shed = common/rust/shed
|
||||
fbcode/configerator/structs/scm/hg/public_autocargo = configerator/structs/scm/hg
|
||||
fbcode/configerator/structs/scm/hg = configerator/structs/scm/hg
|
||||
fbcode/eden/oss = .
|
||||
fbcode/eden = eden
|
||||
fbcode/tools/lfs = tools/lfs
|
||||
fbcode/thrift/lib/rust = thrift/lib/rust
|
||||
|
||||
[shipit.strip]
|
||||
^fbcode/configerator/structs/hg(?!/public_autocargo).*/Cargo\.toml$
|
||||
^fbcode/eden/fs/eden-config\.h$
|
||||
^fbcode/eden/fs/py/eden/config\.py$
|
||||
^fbcode/eden/hg/.*$
|
||||
|
@ -27,12 +27,15 @@ test-getdeps
|
||||
|
||||
[shipit.pathmap]
|
||||
fbcode/common/rust = common/rust
|
||||
fbcode/configerator/structs/scm/hg/public_autocargo = configerator/structs/scm/hg
|
||||
fbcode/configerator/structs/scm/hg = configerator/structs/scm/hg
|
||||
fbcode/eden/oss = .
|
||||
fbcode/eden = eden
|
||||
fbcode/tools/lfs = tools/lfs
|
||||
fbcode/fboss/common = common
|
||||
|
||||
[shipit.strip]
|
||||
^fbcode/configerator/structs/hg(?!/public_autocargo).*/Cargo\.toml$
|
||||
^fbcode/eden/fs/eden-config\.h$
|
||||
^fbcode/eden/fs/py/eden/config\.py$
|
||||
^fbcode/eden/hg/.*$
|
||||
|
32
configerator/structs/scm/hg/hgclientconf/Cargo.toml
Normal file
32
configerator/structs/scm/hg/hgclientconf/Cargo.toml
Normal file
@ -0,0 +1,32 @@
|
||||
# @generated by autocargo
|
||||
|
||||
[package]
|
||||
name = "config"
|
||||
version = "0.1.0"
|
||||
authors = ["Facebook"]
|
||||
edition = "2021"
|
||||
license = "GPLv2+"
|
||||
build = "thrift_build.rs"
|
||||
|
||||
[lib]
|
||||
path = "thrift_lib.rs"
|
||||
test = false
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.51"
|
||||
async-trait = "0.1.51"
|
||||
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
|
||||
const-cstr = "0.3.0"
|
||||
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
|
||||
futures = { version = "0.3.13", features = ["async-await", "compat"] }
|
||||
once_cell = "1.8"
|
||||
ref-cast = "1.0.2"
|
||||
serde = { version = "1.0.126", features = ["derive", "rc"] }
|
||||
serde_derive = "1.0"
|
||||
thiserror = "1.0.29"
|
||||
tracing = "0.1.29"
|
||||
tracing-futures = "0.2.5"
|
||||
|
||||
[build-dependencies]
|
||||
thrift_compiler = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
|
63
configerator/structs/scm/hg/hgclientconf/thrift_build.rs
Normal file
63
configerator/structs/scm/hg/hgclientconf/thrift_build.rs
Normal file
@ -0,0 +1,63 @@
|
||||
// @generated by autocargo
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
use thrift_compiler::Config;
|
||||
|
||||
#[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"),
|
||||
"hgclient crate",
|
||||
).expect("Failed to write cratemap");
|
||||
|
||||
let conf = {
|
||||
let mut conf = Config::from_env().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);
|
||||
|
||||
let options = "serde";
|
||||
if !options.is_empty() {
|
||||
conf.options(options);
|
||||
}
|
||||
|
||||
let include_srcs = vec![
|
||||
|
||||
];
|
||||
conf.include_srcs(include_srcs);
|
||||
|
||||
conf
|
||||
};
|
||||
|
||||
conf
|
||||
.run(&[
|
||||
"hgclient.thrift"
|
||||
])
|
||||
.expect("Failed while running thrift compilation");
|
||||
}
|
2
configerator/structs/scm/hg/hgclientconf/thrift_lib.rs
Normal file
2
configerator/structs/scm/hg/hgclientconf/thrift_lib.rs
Normal file
@ -0,0 +1,2 @@
|
||||
// @generated by autocargo
|
||||
::codegen_includer_proc_macro::include!();
|
Loading…
Reference in New Issue
Block a user