2021-10-28 18:18:39 +00:00
|
|
|
#!/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.
|
|
|
|
|
2021-12-14 05:19:17 +00:00
|
|
|
set -e
|
|
|
|
|
2021-11-14 11:21:53 +00:00
|
|
|
CARGO_PATH=$(dirname "$0")/../../Cargo.toml
|
|
|
|
|
2021-12-14 05:19:17 +00:00
|
|
|
if ! git diff "${CARGO_PATH}"; then
|
|
|
|
echo "There is pending Cargo.toml changes, please clean first."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-10-28 18:18:39 +00:00
|
|
|
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" \
|
2021-11-14 11:21:53 +00:00
|
|
|
"${CARGO_PATH}"
|
2021-10-28 18:18:39 +00:00
|
|
|
done
|
|
|
|
|
2021-12-14 05:19:17 +00:00
|
|
|
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."
|