crosvm/system_api/update_bindings.sh
Dennis Kempin 891455563b system_api: Add copy of ChromeOS's system_api
Adds a script that copies the bindings we need upstream. We cannot
use the original repository, as it's part of the large platform2 git
repository, and the original build.rs depends on ChromeOS tooling to
generate these bindings.

So instead, this change adds a script that can be called from a
chromiumos checkout of crosvm to update the upstream bindings.

This allows us to enable certain features that talk to ChromeOS
dbus services. They won't be functional upstream, but at least we
can compile and test the code.

To make things more consistent, we no longer replace the crate
with the ChromeOS version when building for ChromeOS.

BUG=b:244618505
TEST=presubmit

Change-Id: I504cbf6d12b0cb50d9935f5e49b7fa72b692d45c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3919814
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-28 18:13:00 +00:00

31 lines
917 B
Bash
Executable file

#!/usr/bin/env bash
# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
STUB_DIR=$(dirname "$0")
SYSTEM_API_DIR="$HOME/chromiumos/src/platform2/system_api"
if ! [ -e "$SYSTEM_API_DIR" ]; then
echo "This script must be run from a ChromeOS checkout and inside cros_sdk."
fi
# The system_api build.rs will generate bindings in $SYSTEM_API_DIR/src
(cd "$SYSTEM_API_DIR" && cargo build)
FILES=(
"src/bindings/client/org_chromium_userdataauth.rs"
"src/bindings/client/org_chromium_vtpm.rs"
"src/protos/auth_factor.rs"
"src/protos/fido.rs"
"src/protos/key.rs"
"src/protos/rpc.rs"
"src/protos/UserDataAuth.rs"
"src/protos/vtpm_interface.rs"
)
for FILE in "${FILES[@]}"; do
TARGET_DIR=$(dirname "$STUB_DIR/$FILE")
mkdir -p "$TARGET_DIR"
cp "$SYSTEM_API_DIR/$FILE" "$TARGET_DIR"
done