crosvm/setup_cros_cargo.sh
Dennis Kempin faee6ce7fa Update setup_cros_cargo.sh to fix all paths for chromeos cargo builds
This allows ChromeOS developers to use cargo to build against the crates
provided by the ChromeOS source tree, instead of using the bundled
submodules.

BUG=b:196585250
TEST=./setup_cros_cargo.sh && cargo build

Change-Id: I02d38784f7a97657c37c267818499efed4ddab47
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3092414
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2021-08-16 19:31:58 +00:00

23 lines
889 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.
#
# TODO(b/194323235): Add documentation for ChromeOS developer workflows.
declare -A replacements=(
["libcras_stub"]="../../third_party/adhd/cras/client/libcras"
["third_party/minijail"]="../../aosp/external/minijail"
["third_party/vmm_vhost"]="../../third_party/rust-vmm/vhost"
)
for crate in "${!replacements[@]}"; do
echo "Replacing '${crate}' with '${replacements[$crate]}'"
sed -i "s|path = \"${crate}|path = \"${replacements[$crate]}|g" \
Cargo.toml
done
echo "Modified Cargo.toml with new paths. Please do not commit those."