Skip to content

Commit

Permalink
Update build-script.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
RodXPP committed May 25, 2023
1 parent 62a01d2 commit a55b39e
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions build-script.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Exit if any command fails
# Exit as soon as any command fails
set -e

# Iterate over every subdirectory of every language directory
Expand All @@ -12,18 +12,22 @@ for project in */*; do

# Build the project based on the language
case "$language" in
c) gcc -o "$project/out" "$project/src/"*.c ;;
cpp) g++ -o "$project/out" "$project/src/"*.cpp ;;
c#) dotnet build "$project/src" ;;
python)
for file in "$project/src/"*.py
do
python -m py_compile $file
python $file
done
;;
golang) go build -v -o "$project/out" "$project/src/"*.go ;;
*) echo "Unknown language: $language" ; exit 1 ;;
c)
files=("$project/src/"*.c)
[[ -e "${files[0]}" ]] && gcc -o "$project/out" "${files[@]}" ;;
c++)
files=("$project/src/"*.cpp)
[[ -e "${files[0]}" ]] && g++ -o "$project/out" "${files[@]}" ;;
c#)
[[ -d "$project/src" ]] && dotnet build "$project/src" ;;
python)
files=("$project/src/"*.py)
[[ -e "${files[0]}" ]] && for file in "${files[@]}"; do python -m py_compile "$file"; python "$file"; done ;;
golang)
files=("$project/src/"*.go)
[[ -e "${files[0]}" ]] && go build -v -o "$project/out" "${files[@]}" ;;
*)
echo "Unknown language: $language"
exit 1 ;;
esac
done

0 comments on commit a55b39e

Please sign in to comment.