From 04579f4e9b41c667f148e72446ce675ae0bea077 Mon Sep 17 00:00:00 2001 From: Franco Meloni Date: Tue, 15 Oct 2024 12:49:41 +0200 Subject: [PATCH] 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 --- .github/workflows/ci.yml | 6 ++++++ Scripts/install.sh | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8fe9292..8bbf56a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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: @@ -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: diff --git a/Scripts/install.sh b/Scripts/install.sh index b38a668c..d50af8e5 100755 --- a/Scripts/install.sh +++ b/Scripts/install.sh @@ -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 || :