Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use symlink for flatten.sh #2384

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions make/scripts/flatten.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# This script flattens Solidity contracts and saves them in ./flattened
# The existing content of ./flattened is removed
# This tool takes both globs and filenames as the list of arguments and flattens everything
# Usage: ./script/sh/flatten.sh contracts/**.sol contracts/client/TestClient.sol <...>

RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color

# Check if arguments were supplied
if [ $# -eq 0 ]; then
echo -e "${RED}Error: provide globs/filenames of the contracts to flatten!${NC}"
exit 1
fi

# First, we remove the existing flattened files
rm -rf ./flattened

# Track the amount of flattened files for the final report
count=0
# Then, we iterate over the supplied arguments
# If any argument was a glob, this will iterate over the files it specifies
for var in "$@"; do
# Strip contract name "Abc.sol" from the path
fn=$(basename "$var")
# Flatten the file and save it in ./flattened
# Make sure that flattened contracts base names are unique!
forge flatten "$var" -o "./flattened/$fn"
((++count))
done

echo -e "${GREEN}Files flattened: $count${NC}"
33 changes: 0 additions & 33 deletions packages/contracts-communication/flatten.sh

This file was deleted.

1 change: 1 addition & 0 deletions packages/contracts-communication/flatten.sh
33 changes: 0 additions & 33 deletions packages/contracts-core/script/sh/flatten.sh

This file was deleted.

1 change: 1 addition & 0 deletions packages/contracts-core/script/sh/flatten.sh
33 changes: 0 additions & 33 deletions packages/contracts-rfq/flatten.sh

This file was deleted.

1 change: 1 addition & 0 deletions packages/contracts-rfq/flatten.sh
Loading