crosvm/tools/chromeos/setup_cargo
Keiichi Watanabe eef484c20a tools: chromeos: Use relative path to Cargo.toml in setup_cargo
This change will allow the script to be executed from any path.

BUG=none
TEST=run tools/chromeos/setup_cargo from outside of crosvm directory

Change-Id: I9752f4a41987259f446431bf89c322095ef26e63
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3280361
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
2021-11-15 18:18:18 +00:00

23 lines
853 B
Bash
Executable file

#!/usr/bin/env bash
# Copyright 2021 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# To build crosvm using cargo against libraries and crates provided by ChromeOS
# use this script to update path references in Cargo.toml.
CARGO_PATH=$(dirname "$0")/../../Cargo.toml
declare -A replacements=(
["libcras_stub"]="../../third_party/adhd/cras/client/libcras"
["system_api_stub"]="../../platform2/system_api"
["third_party/minijail"]="../../aosp/external/minijail"
)
for crate in "${!replacements[@]}"; do
echo "Replacing '${crate}' with '${replacements[$crate]}'"
sed -i "s|path = \"${crate}|path = \"${replacements[$crate]}|g" \
"${CARGO_PATH}"
done
echo "Modified Cargo.toml with new paths. Please do not commit those."