crosvm/tools/chromeos/setup_cargo
Junichi Uekawa 5e91be7064 crosvm: Commit Cargo.toml with a useful description.
This is what I do all the time manually, maybe this can be automated.

BUG=None
TEST=run it and observe.

Change-Id: Ia32790ca7dd0b8313ce05dcff28509b8a21d4f76
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3336823
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2022-01-06 22:59:57 +00:00

42 lines
1.2 KiB
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.
set -e
CARGO_PATH=$(dirname "$0")/../../Cargo.toml
if ! git diff "${CARGO_PATH}"; then
echo "There is pending Cargo.toml changes, please clean first."
exit 1
fi
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
git commit "${CARGO_PATH}" -m 'crosvm: DO NOT SUBMIT: Cargo.toml changes.
This is for local cargo {build,test} in your CrOS checkout.
Please do not submit this change.
BUG=None
TEST=None
Commit: false
'
echo "Modified Cargo.toml with new paths. Please do not submit the change."