Skip to content

iOS: bspatch integration - #44

Open
ofalvai wants to merge 1 commit into
android-opt-in-bsdifffrom
ios-bspatch-integration
Open

iOS: bspatch integration#44
ofalvai wants to merge 1 commit into
android-opt-in-bsdifffrom
ios-bspatch-integration

Conversation

@ofalvai

@ofalvai ofalvai commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Context

iOS side of #40: set up tooling and build systems to integrate the hdiffpatch library and our bspatch_bridge wrapper.

No business logic in this PR, that's in #48.

Summary of changes

  • Share C code between iOS and Android at ./shared/: the vendored hdiffpatch library and our thin bspatch_bridge from Android: bspatch integration #40 moves to the shared dir. The vendored bzip2 lib remains at ./android as iOS links against the system library (-lbz2)
  • Tweak the Cocoapods spec file to include the above C code and link against system bzip2. This mirrors CMakeLists.txt from the Android side.
  • Unit tests that call applyPatch() directly from bspatch_bridge.h. The same test cases as in Android: bspatch integration #40
  • CodePush.xcodeproj gets a new test target to run those tests.
  • Now that both platforms have unit tests, add a package.json task for each, and run the new iOS unit tests in CI.

@ofalvai ofalvai changed the title ios bspatch integration iOS: bspatch integration Aug 25, 2026
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch from da09fff to 0985b83 Compare August 25, 2026 10:20
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch from 0985b83 to 53c4592 Compare August 25, 2026 10:23
@ofalvai
ofalvai requested a balanced review from Copilot August 25, 2026 10:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Introduces a shared native BSDIFF40 patching implementation intended for iOS and Android, with an iOS unit-test target and CI coverage.

Changes:

  • Moves the HDiffPatch bridge and vendored sources into shared directories.
  • Adds iOS patch fixtures, unit tests, project configuration, and CI execution.
  • Updates Android to consume the shared implementation.

Reviewed changes

Copilot reviewed 19 out of 39 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
shared/third_party/README.md Documents vendored HDiffPatch sources.
shared/third_party/hdiffpatch/LICENSE Adds upstream licenses.
shared/third_party/hdiffpatch/libHDiffPatch/HPatch/patch.h Adds patch API declarations.
shared/third_party/hdiffpatch/libHDiffPatch/HPatch/patch.c Adds core patch implementation.
shared/third_party/hdiffpatch/libHDiffPatch/HPatch/patch_types.h Adds patch types and stream interfaces.
shared/third_party/hdiffpatch/libHDiffPatch/HPatch/patch_private.h Adds internal patch helpers.
shared/third_party/hdiffpatch/libHDiffPatch/HPatch/hpatch_mt/hpatch_mt.h Adds multithreading interfaces.
shared/third_party/hdiffpatch/libHDiffPatch/HPatch/checksum_plugin.h Adds checksum plugin API.
shared/third_party/hdiffpatch/file_for_patch.h Adds file-stream declarations.
shared/third_party/hdiffpatch/file_for_patch.c Adds file-stream implementation.
shared/third_party/hdiffpatch/dirDiffPatch/dir_patch/dir_patch_types.h Adds directory patch types.
shared/third_party/hdiffpatch/decompress_plugin_demo.h Adds bzip2 decompression support.
shared/third_party/hdiffpatch/bsdiff_wrapper/bspatch_wrapper.h Declares BSDIFF40 patch APIs.
shared/third_party/hdiffpatch/bsdiff_wrapper/bspatch_wrapper.c Implements BSDIFF40 patch application.
shared/diffpatch/bspatch_bridge.h Defines the shared patch bridge API.
shared/diffpatch/bspatch_bridge.c Implements bridge resource and error handling.
package.json Adds native unit-test scripts.
ios/CodePushDiffPatchTests/Fixtures/wrong_old/old.dat Adds mismatched-base fixture.
ios/CodePushDiffPatchTests/Fixtures/identical/old.dat Adds identical-input fixture.
ios/CodePushDiffPatchTests/Fixtures/identical/new.dat Adds identical-output fixture.
ios/CodePushDiffPatchTests/Fixtures/identical/patch.bsdiff Adds identical-data patch fixture.
ios/CodePushDiffPatchTests/Fixtures/empty_old/old.dat Adds empty-base fixture.
ios/CodePushDiffPatchTests/Fixtures/empty_old/new.dat Adds expected literal output.
ios/CodePushDiffPatchTests/Fixtures/empty_old/patch.bsdiff Adds empty-base patch fixture.
ios/CodePushDiffPatchTests/Fixtures/basic/old.dat Adds ordinary base fixture.
ios/CodePushDiffPatchTests/Fixtures/basic/new.dat Adds ordinary expected output.
ios/CodePushDiffPatchTests/Fixtures/basic/patch.bsdiff Adds ordinary patch fixture.
ios/CodePushDiffPatchTests/Fixtures/bad_header/old.dat Adds invalid-header base fixture.
ios/CodePushDiffPatchTests/Fixtures/bad_header/patch.bsdiff Adds malformed patch fixture.
ios/CodePushDiffPatchTests/DiffPatchTests-Bridging-Header.h Exposes the C bridge to Swift tests.
ios/CodePushDiffPatchTests/BSPatchTests.swift Tests patch success and failures.
ios/CodePush.xcodeproj/xcshareddata/xcschemes/CodePushTests.xcscheme Adds the shared test scheme.
ios/CodePush.xcodeproj/project.pbxproj Configures the iOS test target.
CLAUDE.md Documents native unit testing.
android/app/src/main/java/com/microsoft/codepush/react/diffpatch/DiffPatch.kt Updates the bridge path reference.
android/app/src/main/cpp/third_party/README.md Points to shared vendored sources.
android/app/src/main/cpp/CMakeLists.txt Builds Android against shared sources.
.npmignore Excludes iOS test sources from publishing.
.github/workflows/ci-test.yml Runs iOS unit tests and reduces duplicate Android tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +936 to +939
47F66D5AF3C3185E1A3E3B15 /* bspatch_bridge.c in Sources */,
DC983F1C71E0E7131BB343C5 /* libHDiffPatch/HPatch/patch.c in Sources */,
A88F11124A2120A8373A8B61 /* bsdiff_wrapper/bspatch_wrapper.c in Sources */,
0ABCB5DEFE01A7A15552A498 /* file_for_patch.c in Sources */,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This xcodeproj is really ancient and has all sorts of problems. The CodePush target doesn't even compile (missing RN headers). We'll fix this one day, but the important thing for this PR is that the tests are buildable and runnable.

Comment thread ios/CodePush.xcodeproj/project.pbxproj Outdated
13BE3DEC1AC21097009241FE /* CodePush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CodePush.h; path = CodePush/CodePush.h; sourceTree = "<group>"; };
13BE3DED1AC21097009241FE /* CodePush.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePush.m; path = CodePush/CodePush.m; sourceTree = "<group>"; };
1B23B9131BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "RCTConvert+CodePushInstallMode.m"; path = "CodePush/RCTConvert+CodePushInstallMode.m"; sourceTree = "<group>"; };
1B5F6957BD953EE17AF6B18C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS26.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed, turns out it wasn't even necessary to link Foundation.framework -> removed.

Comment thread .github/workflows/ci-test.yml
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch 3 times, most recently from 83c8db3 to 5c775f5 Compare August 25, 2026 14:48
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch from 5c775f5 to 9da1028 Compare August 27, 2026 07:00
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch from 9da1028 to fd52e3c Compare August 27, 2026 07:01
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch from fd52e3c to 56e4ed4 Compare August 27, 2026 07:04
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch from 56e4ed4 to 552c47d Compare August 28, 2026 14:19
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch 2 times, most recently from 8d8890f to d18b97f Compare September 3, 2026 10:48
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch from d18b97f to 2b0e976 Compare September 8, 2026 10:19
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch from 2b0e976 to 1dd0e18 Compare September 8, 2026 10:21
@ofalvai
ofalvai marked this pull request as ready for review September 8, 2026 10:47
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch from 1dd0e18 to 58deb74 Compare September 9, 2026 06:36
@ofalvai
ofalvai removed this pull request from stack #41 September 9, 2026 06:38
@ofalvai
ofalvai added this pull request to stack #57 September 9, 2026 06:42
@ofalvai
ofalvai force-pushed the ios-bspatch-integration branch from 58deb74 to 8de36a5 Compare September 9, 2026 10:34
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