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