Skip to content

Commit

Permalink
Fix install script (#628)
Browse files Browse the repository at this point in the history
* Fix install script

* Remove spm completely from danger-swift without spm ci jobs

* Re add Danger dylib to the moved files

* Cleanup code

* Remove spm also from Linux

* Debugging commits

* Add major version specific extraction for linux

* Code Cleanup
  • Loading branch information
f-meloni authored Oct 15, 2024
1 parent f925a10 commit 04579f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
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

0 comments on commit 04579f4

Please sign in to comment.