From 580adff57579bad2c5b2ea851839a463f14e7de3 Mon Sep 17 00:00:00 2001 From: Akosh Farkash Date: Thu, 9 May 2024 16:18:44 +0100 Subject: [PATCH] DOCS: Eth API --- scripts/copy-rust-dep-structure.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 scripts/copy-rust-dep-structure.sh diff --git a/scripts/copy-rust-dep-structure.sh b/scripts/copy-rust-dep-structure.sh new file mode 100755 index 0000000000..ea08766a13 --- /dev/null +++ b/scripts/copy-rust-dep-structure.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Copy only the Cargo.toml files in the exact project structure, +# so that we can build all dependencies without our own sources. + +IN_DIR=$1 +OUT_DIR=$2 + +for file in $(find $IN_DIR -type f \( -wholename "**/Cargo.*" \) | grep -v target | grep -v node_modules); do + RELATIVE_PATH=${file#*$IN_DIR/} + TARGET_DIR=$OUT_DIR/$(dirname $RELATIVE_PATH) + mkdir -p $TARGET_DIR + cp $file $TARGET_DIR +done + + +# Construct dummy sources. Add a print to help debug the case if we failed to properly replace the file. +echo "fn main() { println!(\"I'm the dummy.\"); }" > $OUT_DIR/fendermint/app/src/main.rs + +for crate in $(find $TARGET_DIR -name "Cargo.toml" | xargs dirname | grep -v infra | grep -v node_modules | grep /); do \ + touch $crate/src/lib.rs; \ +done