feat(swift): add make_local_swift_package.sh to build and patch WorldApp for local development#359
Open
chipp wants to merge 1 commit into
Conversation
…App for local development - add make_local_swift_package.sh to build bedrock-swift and patch WorldApp's Package.swift to use the local build - extract Package.swift into a template to support the refactored build scripts - update local build output path to local_build/bedrock-swift
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a one-shot helper for iOS engineers to build bedrock-swift locally and rewrite WorldApp's Package.swift to point at the local build, and extracts the duplicated Package.swift body shared between local and release flows into a single template consumed by both local_swift.sh and archive_swift.sh.
Changes:
- New
swift/make_local_swift_package.shthat runs the local build andsed-patches any WorldAppPackage.swiftreferencingworldcoin/bedrock-swiftto a local path. - New
swift/Package.swift.templatewith a<binary_target>placeholder, and refactoredlocal_swift.sh/archive_swift.shto render it viaawk. local_swift.shnow writes its output toswift/local_build/bedrock-swift/(one level deeper) so the local package directory matches the remote repo name.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| swift/make_local_swift_package.sh | New helper: builds locally, then sed-patches WorldApp's Package.swift to use the local path. |
| swift/Package.swift.template | Shared manifest template with a <binary_target> placeholder for local vs. release binary targets. |
| swift/local_swift.sh | Changes output dir to local_build/bedrock-swift and generates Package.swift from the template. |
| swift/archive_swift.sh | Renders release Package.swift from the template; release-version comment moved to the end of the file. |
Comment on lines
+21
to
+30
| echo "Building the Bedrock Swift package..." | ||
| bash "$SCRIPT_DIR/local_swift.sh" | ||
|
|
||
| echo "Finding Package.swift files that reference bedrock-swift..." | ||
| PACKAGE_FILES=$(grep -rl "worldcoin/bedrock-swift" "$WORLD_APP_PATH" --include="Package.swift" --exclude-dir=".build" --exclude-dir=".claude" || true) | ||
|
|
||
| if [ -z "$PACKAGE_FILES" ]; then | ||
| echo "Warning: No Package.swift found referencing worldcoin/bedrock-swift in $WORLD_APP_PATH" | ||
| exit 1 | ||
| fi |
|
|
||
| while IFS= read -r pkg_file; do | ||
| echo "Patching $pkg_file..." | ||
| sed -i '' "s|\.package(url: \"https://github.com/worldcoin/bedrock-swift\", exact: \"[^\"]*\")|.package(path: \"$LOCAL_BUILD_PATH\")|" "$pkg_file" |
|
|
||
| while IFS= read -r pkg_file; do | ||
| echo "Patching $pkg_file..." | ||
| sed -i '' "s|\.package(url: \"https://github.com/worldcoin/bedrock-swift\", exact: \"[^\"]*\")|.package(path: \"$LOCAL_BUILD_PATH\")|" "$pkg_file" |
| @@ -0,0 +1,37 @@ | |||
| #!/bin/bash | |||
| set -e | |||
| ] | ||
| ) | ||
| EOF | ||
| echo "// Release version: $RELEASE_VERSION" >> Package.swift |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
make_local_swift_package.sh: one command to build bedrock-swift locally and patch WorldApp'sPackage.swiftto reference the local build instead of the remote releasePackage.swiftinto a shared template (Package.swift.template) so botharchive_swift.shandlocal_swift.shgenerate it consistentlyTest plan
./swift/make_local_swift_package.sh /Path/To/WorldAppand verify WorldApp's Package.swift is patched tolocal_build/bedrock-swift