1
0

update_bindings.sh 856 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. # Copyright 2022 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. STUB_DIR=$(dirname "$0")
  6. SYSTEM_API_DIR="$HOME/chromiumos/src/platform2/system_api"
  7. if ! [ -e "$SYSTEM_API_DIR" ]; then
  8. echo "This script must be run from a ChromeOS checkout and inside cros_sdk."
  9. fi
  10. # The system_api build.rs will generate bindings in $SYSTEM_API_DIR/src
  11. (cd "$SYSTEM_API_DIR" && cargo build)
  12. FILES=(
  13. "src/bindings/client/org_chromium_spaced.rs"
  14. "src/bindings/client/org_chromium_vtpm.rs"
  15. "src/bindings/client/org_chromium_power_manager.rs"
  16. "src/protos/spaced.rs"
  17. "src/protos/vtpm_interface.rs"
  18. )
  19. for FILE in "${FILES[@]}"; do
  20. TARGET_DIR=$(dirname "$STUB_DIR/$FILE")
  21. mkdir -p "$TARGET_DIR"
  22. cp "$SYSTEM_API_DIR/$FILE" "$TARGET_DIR"
  23. done