Skip to content

Commit 04579f4

Browse files
authored
Fix install script (#628)
* 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
1 parent f925a10 commit 04579f4

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

.github/workflows/ci.yml

+6
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ jobs:
203203

204204
- run: make install
205205

206+
- run: rm -rf .build && rm -rf Package.swift
207+
206208
- run: danger-swift ci --verbose --failOnErrors
207209
if: ${{ github.event_name == 'pull_request' }}
208210
env:
@@ -242,6 +244,8 @@ jobs:
242244

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

247+
- run: rm -rf .build && rm -rf Package.swift
248+
245249
- run: danger-swift ci --verbose --failOnErrors
246250
if: ${{ github.event_name == 'pull_request' }}
247251
env:
@@ -283,6 +287,8 @@ jobs:
283287

284288
- run: make install
285289

290+
- run: rm -rf .build && rm -rf Package.swift
291+
286292
- run: danger-swift ci --verbose --failOnErrors
287293
if: ${{ github.event_name == 'pull_request' }}
288294
env:

Scripts/install.sh

+8-5
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,28 @@ swift package clean
1616
if [[ "$OSTYPE" == "darwin"* ]]; then
1717
BUILD_FOLDER=".build/release"
1818
swift build --disable-sandbox -c release
19+
MAJOR_VERSION=$(swift --version | awk '{print $4}' | cut -d '.' -f 1)
1920
else
2021
BUILD_FOLDER=".build/debug"
2122
swift build --disable-sandbox
23+
MAJOR_VERSION=$(swift --version | awk '{for(i=1;i<=NF;i++){if($i ~ /^[0-9]+\.[0-9]+$/){print $i; break}}}' | cut -d '.' -f 1)
2224
fi
2325

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

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

31-
mkdir -p "$PREFIX/bin"
32-
mkdir -p "$LIB_INSTALL_PATH"
33-
cp -f "$BUILD_FOLDER/$TOOL_NAME" "$INSTALL_PATH"
34-
3535
if [[ $MAJOR_VERSION -ge 6 ]]; then
3636
BUILD_FOLDER+="/Modules"
3737
SWIFT_LIB_FILES=($(ls "$BUILD_FOLDER"))
38+
for ARG in "${SWIFT_LIB_FILES[@]}"; do
39+
ARRAY+=("$BUILD_FOLDER/$ARG")
40+
done
3841
fi
3942

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

0 commit comments

Comments
 (0)