Skip to content

fix: add macOS desktop build support#599

Open
srishtiii28 wants to merge 3 commits intoCCExtractor:mainfrom
srishtiii28:fix/macos-build-support
Open

fix: add macOS desktop build support#599
srishtiii28 wants to merge 3 commits intoCCExtractor:mainfrom
srishtiii28:fix/macos-build-support

Conversation

@srishtiii28
Copy link

@srishtiii28 srishtiii28 commented Feb 22, 2026

Problem

The app crashed immediately on macOS showing a black screen. Three issues were identified and fixed:

  1. tc_helper.framework not built or bundled for macOS — the app uses a Rust native library via flutter_rust_bridge. It was never compiled for macOS (aarch64-apple-darwin), so dlopen failed at startup with an unhandled exception.

  2. HomeWidget.setAppGroupId crash on macOSHomeWidget is an iOS/Android-only plugin. Calling setAppGroupId on macOS threw MissingPluginException before the UI could render.

  3. Pod deployment target mismatch warning — pod targets were using MACOSX_DEPLOYMENT_TARGET = 10.11 despite the platform being set to 10.15, producing warnings on every build.

Changes

macos/Podfile

Added MACOSX_DEPLOYMENT_TARGET = '10.15' enforcement in post_install hook for all pod targets.

macos/Frameworks/tc_helper.framework/tc_helper

Pre-built Rust tc_helper dylib for aarch64-apple-darwin, packaged as a .framework.

macos/Runner.xcodeproj/project.pbxproj

Added Embed Rust Framework shell script build phase that:

  • Auto-compiles the Rust library via cargo build if the binary is missing or source has changed
  • Embeds tc_helper.framework into Contents/Frameworks/ of the app bundle at build time

lib/app/utils/app_settings/app_settings.dart

Guarded HomeWidget.setAppGroupId with Platform.isIOS || Platform.isAndroid to skip the call on macOS.

Test environment

  • macOS 15.5 (Apple Silicon)
  • Flutter 3.41.2 stable
  • Xcode 16.4
  • Rust 1.93.0, target aarch64-apple-darwin

Result

App builds cleanly (flutter build macos) and renders UI correctly on macOS.

Summary by CodeRabbit

  • Requirements

    • macOS deployment target updated to version 10.15 or later.
  • New Features

    • Added app links support for macOS.
    • Integrated native framework for enhanced app functionality.
  • Improvements

    • Optimized platform-specific initialization logic.

@SGI-CAPP-AT2
Copy link
Collaborator

SGI-CAPP-AT2 commented Feb 22, 2026 via email

@srishtiii28
Copy link
Author

Binary files should be eliminated with some kind of automated build script Adding binary files increase repo size

On Sun, Feb 22, 2026, 2:18 PM Srishti Dutta @.> wrote: Problem The app crashed immediately on macOS showing a black screen. Three issues were identified and fixed: 1. tc_helper.framework not built or bundled for macOS — the app uses a Rust native library via flutter_rust_bridge. It was never compiled for macOS (aarch64-apple-darwin), so dlopen failed at startup with an unhandled exception. 2. HomeWidget.setAppGroupId crash on macOS — HomeWidget is an iOS/Android-only plugin. Calling setAppGroupId on macOS threw MissingPluginException before the UI could render. 3. Pod deployment target mismatch warning — pod targets were using MACOSX_DEPLOYMENT_TARGET = 10.11 despite the platform being set to 10.15, producing warnings on every build. Changes macos/Podfile Added MACOSX_DEPLOYMENT_TARGET = '10.15' enforcement in post_install hook for all pod targets. macos/Frameworks/tc_helper.framework/tc_helper Pre-built Rust tc_helper dylib for aarch64-apple-darwin, packaged as a .framework. macos/Runner.xcodeproj/project.pbxproj Added Embed Rust Framework shell script build phase that: - Auto-compiles the Rust library via cargo build if the binary is missing or source has changed - Embeds tc_helper.framework into Contents/Frameworks/ of the app bundle at build time lib/app/utils/app_settings/app_settings.dart Guarded HomeWidget.setAppGroupId with Platform.isIOS || Platform.isAndroid to skip the call on macOS. Test environment - macOS 15.5 (Apple Silicon) - Flutter 3.41.2 stable - Xcode 16.4 - Rust 1.93.0, target aarch64-apple-darwin Result App builds cleanly (flutter build macos) and renders UI correctly on macOS. ------------------------------ You can view, comment on, or merge this pull request online at: #599 Commit Summary - 4fa167a <4fa167a> enforced MACOSX_DEPLOYMENT_TARGET 10.15 for all pod targets - 5a406c9 <5a406c9> added Rust tc_helper framework for macOS and Xcode build phase - b71efce <b71efce> guarded HomeWidget.setAppGroupId behind mobile platform check File Changes (7 files https://github.com/CCExtractor/taskwarrior-flutter/pull/599/files) - M lib/app/utils/app_settings/app_settings.dart https://github.com/CCExtractor/taskwarrior-flutter/pull/599/files#diff-807e9bff176cec55cd0877f311f9f11d29e2348fb92b7e5f116223a8635b2547 (6) - M macos/Flutter/GeneratedPluginRegistrant.swift https://github.com/CCExtractor/taskwarrior-flutter/pull/599/files#diff-e0a0e103075365af1fb906fa24889fc5ed61c2020ef2efeb23fe020123abc325 (2) - A macos/Frameworks/tc_helper.framework/tc_helper https://github.com/CCExtractor/taskwarrior-flutter/pull/599/files#diff-360346ade61d7c914c1d84307dad225d71f68e2564a0a950dbfdd3c330aa8fc5 (0) - M macos/Podfile https://github.com/CCExtractor/taskwarrior-flutter/pull/599/files#diff-f884afd426938fe6ea5d1b0089a5feddfc356659592f068b3b28cde8e7bbfd61 (5) - M macos/Podfile.lock https://github.com/CCExtractor/taskwarrior-flutter/pull/599/files#diff-c040557dce7feadea382f3371962ee256cf2d504db3e0fcaceb8d0566a8db1ee (18) - M macos/Runner.xcodeproj/project.pbxproj https://github.com/CCExtractor/taskwarrior-flutter/pull/599/files#diff-ec40d5406d2e5b54c265f64285bf1f073febb06b92a906239f8905a6244e68ef (27) - M pubspec.lock https://github.com/CCExtractor/taskwarrior-flutter/pull/599/files#diff-e125d55a387d4b24048735f9ca6508c4e860f5ca1f3242edfd9df27e7d8a7af0 (108) Patch Links: - https://github.com/CCExtractor/taskwarrior-flutter/pull/599.patch - https://github.com/CCExtractor/taskwarrior-flutter/pull/599.diff — Reply to this email directly, view it on GitHub <#599>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASMETS2YLFL3LCUN76EL3LT4NFUNJAVCNFSM6AAAAACV3X4KJCVHI2DSMVQWIX3LMV43ASLTON2WKOZTHE3TGOJUHE4TMMY . You are receiving this because you are subscribed to this thread.Message ID: @.>

Sure, I will work on that

@srishtiii28
Copy link
Author

@SGI-CAPP-AT2 updated it

Added post_install hook in Podfile to set MACOSX_DEPLOYMENT_TARGET
to 10.15 for every pod target, eliminating the deployment target
mismatch warning during macOS builds.
Added 'Build and Embed Rust Framework' shell script build phase to the
Xcode project that compiles the tc_helper Rust library from source on
every build using cargo and embeds it into the app bundle.

- Runs cargo build --release --target aarch64-apple-darwin
- Packages output as tc_helper.framework and copies to app bundle
- Errors with a clear message if Rust/cargo is not installed
- Added Frameworks/tc_helper.framework/tc_helper to .gitignore so
  the compiled binary is never committed
HomeWidget.setAppGroupId is only available on iOS and Android.
Calling it on macOS threw MissingPluginException, crashing the app
before the UI could render.

Added a Platform.isIOS || Platform.isAndroid guard so the call is
skipped on macOS and other desktop platforms.
@srishtiii28 srishtiii28 force-pushed the fix/macos-build-support branch from 4bd2cad to b40f0c6 Compare March 4, 2026 07:49
@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

📝 Walkthrough

Walkthrough

Changes introduce Rust framework integration for macOS builds, update platform deployment target from 10.14 to 10.15, register the app_links plugin on macOS, and add platform-specific guards to Dart initialization code.

Changes

Cohort / File(s) Summary
macOS Deployment Target Updates
macos/Podfile, macos/Runner.xcodeproj/project.pbxproj
Bump macOS platform version from 10.14 to 10.15. Adds post_install hook in Podfile to set deployment target for all build configurations.
Rust Framework Integration
macos/Runner.xcodeproj/project.pbxproj, macos/.gitignore
Adds new "Build and Embed Rust Framework" shell script build phase that compiles Rust dylib for aarch64-apple-darwin, embeds it in tc_helper.framework, updates install-name, and codesigns the result. Gitignore entry added for auto-generated framework binary.
Plugin Registration
macos/Flutter/GeneratedPluginRegistrant.swift
Registers AppLinksMacosPlugin with import and plugin registration call in generated plugin registry.
Platform-Specific Initialization
lib/app/utils/app_settings/app_settings.dart
Adds platform check guard (dart:io import) to conditionally execute HomeWidget.setAppGroupId() only on iOS or Android platforms.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A Rust framework hopped into the macOS nest,
With Xcode build phases putting code to the test,
Plugin registrations align in perfect harmony,
Platform guards ensure each system runs free,
From Podfile to framework, the setup's quite grand! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: add macOS desktop build support' directly and clearly summarizes the main objective of the PR: enabling macOS desktop builds for the app.
Description check ✅ Passed The PR description comprehensively covers the problem statement, detailed changes, test environment, and results. All critical information is present and well-organized.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
macos/Runner.xcodeproj/project.pbxproj (1)

369-382: Build phase is configured to run every build.

alwaysOutOfDate = 1 with empty inputs forces reruns and adds avoidable build latency for local iteration.

♻️ Suggested optimization
- alwaysOutOfDate = 1;
+ alwaysOutOfDate = 0;
@@
- inputPaths = (
- );
+ inputPaths = (
+   "$(SRCROOT)/../rust/Cargo.toml",
+   "$(SRCROOT)/../rust/Cargo.lock",
+ );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@macos/Runner.xcodeproj/project.pbxproj` around lines 369 - 382, The "Build
and Embed Rust Framework" run phase is forced to rerun every build because
alwaysOutOfDate = 1 and there are no declared inputs; change this by removing or
setting alwaysOutOfDate to 0 and/or add proper input paths or inputFileListPaths
that represent the Rust framework artifacts so Xcode can detect up-to-date
state; update the run phase identified by the name "Build and Embed Rust
Framework" (and adjust inputPaths, inputFileListPaths, or
outputFileListPaths/outputPaths as needed) so the build phase only executes when
its inputs actually change.
lib/app/utils/app_settings/app_settings.dart (1)

1-1: Replace dart:io import with Flutter-aware platform detection to prevent web-build incompatibility.

The Platform.isIOS || Platform.isAndroid check will fail if this app is built for web. Use kIsWeb and defaultTargetPlatform instead to maintain platform-specific behavior without the direct dart:io dependency.

♻️ Suggested change
-import 'dart:io';
+import 'package:flutter/foundation.dart';
@@
-    if (Platform.isIOS || Platform.isAndroid) {
+    if (!kIsWeb &&
+        (defaultTargetPlatform == TargetPlatform.iOS ||
+            defaultTargetPlatform == TargetPlatform.android)) {
       await HomeWidget.setAppGroupId("group.taskwarrior");
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/app/utils/app_settings/app_settings.dart` at line 1, Replace the dart:io
import and any usage of Platform.isIOS/Platform.isAndroid in app_settings.dart
with Flutter-aware checks: remove "import 'dart:io';", import
"package:flutter/foundation.dart" and use kIsWeb to short-circuit web builds,
and use defaultTargetPlatform == TargetPlatform.iOS / TargetPlatform.android
where you previously used Platform.isIOS / Platform.isAndroid; update any
functions or conditionals referencing Platform to use these symbols (kIsWeb,
defaultTargetPlatform, TargetPlatform) to avoid web build failures.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@macos/Runner.xcodeproj/project.pbxproj`:
- Around line 367-386: The build script in the PBXShellScriptBuildPhase named
"Build and Embed Rust Framework" hardcodes the Rust target triple to
aarch64-apple-darwin (RUST_LIB and cargo build) which will fail on Intel macs;
change the shellScript to detect the build architecture (prefer $ARCHS if
available otherwise fall back to uname -m), map that to a TARGET_TRIPLE (e.g.,
aarch64-apple-darwin for arm64, x86_64-apple-darwin for Intel), replace the
hardcoded aarch64-apple-darwin occurrences with $TARGET_TRIPLE (RUST_LIB path,
rustup target add, and cargo build commands), and ensure RUST_DIR, FRAMEWORK_DIR
and FRAMEWORK_DST logic remains the same so the correct dylib is copied and
codesigned for the detected architecture.

---

Nitpick comments:
In `@lib/app/utils/app_settings/app_settings.dart`:
- Line 1: Replace the dart:io import and any usage of
Platform.isIOS/Platform.isAndroid in app_settings.dart with Flutter-aware
checks: remove "import 'dart:io';", import "package:flutter/foundation.dart" and
use kIsWeb to short-circuit web builds, and use defaultTargetPlatform ==
TargetPlatform.iOS / TargetPlatform.android where you previously used
Platform.isIOS / Platform.isAndroid; update any functions or conditionals
referencing Platform to use these symbols (kIsWeb, defaultTargetPlatform,
TargetPlatform) to avoid web build failures.

In `@macos/Runner.xcodeproj/project.pbxproj`:
- Around line 369-382: The "Build and Embed Rust Framework" run phase is forced
to rerun every build because alwaysOutOfDate = 1 and there are no declared
inputs; change this by removing or setting alwaysOutOfDate to 0 and/or add
proper input paths or inputFileListPaths that represent the Rust framework
artifacts so Xcode can detect up-to-date state; update the run phase identified
by the name "Build and Embed Rust Framework" (and adjust inputPaths,
inputFileListPaths, or outputFileListPaths/outputPaths as needed) so the build
phase only executes when its inputs actually change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e93caa70-1629-441b-88bb-bb48d16adac3

📥 Commits

Reviewing files that changed from the base of the PR and between 66aef29 and b40f0c6.

⛔ Files ignored due to path filters (2)
  • macos/Podfile.lock is excluded by !**/*.lock
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • lib/app/utils/app_settings/app_settings.dart
  • macos/.gitignore
  • macos/Flutter/GeneratedPluginRegistrant.swift
  • macos/Podfile
  • macos/Runner.xcodeproj/project.pbxproj

Comment on lines +367 to +386
B47EAE0DA7514E2B9140D50B /* Build and Embed Rust Framework */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Build and Embed Rust Framework";
outputFileListPaths = (
);
outputPaths = (
"$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/tc_helper.framework/tc_helper",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nRUST_DIR=\"$SRCROOT/../rust\"\nFRAMEWORK_DIR=\"$SRCROOT/Frameworks/tc_helper.framework\"\nRUST_LIB=\"$RUST_DIR/target/aarch64-apple-darwin/release/libtc_helper.dylib\"\n\nexport PATH=\"$HOME/.cargo/bin:$PATH\"\n\nif ! command -v cargo &>/dev/null; then\n echo 'error: cargo not found. Install Rust from https://rustup.rs' >&2\n exit 1\nfi\n\nrustup target add aarch64-apple-darwin 2>/dev/null || true\ncargo build --release --target aarch64-apple-darwin --manifest-path \"$RUST_DIR/Cargo.toml\"\n\nmkdir -p \"$FRAMEWORK_DIR\"\ncp -f \"$RUST_LIB\" \"$FRAMEWORK_DIR/tc_helper\"\ninstall_name_tool -id \"@rpath/tc_helper.framework/tc_helper\" \"$FRAMEWORK_DIR/tc_helper\"\n\nFRAMEWORK_DST=\"$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/tc_helper.framework\"\nmkdir -p \"$FRAMEWORK_DST\"\ncp -f \"$FRAMEWORK_DIR/tc_helper\" \"$FRAMEWORK_DST/tc_helper\"\ncodesign --force --sign \"$EXPANDED_CODE_SIGN_IDENTITY\" --preserve-metadata=identifier,entitlements \"$FRAMEWORK_DST/tc_helper\" 2>/dev/null || true\n";
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify hardcoded Rust target and whether Intel macOS builds are expected

echo "=== Searching for arch references in xcodeproj ==="
rg -n "aarch64-apple-darwin|x86_64-apple-darwin|NATIVE_ARCH|CURRENT_ARCH" macos/Runner.xcodeproj/project.pbxproj | head -20

echo -e "\n=== Checking GitHub workflows for macOS builds ==="
if [ -d .github/workflows ]; then
  rg -n "macos|x86_64|arm64|runs-on" .github/workflows -A 2 -B 2 | head -50
else
  echo "No .github/workflows directory found"
fi

echo -e "\n=== Checking project.pbxproj for ARCHS or VALID_ARCHS settings ==="
rg -n "ARCHS|VALID_ARCHS|Build and Embed Rust" macos/Runner.xcodeproj/project.pbxproj | head -30

Repository: CCExtractor/taskwarrior-flutter

Length of output: 2235


🏁 Script executed:

#!/bin/bash
# Check project documentation for macOS architecture support

echo "=== Checking README for architecture mentions ==="
find . -maxdepth 2 -name "README*" -o -name "readme*" | xargs cat 2>/dev/null | grep -i "macos\|intel\|x86\|arm64\|aarch64\|architecture" -A 2 -B 2 | head -30

echo -e "\n=== Checking flutter/pubspec.yaml for platform config ==="
if [ -f pubspec.yaml ]; then
  cat pubspec.yaml | grep -i "macos\|platform" -A 5 -B 5
fi

echo -e "\n=== Checking macos/Runner.xcodeproj for build settings ==="
rg -n "ARCHS|SUPPORTED_PLATFORMS|VALID_ARCHS" macos/Runner.xcodeproj/project.pbxproj | head -20

echo -e "\n=== Check if Rust Cargo.toml mentions target support ==="
if [ -f rust/Cargo.toml ]; then
  echo "=== Rust/Cargo.toml content ==="
  cat rust/Cargo.toml | head -50
fi

echo -e "\n=== Check if any build scripts mention multi-arch ==="
find . -name "*.sh" -o -name "*.py" | xargs grep -l "aarch64\|x86_64\|universal" 2>/dev/null

Repository: CCExtractor/taskwarrior-flutter

Length of output: 1307


Rust framework build is hardcoded to arm64 and will break Intel macOS builds.

The script always targets aarch64-apple-darwin without checking the build environment's architecture. On Intel Macs or when building for x86_64, this will attempt to load an ARM64 dylib and fail. The Xcode project has no ARCHS or VALID_ARCHS settings to override this hardcoding. While no macOS CI is currently configured, developers on Intel Macs attempting local builds will encounter failures.

🐛 Suggested fix (arch-aware target selection)
- RUST_LIB="$RUST_DIR/target/aarch64-apple-darwin/release/libtc_helper.dylib"
+ case "${NATIVE_ARCH_ACTUAL:-$CURRENT_ARCH}" in
+   arm64)  RUST_TARGET="aarch64-apple-darwin" ;;
+   x86_64) RUST_TARGET="x86_64-apple-darwin" ;;
+   *)
+     echo "error: unsupported macOS arch: ${NATIVE_ARCH_ACTUAL:-$CURRENT_ARCH}" >&2
+     exit 1
+     ;;
+ esac
+ RUST_LIB="$RUST_DIR/target/$RUST_TARGET/release/libtc_helper.dylib"
@@
- rustup target add aarch64-apple-darwin 2>/dev/null || true
- cargo build --release --target aarch64-apple-darwin --manifest-path "$RUST_DIR/Cargo.toml"
+ rustup target add "$RUST_TARGET" 2>/dev/null || true
+ cargo build --release --target "$RUST_TARGET" --manifest-path "$RUST_DIR/Cargo.toml"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
B47EAE0DA7514E2B9140D50B /* Build and Embed Rust Framework */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Build and Embed Rust Framework";
outputFileListPaths = (
);
outputPaths = (
"$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/tc_helper.framework/tc_helper",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nRUST_DIR=\"$SRCROOT/../rust\"\nFRAMEWORK_DIR=\"$SRCROOT/Frameworks/tc_helper.framework\"\nRUST_LIB=\"$RUST_DIR/target/aarch64-apple-darwin/release/libtc_helper.dylib\"\n\nexport PATH=\"$HOME/.cargo/bin:$PATH\"\n\nif ! command -v cargo &>/dev/null; then\n echo 'error: cargo not found. Install Rust from https://rustup.rs' >&2\n exit 1\nfi\n\nrustup target add aarch64-apple-darwin 2>/dev/null || true\ncargo build --release --target aarch64-apple-darwin --manifest-path \"$RUST_DIR/Cargo.toml\"\n\nmkdir -p \"$FRAMEWORK_DIR\"\ncp -f \"$RUST_LIB\" \"$FRAMEWORK_DIR/tc_helper\"\ninstall_name_tool -id \"@rpath/tc_helper.framework/tc_helper\" \"$FRAMEWORK_DIR/tc_helper\"\n\nFRAMEWORK_DST=\"$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/tc_helper.framework\"\nmkdir -p \"$FRAMEWORK_DST\"\ncp -f \"$FRAMEWORK_DIR/tc_helper\" \"$FRAMEWORK_DST/tc_helper\"\ncodesign --force --sign \"$EXPANDED_CODE_SIGN_IDENTITY\" --preserve-metadata=identifier,entitlements \"$FRAMEWORK_DST/tc_helper\" 2>/dev/null || true\n";
};
B47EAE0DA7514E2B9140D50B /* Build and Embed Rust Framework */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Build and Embed Rust Framework";
outputFileListPaths = (
);
outputPaths = (
"$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/tc_helper.framework/tc_helper",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nRUST_DIR=\"$SRCROOT/../rust\"\nFRAMEWORK_DIR=\"$SRCROOT/Frameworks/tc_helper.framework\"\n\ncase \"${NATIVE_ARCH_ACTUAL:-$CURRENT_ARCH}\" in\n arm64) RUST_TARGET=\"aarch64-apple-darwin\" ;;\n x86_64) RUST_TARGET=\"x86_64-apple-darwin\" ;;\n *)\n echo \"error: unsupported macOS arch: ${NATIVE_ARCH_ACTUAL:-$CURRENT_ARCH}\" >&2\n exit 1\n ;;\nesac\n\nRUST_LIB=\"$RUST_DIR/target/$RUST_TARGET/release/libtc_helper.dylib\"\n\nexport PATH=\"$HOME/.cargo/bin:$PATH\"\n\nif ! command -v cargo &>/dev/null; then\n echo 'error: cargo not found. Install Rust from https://rustup.rs' >&2\n exit 1\nfi\n\nrustup target add \"$RUST_TARGET\" 2>/dev/null || true\ncargo build --release --target \"$RUST_TARGET\" --manifest-path \"$RUST_DIR/Cargo.toml\"\n\nmkdir -p \"$FRAMEWORK_DIR\"\ncp -f \"$RUST_LIB\" \"$FRAMEWORK_DIR/tc_helper\"\ninstall_name_tool -id \"@rpath/tc_helper.framework/tc_helper\" \"$FRAMEWORK_DIR/tc_helper\"\n\nFRAMEWORK_DST=\"$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/tc_helper.framework\"\nmkdir -p \"$FRAMEWORK_DST\"\ncp -f \"$FRAMEWORK_DIR/tc_helper\" \"$FRAMEWORK_DST/tc_helper\"\ncodesign --force --sign \"$EXPANDED_CODE_SIGN_IDENTITY\" --preserve-metadata=identifier,entitlements \"$FRAMEWORK_DST/tc_helper\" 2>/dev/null || true\n";
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@macos/Runner.xcodeproj/project.pbxproj` around lines 367 - 386, The build
script in the PBXShellScriptBuildPhase named "Build and Embed Rust Framework"
hardcodes the Rust target triple to aarch64-apple-darwin (RUST_LIB and cargo
build) which will fail on Intel macs; change the shellScript to detect the build
architecture (prefer $ARCHS if available otherwise fall back to uname -m), map
that to a TARGET_TRIPLE (e.g., aarch64-apple-darwin for arm64,
x86_64-apple-darwin for Intel), replace the hardcoded aarch64-apple-darwin
occurrences with $TARGET_TRIPLE (RUST_LIB path, rustup target add, and cargo
build commands), and ensure RUST_DIR, FRAMEWORK_DIR and FRAMEWORK_DST logic
remains the same so the correct dylib is copied and codesigned for the detected
architecture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants