-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |