From 0b8ee4043bbc08cb908ef9083b27e1dc40e623c8 Mon Sep 17 00:00:00 2001 From: Katy Voor Date: Wed, 4 Aug 2021 12:40:50 -0700 Subject: [PATCH] Use third-party instead of installing deps Summary: Call third-party binaries instead of making developers install. Reviewed By: shayne-fletcher Differential Revision: D30108640 fbshipit-source-id: df522ac720d55cc3a137a5b9d63f7f5c063072c7 --- hphp/hack/src/cbindgen.sh | 118 ++++++++++++---------------------------------- 1 file changed, 29 insertions(+), 89 deletions(-) diff --git a/hphp/hack/src/cbindgen.sh b/hphp/hack/src/cbindgen.sh index 5795c7f2edb..45af8d4a103 100755 --- a/hphp/hack/src/cbindgen.sh +++ b/hphp/hack/src/cbindgen.sh @@ -9,40 +9,6 @@ if [ "$(echo "$top" | grep -c "fbcode\$")" -ne 1 ] exit 1 fi -if ! command -v "cargo" &> /dev/null -then - echo "It seems cargo is not in the PATH." - echo " Try: 'export PATH=/data/users/${USER}/fbsource/fbcode/third-party-buck/platform009/build/rust/bin:\$PATH'" - read -r -p " Perform these steps? [y/n] " input - case $input in - [yY][eE][sS]|[yY]) - echo " Perfoming steps" - export PATH="/data/users/${USER}/fbsource/fbcode/third-party-buck/platform009/build/rust/bin:$PATH" - ;; - *) - echo " No steps performed. Exiting." - exit 2 - ;; - esac -fi - -if [ "$(sudo feature installed | grep -c ttls_fwdproxy)" -ne 1 ] -then - echo "ttls_fwdproxy is not installed." - echo "Try: 'sudo feature install ttls_fwdproxy'" - read -r -p " Perform these steps? [y/n] " input - case $input in - [yY][eE][sS]|[yY]) - echo " Perfoming steps" - sudo feature install ttls_fwdproxy - ;; - *) - echo " No steps performed. Exiting." - exit 2 - ;; - esac -fi - DIR=hphp/hack/.cargo_vendor if [ ! -d "$DIR" ]; then @@ -61,126 +27,100 @@ then esac fi -# These are sometimes needed to properly install cbindgen -if [ "$(git config --list | grep -c http.proxy)" -ne 1 ] -then git config --global http.proxy http://fwdproxy:8080 -fi -if [ "$(git config --list | grep -c https.proxy)" -ne 1 ] -then git config --global https.proxy https://fwdproxy:8080 -fi - -if ! command -v "cbindgen" &> /dev/null -then - echo "It seems cbindgen is not in the PATH." - echo " Try: 'cargo install --force cbindgen'" - echo " (You may need to 'export https_proxy=http://fwdproxy:8080' to install cbindgen)." - echo " (You may need to 'export PATH=${HOME}/.cargo/bin:\$PATH' to be able to run the installed binaries)." - read -r -p " Perform these steps? [y/n] " input - case $input in - [yY][eE][sS]|[yY]) - echo " Perfoming steps" - export https_proxy=http://fwdproxy:8080 - cargo install --force cbindgen - export PATH="${HOME}/.cargo/bin:$PATH" - ;; - *) - echo " No steps performed. Exiting." - exit 2 - ;; - esac -fi - set -x +cargo="buck run fbsource//third-party/rust:cargo-cargo --" +cbindgen="buck run fbsource//third-party/rust:cbindgen-cbindgen --" + # 'cargo update' ensures the existing Cargo.lock files contain the latest versions # ffi.h (cd hphp/hack/src/utils/ffi && \ - cargo update && \ - cbindgen --config ./cbindgen_ffi.toml \ + $cargo update && \ + $cbindgen --config ./cbindgen_ffi.toml \ --crate ffi \ --output "$top/hphp/hack/src/utils/ffi/ffi.h") # hhbc_id.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_hhbc_id && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_id.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_id.toml \ --crate hhbc_by_ref_hhbc_id \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_id.h") # hhbc_label.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_label && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_label.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_label.toml \ --crate hhbc_by_ref_label \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_label.h") # hhbc_local.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_local && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_local.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_local.toml \ --crate hhbc_by_ref_local \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_local.h") # hhbc_runtime.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_runtime && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_runtime.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_runtime.toml \ --crate hhbc_by_ref_runtime \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_runtime.h") # hhbc_ast.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_hhbc_ast && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_ast.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_ast.toml \ --crate hhbc_by_ref_hhbc_ast \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_ast.h") # hhbc_instruction_sequence.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_instruction_sequence && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_instruction_sequence.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_instruction_sequence.toml \ --crate hhbc_by_ref_instruction_sequence \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_instruction_sequence.h") # hhbc_symbol_refs_state.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_symbol_refs_state && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_symbol_refs_state.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_symbol_refs_state.toml \ --crate hhbc_by_ref_symbol_refs_state \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_symbol_refs_state.h") # hhbc_hhas_symbol_refs.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_hhas_symbol_refs && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_hhas_symbol_refs.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_hhas_symbol_refs.toml \ --crate hhbc_by_ref_hhas_symbol_refs \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_symbol_refs.h") # hhbc_hhas_constant.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_hhas_constant && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_hhas_constant.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_hhas_constant.toml \ --crate hhbc_by_ref_hhas_constant \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_constant.h") # hhbc_hhas_type.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_hhas_type && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_hhas_type.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_hhas_type.toml \ --crate hhbc_by_ref_hhas_type \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_type.h") # hhbc_hhas_attribute.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_hhas_attribute && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_hhas_attribute.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_hhas_attribute.toml \ --crate hhbc_by_ref_hhas_attribute \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_attribute.h") # hhbc_hhas_adata.h (cd hphp/hack/src/hhbc/hhbc_by_ref/cargo/hhbc_by_ref_hhas_adata && \ - cargo update && \ - cbindgen --config ../../cbindgen_hhbc_hhas_adata.toml \ + $cargo update && \ + $cbindgen --config ../../cbindgen_hhbc_hhas_adata.toml \ --crate hhbc_by_ref_hhas_adata \ --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_adata.h") -- 2.11.4.GIT