Skip to content

podspec: modules/objc/**/* glob without extension filter pulls non-source files into the framework build #34

Description

@zhe-qi

Summary

In react-native-chat-sdk.podspec, the third entry of s.source_files uses a glob without an extension filter:

s.source_files = ['ios/**/*.{h,m,mm}', 'modules/cpp/**/*.{h,cpp,mm}', 'modules/objc/**/*']

Because 'modules/objc/**/*' matches everything (including modules/objc/README.md and other non-source files), CocoaPods ends up feeding non-source files into the framework build.

Affected versions

  • react-native-chat-sdk 1.15.0 (latest at the time of writing)
  • The same line exists on the current dev branch.

Symptom

The behavior depends on the consumer's React Native / CocoaPods setup, especially when use_frameworks! :linkage => :static is enabled:

  • Expo SDK 55 / RN 0.83.x: pod install succeeds but emits a warning about non-source files being matched by source_files for react-native-chat-sdk.
  • Expo SDK 56 / RN 0.85.x: this is reported to escalate into a hard build failure (the toolchain treats the README/non-source matches as an error rather than a warning).

Either way, the underlying cause is the same.

Suggested fix

Align the third glob with the same extension whitelist already used by the first two entries:

- s.source_files = ['ios/**/*.{h,m,mm}', 'modules/cpp/**/*.{h,cpp,mm}', 'modules/objc/**/*']
+ s.source_files = ['ios/**/*.{h,m,mm}', 'modules/cpp/**/*.{h,cpp,mm}', 'modules/objc/**/*.{h,m,mm}']

Why this is safe

  • Every file currently shipped under modules/objc/ (excluding flutter/, which is already removed via s.exclude_files) has a .h, .m, or .mm extension — same set used by ios/**/*.{h,m,mm}.
  • No ObjC source is dropped; only README.md and similar non-source artifacts are excluded from the framework's source set.
  • s.exclude_files = [..., 'modules/objc/flutter/**/*'] continues to work unchanged.

Workaround

For now, downstream projects (such as Expo apps using useFrameworks: \"static\" + buildReactNativeFromSource: true) are patching the podspec via patch-package / pnpm patch to apply the diff above. It would be great if this could land upstream so that workaround is no longer needed.

Happy to send a PR if that helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions