Skip to content

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
mainfrom
vladimirburdukov/refactor-swift-package-scripts-to-use-template-file
Open

feat(swift): add make_local_swift_package.sh to build and patch WorldApp for local development#359
chipp wants to merge 1 commit into
mainfrom
vladimirburdukov/refactor-swift-package-scripts-to-use-template-file

Conversation

@chipp
Copy link
Copy Markdown
Contributor

@chipp chipp commented May 27, 2026

Summary

  • Adds make_local_swift_package.sh: one command to build bedrock-swift locally and patch WorldApp's Package.swift to reference the local build instead of the remote release
  • Supporting changes: extract Package.swift into a shared template (Package.swift.template) so both archive_swift.sh and local_swift.sh generate it consistently

Test plan

  • Run ./swift/make_local_swift_package.sh /Path/To/WorldApp and verify WorldApp's Package.swift is patched to local_build/bedrock-swift
  • Open WorldApp in Xcode, resolve packages, and confirm it picks up the local bedrock build

…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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.sh that runs the local build and sed-patches any WorldApp Package.swift referencing worldcoin/bedrock-swift to a local path.
  • New swift/Package.swift.template with a <binary_target> placeholder, and refactored local_swift.sh / archive_swift.sh to render it via awk.
  • local_swift.sh now writes its output to swift/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
Comment thread swift/archive_swift.sh
]
)
EOF
echo "// Release version: $RELEASE_VERSION" >> Package.swift
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