From a65bb1e03db13dda3ad04b0da41bfc2e14002bfd Mon Sep 17 00:00:00 2001 From: KrishKrosh Date: Sat, 26 Jul 2025 21:38:04 -0400 Subject: [PATCH 1/2] Enhance README with universal binary build instructions and update CI workflow for architecture verification. Adjust Xcode project settings for universal binary support and improve local build script to verify binary architectures. --- .github/workflows/build-and-sign-dmg.yml | 59 ++++++++++++++++-------- README.md | 10 ---- TrackWeight.xcodeproj/project.pbxproj | 7 +++ scripts/test-build-locally.sh | 36 +++++++++++++-- 4 files changed, 78 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build-and-sign-dmg.yml b/.github/workflows/build-and-sign-dmg.yml index 58e36c9..6e675ff 100644 --- a/.github/workflows/build-and-sign-dmg.yml +++ b/.github/workflows/build-and-sign-dmg.yml @@ -62,6 +62,9 @@ jobs: -scheme ${{ env.SCHEME }} \ -configuration ${{ env.CONFIGURATION }} \ -archivePath "$RUNNER_TEMP/${{ env.APP_NAME }}.xcarchive" \ + -destination 'generic/platform=macOS' \ + ARCHS="arm64 x86_64" \ + ONLY_ACTIVE_ARCH=NO \ archive - name: Export App @@ -138,24 +141,49 @@ jobs: echo "✅ Application re-signed successfully" - - name: Verify Code Signatures - if: ${{ env.BUILD_CERTIFICATE_BASE64 != '' }} - env: - BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} + - name: Verify Universal Binary and Code Signatures run: | - echo "🔍 Verifying main application signature..." - codesign --verify --verbose "$RUNNER_TEMP/export/${{ env.APP_NAME }}.app" + echo "đŸ—ī¸ Verifying Universal Binary Architecture..." + APP_BINARY="$RUNNER_TEMP/export/${{ env.APP_NAME }}.app/Contents/MacOS/${{ env.APP_NAME }}" + if [[ -f "$APP_BINARY" ]]; then + echo "📊 Binary architectures:" + lipo -archs "$APP_BINARY" + + if lipo -archs "$APP_BINARY" | grep -q "arm64" && lipo -archs "$APP_BINARY" | grep -q "x86_64"; then + echo "✅ Universal binary confirmed: Contains both ARM64 and x86_64" + else + echo "❌ Warning: Binary may not be universal" + lipo -detailed_info "$APP_BINARY" + fi + fi - echo "🔍 Verifying framework signature..." + # Check framework architecture if it exists FRAMEWORK_PATH="$RUNNER_TEMP/export/${{ env.APP_NAME }}.app/Contents/Frameworks/OpenMultitouchSupportXCF.framework" if [[ -d "$FRAMEWORK_PATH" ]]; then - codesign --verify --verbose "$FRAMEWORK_PATH" + FRAMEWORK_BINARY="$FRAMEWORK_PATH/Versions/A/OpenMultitouchSupportXCF" + if [[ -f "$FRAMEWORK_BINARY" ]]; then + echo "📊 Framework architectures:" + lipo -archs "$FRAMEWORK_BINARY" + fi fi - echo "🔍 Deep verification with online validation..." - codesign --verify --deep --strict --verbose=2 "$RUNNER_TEMP/export/${{ env.APP_NAME }}.app" - - echo "✅ All signature verifications passed" + # Only verify signatures if certificates are available + if [[ -n "${{ secrets.BUILD_CERTIFICATE_BASE64 }}" ]]; then + echo "🔍 Verifying main application signature..." + codesign --verify --verbose "$RUNNER_TEMP/export/${{ env.APP_NAME }}.app" + + echo "🔍 Verifying framework signature..." + if [[ -d "$FRAMEWORK_PATH" ]]; then + codesign --verify --verbose "$FRAMEWORK_PATH" + fi + + echo "🔍 Deep verification with online validation..." + codesign --verify --deep --strict --verbose=2 "$RUNNER_TEMP/export/${{ env.APP_NAME }}.app" + + echo "✅ All signature verifications passed" + else + echo "â„šī¸ Skipping signature verification (no certificates provided)" + fi - name: Notarize App if: ${{ env.BUILD_CERTIFICATE_BASE64 != '' && env.APPLE_ID != '' }} @@ -253,12 +281,6 @@ jobs: Transform your MacBook's trackpad into a precise digital weighing scale! - ## Credits - **Original repository:** https://github.com/KrishKrosh/TrackWeight - **Created by:** Krish Shah (@KrishKrosh) - - This build is from the fork at https://github.com/Rohithzr/TrackWeight - ## Installation 1. Download the DMG file below 2. Open the DMG and drag TrackWeight.app to your Applications folder @@ -274,7 +296,6 @@ jobs: 3. While maintaining finger contact, put your object on the trackpad 4. Apply minimal pressure while maintaining contact to get the weight - For more information, visit the [original repository](https://github.com/KrishKrosh/TrackWeight). files: | ${{ runner.temp }}/${{ steps.version_info.outputs.dmg_name }} draft: false diff --git a/README.md b/README.md index 163f9a8..8aece68 100644 --- a/README.md +++ b/README.md @@ -53,16 +53,6 @@ brew install --cask krishkrosh/apps/trackweight 3. Disable App Sandbox in the project settings (required for trackpad access) 4. Build and run the application -## Automated Builds - -This repository includes a GitHub Actions workflow that automatically builds and packages the application into a signed DMG file. The workflow: - -- Builds the Xcode project using the latest stable Xcode -- Signs the application (if signing certificates are configured) -- Creates a professional DMG with proper attribution -- Uploads the DMG as a release artifact -- Creates GitHub releases for tagged versions - For more information about setting up the build pipeline, see [.github/workflows/README.md](.github/workflows/README.md). ### Calibration Process diff --git a/TrackWeight.xcodeproj/project.pbxproj b/TrackWeight.xcodeproj/project.pbxproj index 50636ea..a89f542 100644 --- a/TrackWeight.xcodeproj/project.pbxproj +++ b/TrackWeight.xcodeproj/project.pbxproj @@ -203,6 +203,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -267,6 +268,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -314,6 +316,7 @@ MACOSX_DEPLOYMENT_TARGET = 13.5; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; }; @@ -322,6 +325,7 @@ 77292A942B931954001CA3F6 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = TrackWeight/TrackWeight.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; @@ -340,6 +344,7 @@ ); MACOSX_DEPLOYMENT_TARGET = 14.6; MARKETING_VERSION = 1.0; + ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.krishkrosh.trackweight; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -351,6 +356,7 @@ 77292A952B931954001CA3F6 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = TrackWeight/TrackWeight.entitlements; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application"; @@ -369,6 +375,7 @@ ); MACOSX_DEPLOYMENT_TARGET = 14.6; MARKETING_VERSION = 1.0; + ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = com.krishkrosh.trackweight; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/scripts/test-build-locally.sh b/scripts/test-build-locally.sh index 5a7c484..8b22170 100755 --- a/scripts/test-build-locally.sh +++ b/scripts/test-build-locally.sh @@ -31,13 +31,16 @@ rm -rf "$BUILD_DIR" mkdir -p "$BUILD_DIR" echo "" -echo "Step 1: Building and Archiving App" -echo "==================================" +echo "Step 1: Building and Archiving App (Universal Binary)" +echo "=====================================================" xcodebuild \ -project TrackWeight.xcodeproj \ -scheme "$SCHEME" \ -configuration "$CONFIGURATION" \ -archivePath "$BUILD_DIR/$APP_NAME.xcarchive" \ + -destination 'generic/platform=macOS' \ + ARCHS="arm64 x86_64" \ + ONLY_ACTIVE_ARCH=NO \ archive echo "" @@ -118,13 +121,36 @@ fi fi echo "" -echo "Step 2.5: Verifying Code Signatures" -echo "===================================" +echo "Step 2.5: Verifying Universal Binary and Code Signatures" +echo "========================================================" +echo "đŸ—ī¸ Verifying Universal Binary Architecture..." +APP_BINARY="$BUILD_DIR/export/$APP_NAME.app/Contents/MacOS/$APP_NAME" +if [[ -f "$APP_BINARY" ]]; then + echo "📊 Binary architectures:" + lipo -archs "$APP_BINARY" + + if lipo -archs "$APP_BINARY" | grep -q "arm64" && lipo -archs "$APP_BINARY" | grep -q "x86_64"; then + echo "✅ Universal binary confirmed: Contains both ARM64 and x86_64" + else + echo "❌ Warning: Binary may not be universal" + lipo -detailed_info "$APP_BINARY" + fi +fi + +# Check framework architecture if it exists +FRAMEWORK_PATH="$BUILD_DIR/export/$APP_NAME.app/Contents/Frameworks/OpenMultitouchSupportXCF.framework" +if [[ -d "$FRAMEWORK_PATH" ]]; then + FRAMEWORK_BINARY="$FRAMEWORK_PATH/Versions/A/OpenMultitouchSupportXCF" + if [[ -f "$FRAMEWORK_BINARY" ]]; then + echo "📊 Framework architectures:" + lipo -archs "$FRAMEWORK_BINARY" + fi +fi + echo "🔍 Verifying main application signature..." codesign --verify --verbose "$BUILD_DIR/export/$APP_NAME.app" || echo "âš ī¸ Main app signature verification failed" echo "🔍 Verifying framework signature..." -FRAMEWORK_PATH="$BUILD_DIR/export/$APP_NAME.app/Contents/Frameworks/OpenMultitouchSupportXCF.framework" if [[ -d "$FRAMEWORK_PATH" ]]; then codesign --verify --verbose "$FRAMEWORK_PATH" || echo "âš ī¸ Framework signature verification failed" fi From fbc780ef6207e7db074de231109d69ed304bd1bb Mon Sep 17 00:00:00 2001 From: KrishKrosh Date: Sat, 26 Jul 2025 21:48:33 -0400 Subject: [PATCH 2/2] Target to macOS 13.0 --- .github/workflows/build-and-sign-dmg.yml | 2 +- README.md | 2 +- TrackWeight.xcodeproj/project.pbxproj | 8 ++++---- TrackWeight/HomeView.swift | 7 +++++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-and-sign-dmg.yml b/.github/workflows/build-and-sign-dmg.yml index 6e675ff..8dee3f8 100644 --- a/.github/workflows/build-and-sign-dmg.yml +++ b/.github/workflows/build-and-sign-dmg.yml @@ -287,7 +287,7 @@ jobs: 3. Run the app and follow the setup instructions ## Requirements - - macOS 13.0 or later + - macOS 13.0 or later (Ventura or newer) - MacBook with Force Touch trackpad (2015 or newer MacBook Pro, 2016 or newer MacBook) ## Usage diff --git a/README.md b/README.md index 8aece68..f362c7f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The key insight is that trackpad pressure events are only generated when there's ## Requirements -- **macOS 13.0+** (for Open Multi-Touch Support library compatibility) +- **macOS 13.0+** (Ventura or later) - **MacBook with Force Touch trackpad** (2015 or newer MacBook Pro, 2016 or newer MacBook) - **App Sandbox disabled** (required for low-level trackpad access) - **Xcode 16.0+** and **Swift 6.0+** (for development) diff --git a/TrackWeight.xcodeproj/project.pbxproj b/TrackWeight.xcodeproj/project.pbxproj index a89f542..a343c4f 100644 --- a/TrackWeight.xcodeproj/project.pbxproj +++ b/TrackWeight.xcodeproj/project.pbxproj @@ -254,7 +254,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MACOSX_DEPLOYMENT_TARGET = 13.5; + MACOSX_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -313,7 +313,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MACOSX_DEPLOYMENT_TARGET = 13.5; + MACOSX_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = NO; @@ -342,7 +342,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 14.6; + MACOSX_DEPLOYMENT_TARGET = 13.0; MARKETING_VERSION = 1.0; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.krishkrosh.trackweight; @@ -373,7 +373,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 14.6; + MACOSX_DEPLOYMENT_TARGET = 13.0; MARKETING_VERSION = 1.0; ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = com.krishkrosh.trackweight; diff --git a/TrackWeight/HomeView.swift b/TrackWeight/HomeView.swift index e7e6890..2a7eff0 100644 --- a/TrackWeight/HomeView.swift +++ b/TrackWeight/HomeView.swift @@ -62,8 +62,11 @@ struct HomeView: View { .padding(.vertical, 20) .background( RoundedRectangle(cornerRadius: 15) - .fill(Color.orange.opacity(0.05)) - .stroke(Color.orange.opacity(0.2), lineWidth: 1) + .foregroundColor(Color.orange.opacity(0.05)) + .overlay( + RoundedRectangle(cornerRadius: 15) + .stroke(Color.orange.opacity(0.2), lineWidth: 1) + ) ) .frame(maxWidth: 500) }