Skip to content

Commit

Permalink
fix: Fix issues with path handling in grep command Update is_contract…
Browse files Browse the repository at this point in the history
….sh (#2359)
  • Loading branch information
ursulabauer authored Jan 3, 2025
1 parent b195f58 commit 474553b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/is_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ SOURCE_PATH=$(cargo metadata --format-version=1 --manifest-path "$MANIFEST_PATH"
| select(.id == $ROOT_PACKAGE).targets[]
| select(.kind[] | contains("lib")).src_path')

if grep -q '^#\[ink::contract\([^]]*\)\]' $SOURCE_PATH; then
# Check if SOURCE_PATH is empty
if [ -z "$SOURCE_PATH" ]; then
echo "Error: Source path is empty."
exit 1
fi

# Check for the #[ink::contract] macro in the source file
if grep -q '^#\[ink::contract\([^]]*\)\]' "$SOURCE_PATH"; then
exit 0
else
exit 1
Expand Down

0 comments on commit 474553b

Please sign in to comment.