Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Incorrect source_files path in Podspec #37

Closed
wants to merge 1 commit into from

Conversation

phil-flyclops
Copy link
Contributor

The file glob was set up such that it would look for ios m and h
files in the root directory instead of the ios directory.

The file glob was set up such that it would look for ios m and h
files in the root directory instead of the ios directory.
@zoontek
Copy link
Owner

zoontek commented Feb 26, 2019

@phil-flyclops The podspec is not located in the root directory, but in the ios one (ios/RNLocalize.podspec). So I don't see any issue here? Did it throw you an error on install?

@phil-flyclops
Copy link
Contributor Author

@zoontek Yes, it was unable to find any files and would make an empty project as a result.

The Podspec definition tells what repo to grab from, but doesn't have a way to define where the podspec file itself originally lived so it causes issues if you try to specify source_files from anywhere but the root of the project.

CocoaPods explicitly dictates using paths relative from the root of the repository for this reason - https://guides.cocoapods.org/syntax/podspec.html#group_file_patterns

@zoontek
Copy link
Owner

zoontek commented Feb 26, 2019

@phil-flyclops I just gave it a try using this Podfile and everything went well. Are you sure you didn't forget the /ios at the end of the import path ?

platform :ios, '9.0'

target 'RNLocalizeTest' do
  
  # see https://facebook.github.io/react-native/docs/integration-with-existing-apps#configuring-cocoapods-dependencies
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTAnimation',
    'RCTNetwork',
    'RCTText',
    'RCTWebSocket',
    # Add any other subspecs you want to use in your project
  ]

  pod 'RNLocalize', :path => '../node_modules/react-native-localize/ios' # notice the /ios
  
end

Edit: I might add this to the documentation

@phil-flyclops
Copy link
Contributor Author

The issue I had was stemming out of a use case like this where I have a Podspec instead of a Podfile referencing this as a transitive dependency and no longer have the ability to use relative paths like that - CocoaPods/CocoaPods#3276

I manually solved it for our use case since we have a Private Spec Repo of Pods - https://guides.cocoapods.org/making/private-cocoapods.html

It seems like something that would affect folks who have the same use case, but if it is rare enough I can just keep adjusting it on my end as new versions of this library are published.

@phil-flyclops
Copy link
Contributor Author

To the use-case point, here are two major react native projects that keep their ios code isolated but Podspecs at the top level of the repository to deal with this problem.

https://github.com/react-native-community/react-native-linear-gradient
https://github.com/react-native-community/lottie-react-native

Would you be on board with having a copy of the Podspec in the root of the repo with the tweaked source_files directive so that we can support people using the current setup and people using private spec repos?

@zoontek zoontek closed this in 6cd344d Mar 5, 2019
@zoontek
Copy link
Owner

zoontek commented Mar 5, 2019

@phil-flyclops I just published v1.1.0 with a duplicate Podfile at root.

@phil-flyclops
Copy link
Contributor Author

Sweet, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants