bugsnag / bugsnag-react-native

Error monitoring and reporting tool for native exceptions and JS errors in React Native apps
https://docs.bugsnag.com/platforms/react-native
MIT License
370 stars 121 forks source link

Fix syntax error in Podspec when specifying multiple public_header_paths #453

Closed rahul-malik closed 4 years ago

rahul-malik commented 4 years ago

Goal

Address issues preventing Cocoapods integration which regressed

Changeset

The current podspec fails linting

$ pod spec lint --fail-fast BugsnagReactNative.podspec

 -> BugsnagReactNative (2.23.7)
    - ERROR | [iOS] file patterns: The `public_header_files` pattern did not match any file.
    - ERROR | [iOS] unknown: Encountered an unknown error (Could not find a `ios` simulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least one `ios` simulator listed or otherwise add one.) during validation.

Analyzed 1 podspec.

[!] The spec did not pass validation, due to 2 errors.

[!] React has been deprecated

Changed

We need to change the multiple paths in s.public_header_files to be comma-separated vs using the concatenation (+) operator which combines the multiple paths into a single path which matches no files in the repository.

Tests

Re-ran linting to confirm public_header_paths issue was resolved

$ pod spec lint --fail-fast BugsnagReactNative.podspec

 -> BugsnagReactNative (2.23.7)
    - ERROR | [iOS] unknown: Encountered an unknown error (Could not find a `ios` simulator (valid values: ). Ensure that Xcode -> Window -> Devices has at least one `ios` simulator listed or otherwise add one.) during validation.

Analyzed 1 podspec.

[!] The spec did not pass validation, due to 1 error.

[!] React has been deprecated

Discussion

Alternative Approaches

N/A

Outstanding Questions

Linked issues

N/A

Review

For the submitter, initial self-review:

For the pull request reviewer(s), this changeset has been reviewed for:

jparise commented 4 years ago

Maybe pod spec lint could be added to the CI checks, too.

xljones commented 4 years ago

Hey @rahul-malik, thanks for the PR 👍 We shall review when priorities allow!

tomlongridge commented 4 years ago

@rahul-malik - I don't believe this change works as expected, despite the lint check.

If you run the script at test/test-react-native-pod-build.sh with the updated BugsnagReactNative.podspec, it builds however if you attempt to import these headers in the AppDelegate (as per the online docs) then it seems to only find files from the first element of the public_header_files array (from what I can tell):

#import <BugsnagReactNative/BugsnagReactNative.h>
#import "BugsnagConfiguration.h"

I've been unable to find a syntax, other than a single string, that works. Interestingly the examples in the PodSpec DSL docs only show a single string (unlike source_files): https://www.rubydoc.info/github/CocoaPods/Core/master/Pod/Specification/DSL#public_header_files=-instance_method.

johnkiely1 commented 4 years ago

Hi @rahul-malik

Closing this as a fix is in the latest release. This fix was first introduced in v2.23.8.