1
0

setup_cargo 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env bash
  2. # Copyright 2021 The ChromiumOS Authors
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. #
  6. # To build crosvm using cargo against libraries and crates provided by ChromeOS
  7. # use this script to update path references in Cargo.toml.
  8. set -e
  9. CARGO_PATH=$(dirname "$0")/../../Cargo.toml
  10. if ! git diff "${CARGO_PATH}"; then
  11. echo "There is pending Cargo.toml changes, please clean first."
  12. exit 1
  13. fi
  14. declare -A replacements=(
  15. ["libcras_stub"]="../../third_party/adhd/cras/client/libcras"
  16. ["system_api_stub"]="../../platform2/system_api"
  17. ["third_party/minijail"]="../../aosp/external/minijail"
  18. )
  19. for crate in "${!replacements[@]}"; do
  20. echo "Replacing '${crate}' with '${replacements[$crate]}'"
  21. sed -i "s|path = \"${crate}|path = \"${replacements[$crate]}|g" \
  22. "${CARGO_PATH}"
  23. done
  24. git commit "${CARGO_PATH}" -m 'crosvm: DO NOT SUBMIT: Cargo.toml changes.
  25. This is for local cargo {build,test} in your CrOS checkout.
  26. Please do not submit this change.
  27. BUG=None
  28. TEST=None
  29. Commit: false
  30. '
  31. echo "Modified Cargo.toml with new paths. Please do not submit the change."