Repository navigation
Avoid SwiftPM umbrella header layout errors in spm scaffold - #60283
chiroro-jr wants to merge 1 commit into
Conversation
|
Hi @chiroro-jr! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary:
When
react-native spm scaffoldinferspublicHeadersPathfrom a podspec's source directory (for example"apple"forreact-native-gesture-handleror"ios"for@react-native-masked-view/masked-view), SwiftPM treats<publicHeadersPath>/<SwiftName>.h(when no explicitmodule.modulemapis present) as an umbrella header and fails package resolution whenever any subdirectory sits next to it (such asapple/Handlers/orios/RNCMaskedView.xcodeproj/):This change detects when the inferred
publicHeadersPathcontains<SwiftName>.halongside subdirectories (and no custommodule.modulemap), keeps the original directory inheaderSearchPaths, and reuses the scaffolder's existinginclude/<SwiftName>/shim mirror (publicHeadersPath: "include") so SwiftPM loads a valid module layout and dependents can#import <SwiftName/Header.h>.SCAFFOLDER_VERSIONis bumped from22to23so previously scaffolded manifests regenerate automatically.Changelog:
[IOS] [FIXED] - Avoid SwiftPM umbrella-header-with-subdirectories layout errors in
react-native spm scaffoldTest Plan:
invalid header layouterror on a target withapple/MyLib.hbesideapple/Sub/, and verifiedswift buildsucceeds withpublicHeadersPath: "include"andinclude/MyLib/MyLib.hshim headers.packages/react-native/scripts/spm/__tests__/scaffold-package-swift-test.jscovering:publicHeadersPathto"include"when<SwiftName>.hsits next to subdirectories,publicHeadersPathwhen a custommodule.modulemapexists,include/<SwiftName>/<SwiftName>.hshims inscaffoldPackageSwiftForDep../node_modules/.bin/jest packages/react-native/scripts/spm/__tests__/(25 suites, 1264 tests passing)./node_modules/.bin/flow check-contents packages/react-native/scripts/spm/scaffold-package-swift.js < packages/react-native/scripts/spm/scaffold-package-swift.js(No errors)./node_modules/.bin/eslintand./node_modules/.bin/prettier --checkon both modified files (clean)