Use Fuchsia directory rust crates Fuchsia no longer uses a separate directory for third party rust crates. This change symlinks rust_crates to the equivalent directory in a Fuchsia root. Change-Id: I7e12f0232225f098d5ca2d3a4a560e2ecf49a8a6
diff --git a/.cargo/config b/.cargo/config index 92a7f2f..a46a6d2 100644 --- a/.cargo/config +++ b/.cargo/config
@@ -6,5 +6,5 @@ replace-with = "vendored-sources" [source.vendored-sources] -directory = "rust-crates/rustc_deps/vendor" +directory = "rust_crates/vendor"
diff --git a/.gitignore b/.gitignore index 3a1a183..0303cb3 100644 --- a/.gitignore +++ b/.gitignore
@@ -1,3 +1,4 @@ +Cargo.lock target out -rust-crates \ No newline at end of file +rust_crates
diff --git a/Cargo.toml b/Cargo.toml index c405a33..55f6868 100644 --- a/Cargo.toml +++ b/Cargo.toml
@@ -12,9 +12,9 @@ edition = "2018" [dependencies] -structopt = { path = "rust-crates/rustc_deps/vendor/structopt" } -libc = { path = "rust-crates/rustc_deps/vendor/libc" } +structopt = { path = "rust_crates/vendor/structopt" } +libc = { path = "rust_crates/vendor/libc" } [patch.crates-io] -winapi = { path = "rust-crates/rustc_deps/tiny_mirrors/winapi" } -winapi-util = { path = "rust-crates/rustc_deps/tiny_mirrors/winapi-util" } +winapi = { path = "rust_crates/tiny_mirrors/winapi" } +winapi-util = { path = "rust_crates/tiny_mirrors/winapi-util" }
diff --git a/build.sh b/build.sh index 68ba5aa..0c1b203 100755 --- a/build.sh +++ b/build.sh
@@ -7,10 +7,20 @@ set -eo pipefail usage() { - echo "usage: ${0} {arm64, x64}" + echo "usage: ${0} [options] {arm64, x64}" + echo + echo " -f [fuchsia-dir] Fuchsia directory (required)" + echo exit 1 } +while getopts "f:" OPT; do + case $OPT in + f) FUCHSIA_DIR="${OPTARG}";; + esac +done +shift $((OPTIND - 1)) + case "${1}" in arm64) ARCH="arm64" @@ -25,12 +35,13 @@ declare -r OUT_DIR="out/${ARCH}" declare -r IMAGE_FILE="out/linux-tests-${ARCH}.img" -if [ ! -d "rust-crates" ]; then - git clone "https://fuchsia.googlesource.com/third_party/rust-crates" -else - pushd "rust-crates" - git pull - popd +if [ ! -d "rust_crates" ]; then + if [ ! -d "${FUCHSIA_DIR}" ]; then + echo "Must specifiy Fuchsia directory on first run." + usage + fi + + ln -s ${FUCHSIA_DIR}/third_party/rust_crates/ rust_crates fi cargo build --target=${TARGET}