Repository navigation
Conversation
The missing-manifest check scanned every file in a library on disk. A Swift file the podspec never compiles (for example an Expo adapter) marked an Objective-C library as mixed-language, so the build said to opt the library out instead of running `spm scaffold`. The check now reads the same podspec as the scaffolder, expands its source_files from the same root and applies exclude_files. It falls back to the disk scan when there is no podspec or it cannot be read. spm.modules keep the disk scan.
This branch has not been deployed
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:
When a library has no
Package.swift, SwiftPM autolinking stops the build with an error. If the library mixes Swift and Objective-C, the error says to opt the library out. Otherwise, it says to runnpx react-native spm scaffold.To decide, the check scanned every file in the library on disk. A Swift file that the podspec never compiles still counted. Example:
@react-native-google-signin/google-signincompiles onlyios/**/*.{h,m,mm}, but it also shipsexpo/ios/ExpoAdapterGoogleSignIn/GoogleSignInAppDelegate.swift. So the build told users to opt out an Objective-C library thatspm scaffoldcan handle.The scaffolder already decides from the files the podspec compiles. This change makes the autolinker use the same rule:
podspecPathfrom the autolinking config, else the first podspec in the package root.source_filesfrom the package root and removesexclude_files, using the same code as the scaffolder (moved into a sharedpodspecSourceFileshelper).isMixedLanguageSourceList).spm.modules(app-local code, no podspec) keep the disk scan.Changelog:
[IOS] [FIXED] - SwiftPM autolinking no longer reports a library as mixed Swift/Objective-C because of Swift files its podspec does not compile
Test Plan:
New tests in
generate-spm-autolinking-test.js: a library with an Objective-C podspec and a stray Swift file (must say "run spm scaffold"), a podspec that compiles Swift and Objective-C (must say mixed),exclude_filesremoving the only Swift file, a configuredpodspecPathnext to another podspec, a podspec inios/with a nestedsourceDir, and unit tests for the predicate. These failed before the change.Not run locally:
yarn flow-check. My local Flow version did not match the repo's required version, so I rely on CI for Flow.