From 0c32cfd2dca9c38f1ff13e00c2fa84c6697135b4 Mon Sep 17 00:00:00 2001 From: LEO Yoon-Tsaw Date: Mon, 27 May 2024 09:41:03 -0400 Subject: [PATCH] [CI] save Index/DataStore for periphery skip-build option --- .github/workflows/commit-ci.yml | 4 +--- .github/workflows/pull-request-ci.yml | 2 +- .github/workflows/release-ci.yml | 2 +- Makefile | 17 +++++++++++------ package/make_package | 3 ++- package/sign_app | 6 ++++-- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/commit-ci.yml b/.github/workflows/commit-ci.yml index 828146722..e770200a7 100644 --- a/.github/workflows/commit-ci.yml +++ b/.github/workflows/commit-ci.yml @@ -3,8 +3,6 @@ on: push: branches: - '*' - paths: - - 'sources/**' jobs: build: runs-on: macos-14 @@ -31,7 +29,7 @@ jobs: run: brew install peripheryapp/periphery/periphery - name: Check Unused Code - run: periphery scan + run: periphery scan --skip-build --index-store-path build/Index.noindex/DataStore - name: Upload Squirrel artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/pull-request-ci.yml b/.github/workflows/pull-request-ci.yml index 408d07e88..4ce152efc 100644 --- a/.github/workflows/pull-request-ci.yml +++ b/.github/workflows/pull-request-ci.yml @@ -26,7 +26,7 @@ jobs: run: brew install peripheryapp/periphery/periphery - name: Check Unused Code - run: periphery scan + run: periphery scan --skip-build --index-store-path build/Index.noindex/DataStore - name: Upload Squirrel artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 044fb8637..3929ef525 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -34,7 +34,7 @@ jobs: run: brew install peripheryapp/periphery/periphery - name: Check Unused Code - run: periphery scan + run: periphery scan --skip-build --index-store-path build/Index.noindex/DataStore - name: Build changelog id: release_log diff --git a/Makefile b/Makefile index 1d91f2d01..fc9b7f759 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ install: install-release RIME_BIN_DIR = librime/dist/bin RIME_LIB_DIR = librime/dist/lib +DERIVED_DATA_PATH = build RIME_LIBRARY_FILE_NAME = librime.1.dylib RIME_LIBRARY = lib/$(RIME_LIBRARY_FILE_NAME) @@ -95,13 +96,17 @@ ifdef MACOSX_DEPLOYMENT_TARGET BUILD_SETTINGS += MACOSX_DEPLOYMENT_TARGET="$(MACOSX_DEPLOYMENT_TARGET)" endif +BUILD_SETTINGS += COMPILER_INDEX_STORE_ENABLE=YES + release: $(DEPS_CHECK) + mkdir -p $(DERIVED_DATA_PATH) bash package/add_data_files - xcodebuild -project Squirrel.xcodeproj -configuration Release $(BUILD_SETTINGS) build + xcodebuild -project Squirrel.xcodeproj -configuration Release -scheme Squirrel -derivedDataPath $(DERIVED_DATA_PATH) $(BUILD_SETTINGS) build debug: $(DEPS_CHECK) + mkdir -p $(DERIVED_DATA_PATH) bash package/add_data_files - xcodebuild -project Squirrel.xcodeproj -configuration Debug $(BUILD_SETTINGS) build + xcodebuild -project Squirrel.xcodeproj -configuration Debug -scheme Squirrel -derivedDataPath $(DERIVED_DATA_PATH) $(BUILD_SETTINGS) build .PHONY: sparkle copy-sparkle-framework @@ -127,9 +132,9 @@ clean-sparkle: package: release ifdef DEV_ID - bash package/sign_app $(DEV_ID) + bash package/sign_app "$(DEV_ID)" "$(DERIVED_DATA_PATH)" endif - bash package/make_package + bash package/make_package "$(DERIVED_DATA_PATH)" ifdef DEV_ID productsign --sign "Developer ID Installer: $(DEV_ID)" package/Squirrel.pkg package/Squirrel-signed.pkg rm package/Squirrel.pkg @@ -151,12 +156,12 @@ permission-check: install-debug: debug permission-check rm -rf "$(SQUIRREL_APP_ROOT)" - cp -R build/Debug/Squirrel.app "$(DSTROOT)" + cp -R $(DERIVED_DATA_PATH)/Build/Products/Debug/Squirrel.app "$(DSTROOT)" DSTROOT="$(DSTROOT)" RIME_NO_PREBUILD=1 bash scripts/postinstall install-release: release permission-check rm -rf "$(SQUIRREL_APP_ROOT)" - cp -R build/Release/Squirrel.app "$(DSTROOT)" + cp -R $(DERIVED_DATA_PATH)/Build/Products/Release/Squirrel.app "$(DSTROOT)" DSTROOT="$(DSTROOT)" bash scripts/postinstall .PHONY: clean clean-deps diff --git a/package/make_package b/package/make_package index 9c96ff91d..61ce71b69 100755 --- a/package/make_package +++ b/package/make_package @@ -1,5 +1,6 @@ #!/bin/bash +DERIVED_DATA_PATH=$1 BUNDLE_IDENTIFIER='im.rime.inputmethod.Squirrel' INSTALL_LOCATION='/Library/Input Methods' @@ -8,7 +9,7 @@ source common.sh pkgbuild \ --info PackageInfo \ - --root "${PROJECT_ROOT}/build/Release" \ + --root "${PROJECT_ROOT}/${DERIVED_DATA_PATH}/Build/Products/Release" \ --filter '.*\.swiftmodule$' \ --component-plist Squirrel-component.plist \ --identifier "${BUNDLE_IDENTIFIER}" \ diff --git a/package/sign_app b/package/sign_app index c89f5b31a..ee842821d 100755 --- a/package/sign_app +++ b/package/sign_app @@ -1,9 +1,11 @@ #! /bin/bash # enconding: utf-8 -appDir="build/Release/Squirrel.app" +DEV_ID=$1 +DERIVED_DATA_PATH=$2 +appDir="${DERIVED_DATA_PATH}/Build/Products/Release/Squirrel.app" entitlement="resources/Squirrel.entitlements" -codesign --deep --force --options runtime --timestamp --sign "Developer ID Application: $1" --entitlements "$entitlement" --verbose "$appDir"; +codesign --deep --force --options runtime --timestamp --sign "Developer ID Application: ${DEV_ID}" --entitlements "$entitlement" --verbose "$appDir"; spctl -a -vv "$appDir";