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

Fix install script #628

Merged
merged 8 commits into from
Oct 15, 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
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ jobs:

- run: make install

- run: rm -rf .build && rm -rf Package.swift

- run: danger-swift ci --verbose --failOnErrors
if: ${{ github.event_name == 'pull_request' }}
env:
Expand Down Expand Up @@ -242,6 +244,8 @@ jobs:

- run: make install PREFIX='/opt/homebrew'

- run: rm -rf .build && rm -rf Package.swift

- run: danger-swift ci --verbose --failOnErrors
if: ${{ github.event_name == 'pull_request' }}
env:
Expand Down Expand Up @@ -283,6 +287,8 @@ jobs:

- run: make install

- run: rm -rf .build && rm -rf Package.swift

- run: danger-swift ci --verbose --failOnErrors
if: ${{ github.event_name == 'pull_request' }}
env:
Expand Down
13 changes: 8 additions & 5 deletions Scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,28 @@ swift package clean
if [[ "$OSTYPE" == "darwin"* ]]; then
BUILD_FOLDER=".build/release"
swift build --disable-sandbox -c release
MAJOR_VERSION=$(swift --version | awk '{print $4}' | cut -d '.' -f 1)
else
BUILD_FOLDER=".build/debug"
swift build --disable-sandbox
MAJOR_VERSION=$(swift --version | awk '{for(i=1;i<=NF;i++){if($i ~ /^[0-9]+\.[0-9]+$/){print $i; break}}}' | cut -d '.' -f 1)
fi

MAJOR_VERSION=$(swift --version | awk '{print $4}' | cut -d '.' -f 1)
mkdir -p "$PREFIX/bin"
mkdir -p "$LIB_INSTALL_PATH"
cp -f "$BUILD_FOLDER/$TOOL_NAME" "$INSTALL_PATH"

ARRAY=()
for ARG in "${SWIFT_LIB_FILES[@]}"; do
ARRAY+=("$BUILD_FOLDER/$ARG")
done

mkdir -p "$PREFIX/bin"
mkdir -p "$LIB_INSTALL_PATH"
cp -f "$BUILD_FOLDER/$TOOL_NAME" "$INSTALL_PATH"

if [[ $MAJOR_VERSION -ge 6 ]]; then
BUILD_FOLDER+="/Modules"
SWIFT_LIB_FILES=($(ls "$BUILD_FOLDER"))
for ARG in "${SWIFT_LIB_FILES[@]}"; do
ARRAY+=("$BUILD_FOLDER/$ARG")
done
fi

cp -fr "${ARRAY[@]}" "$LIB_INSTALL_PATH" 2>/dev/null || :
Expand Down
Loading