Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scripts/package-swift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ set -euo pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )"

# Ensure cargo is in PATH (rustup proxy may not be available on all CI runners)
if ! command -v cargo &>/dev/null; then
# shellcheck source=/dev/null
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
fi
SWIFT_DIR="$PROJECT_ROOT/swift"
GENERATED_DIR="$SWIFT_DIR/Sources/IDKit/Generated"
IOS_BUILD="$PROJECT_ROOT/ios_build"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Check IDKit Dependencies"
scriptText = "REPO_ROOT=&quot;${SRCROOT}/../../..&quot;&#10;XCFRAMEWORK=&quot;${REPO_ROOT}/IDKitFFI.xcframework&quot;&#10;GENERATED=&quot;${REPO_ROOT}/swift/Sources/IDKit/Generated/idkit_core.swift&quot;&#10;&#10;if [ ! -d &quot;${XCFRAMEWORK}&quot; ] || [ ! -f &quot;${GENERATED}&quot; ]; then&#10; echo &quot;error: IDKit native artifacts not found.&quot; &gt;&amp;2&#10; echo &quot;error: Run the following from the repo root, then build again:&quot; &gt;&amp;2&#10; echo &quot;error: ./scripts/package-swift.sh&quot; &gt;&amp;2&#10; exit 1&#10;fi&#10;">
title = "Build IDKit Dependencies"
scriptText = "REPO_ROOT=&quot;${SRCROOT}/../../..&quot;&#10;XCFRAMEWORK=&quot;${REPO_ROOT}/IDKitFFI.xcframework&quot;&#10;GENERATED=&quot;${REPO_ROOT}/swift/Sources/IDKit/Generated/idkit_core.swift&quot;&#10;RUST_SRC=&quot;${REPO_ROOT}/rust/core/src&quot;&#10;&#10;NEEDS_BUILD=0&#10;&#10;if [ ! -d &quot;${XCFRAMEWORK}&quot; ] || [ ! -f &quot;${GENERATED}&quot; ]; then&#10; NEEDS_BUILD=1&#10;elif [ -n &quot;$(find &quot;${RUST_SRC}&quot; -newer &quot;${GENERATED}&quot; -name &apos;*.rs&apos; -print -quit)&quot; ]; then&#10; NEEDS_BUILD=1&#10;fi&#10;&#10;if [ &quot;${NEEDS_BUILD}&quot; -eq 1 ]; then&#10; echo &quot;note: IDKit native artifacts missing or stale — rebuilding...&quot;&#10; &quot;${REPO_ROOT}/scripts/package-swift.sh&quot;&#10;fi&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
Expand Down
17 changes: 12 additions & 5 deletions swift/Examples/IDKitSampleApp/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,21 @@ schemes:
REPO_ROOT="${SRCROOT}/../../.."
XCFRAMEWORK="${REPO_ROOT}/IDKitFFI.xcframework"
GENERATED="${REPO_ROOT}/swift/Sources/IDKit/Generated/idkit_core.swift"
RUST_SRC="${REPO_ROOT}/rust/core/src"
NEEDS_BUILD=0
if [ ! -d "${XCFRAMEWORK}" ] || [ ! -f "${GENERATED}" ]; then
echo "error: IDKit native artifacts not found." >&2
echo "error: Run the following from the repo root, then build again:" >&2
echo "error: ./scripts/package-swift.sh" >&2
exit 1
NEEDS_BUILD=1
elif [ -n "$(find "${RUST_SRC}" -newer "${GENERATED}" -name '*.rs' -print -quit)" ]; then
NEEDS_BUILD=1
fi
if [ "${NEEDS_BUILD}" -eq 1 ]; then
echo "note: IDKit native artifacts missing or stale — rebuilding..."
"${REPO_ROOT}/scripts/package-swift.sh"
Comment on lines +48 to +50
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move artifact build before SwiftPM resolution

When building the sample app from a fresh checkout or after deleting IDKitFFI.xcframework as described in the test plan, this scheme pre-action is too late to create the artifact: the Xcode project depends on the local Swift package at ../.., and swift/Package.swift declares a binary target at swift/IDKitFFI.xcframework, so Xcode/SwiftPM must resolve that package and validate the binary target before it can run the scheme's build pre-actions. In that missing-artifact state package resolution fails first, so package-swift.sh is never invoked and the advertised auto-build path still does not work.

Useful? React with 👍 / 👎.

fi
name: Check IDKit Dependencies
name: Build IDKit Dependencies
settingsTarget: IDKitSampleApp
run:
config: Debug
Expand Down
Loading