Skip to content

Test adding a native library to a SwiftPM app without a clean build - #60469

Draft
chrfalch wants to merge 1 commit into
mainfrom
spm-ci-add-lib-incremental
Draft

chrfalch wants to merge 1 commit into
mainfrom
spm-ci-add-lib-incremental

Conversation

@chrfalch

@chrfalch chrfalch commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary:

Tests the fix from #60462, which is now on main.

The SwiftPM new-app CI job builds HelloWorld only once. So it cannot catch the bug that #60462 fixes: a native library added after setup is not compiled on the next build without a clean build.

This PR changes the Debug lane of test-ios-spm-newapp.yml:

  1. After the first SwiftPM build, a new step adds the in-repo library packages/react-native-test-library (apple and common) to HelloWorld.
  2. Build 1 must fail with native modules changed. Build again.
  3. Build 2 must succeed, and the app must contain the library. The step checks this with nm on HelloWorld.debug.dylib.
  4. Build 3 must succeed, and the library must still be there.
  5. The step then removes the library. The later steps (spm deinit and the CocoaPods build) see HelloWorld as before.

Before the library is added, the step writes its Package.swift files. This is the same as a library that ships its own manifest. The step does not use spm scaffold, because that also rewrites the app's autolinked manifest. Build 1 would then already know the library and would not show the error.

New scripts: .github/workflow-scripts/spm-add-lib-incremental.sh and .github/workflow-scripts/spm-scaffold-test-library.js.

Changelog:

[INTERNAL] [ADDED] - Test that a native library added to a SwiftPM app is compiled without a clean build

Test Plan:

I ran this locally on HelloWorld after spm add and one Debug build, with nightly SwiftPM artifacts:

.github/workflow-scripts/spm-add-lib-incremental.sh . HelloWorld.xcodeproj HelloWorld <derived-data>

I did not run the later CocoaPods steps locally after the new step. CI is the first full run.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 2, 2026
The SwiftPM new-app CI job built HelloWorld only once, so it could not
catch a native library that is added after setup and then not compiled
on the next incremental build.

The Debug lane now adds packages/react-native-test-library to HelloWorld
after the first SwiftPM build and builds three more times: build 1 must
fail with "native modules changed. Build again.", builds 2 and 3 must
succeed with the library in the app. The step removes the library again
before the later steps run.
@chrfalch
chrfalch force-pushed the spm-ci-add-lib-incremental branch from 3052471 to 994c101 Compare December 2, 2026 12:53

This branch has not been deployed

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant