Skip to content

Commit

Permalink
Update build_contracts.sh
Browse files Browse the repository at this point in the history
Here's a summary of the improvements made:

    Added set -e to make the script exit on any error.
    Simplified how the current and parent directories are determined.
    Added informative comments to describe each step of the script.
    Included error-checking after each significant operation to ensure the script doesn't proceed if something fails.
    Added a completion message at the end of the script for better feedback.
  • Loading branch information
tadash10 authored Sep 26, 2023
1 parent 8059402 commit f8f7d86
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions scripts/build_contracts.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,44 @@
#!/bin/bash
CURRENT_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
PARENT_DIR="$( builtin cd ${CURRENT_DIR}/.. >/dev/null 2>&1 ; pwd -P )"
cd ${PARENT_DIR}
set -e # Exit on error

# Determine the current script directory
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Determine the parent directory
PARENT_DIR="$( dirname "$CURRENT_DIR" )"

# Move to the parent directory
cd "$PARENT_DIR"

# Install Go packages in tools/schema
echo "Installing Go packages in tools/schema..."
cd tools/schema
go install
cd ${PARENT_DIR}

# Move back to the parent directory
cd "$PARENT_DIR"

# Run 'make install'
echo "Running 'make install'..."
make install

# Move to contracts/wasm/scripts
echo "Moving to contracts/wasm/scripts..."
cd contracts/wasm/scripts

# Run cleanup.sh
echo "Running cleanup.sh..."
./cleanup.sh

# Run all_build.sh
echo "Running all_build.sh..."
./all_build.sh

# Run update_hardcoded.sh
echo "Running update_hardcoded.sh..."
./update_hardcoded.sh

cd ${CURRENT_DIR}
# Move back to the original script directory
cd "$CURRENT_DIR"

echo "Script completed successfully."

0 comments on commit f8f7d86

Please sign in to comment.