Skip to content

CocoaPods can't find local podspecs #5175

@malice00

Description

@malice00

Analyzing CocoaPods uses pod spec which to find the location of a podspec file. Unfortunately CP only resolved the path if the pod is known in (one of) its repositories.
If a pod is included locally, the path is actually defined in the Podfile.lock, so imho there is no need to use pod spec which.

Eg in our Podfile we have:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

And node_modules/react-native/scripts/react_native_pods.rb then contains (snippet):

def use_react_native! (options={})
  # The prefix to react-native
  prefix = options[:path] ||= "../node_modules/react-native"

  # The Pods which should be included in all projects
  pod 'FBLazyVector', :path => "#{prefix}/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "#{prefix}/React/FBReactNativeSpec"
  pod 'RCTRequired', :path => "#{prefix}/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "#{prefix}/Libraries/TypeSafety"
  pod 'React', :path => "#{prefix}/"

This then gives us a Podfile.lock like this (snippet):

DEPENDENCIES:
  - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
  - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
  - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
  - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
  - Permission-Camera (from `../node_modules/react-native-permissions/ios/Camera.podspec`)
  - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
  - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
  - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
  - React (from `../node_modules/react-native/`)
  - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`)
  - React-Core (from `../node_modules/react-native/`)
  - React-Core/DevSupport (from `../node_modules/react-native/`)
--- SNIP ---
SPEC REPOS:
  https://XXX/CocoaPods/Specs.git:
    - boost-for-react-native
    - GCDWebServer

EXTERNAL SOURCES:
  DoubleConversion:
    :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
  FBLazyVector:
    :path: "../node_modules/react-native/Libraries/FBLazyVector"
  FBReactNativeSpec:
    :path: "../node_modules/react-native/React/FBReactNativeSpec"
  glog:
    :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
  Permission-Camera:
    :path: "../node_modules/react-native-permissions/ios/Camera.podspec"

Wouldn't it be easier (and faster) to try to retrieve the podspecs from this file and use pod spec which as a fallback? Running that would still be required for eg boost-for-react-native and GCDWebServer from the above snippet.

⚠️ The podspec files here are not written in JSON as those in a GIT-repo normally are ⚠️

Metadata

Metadata

Assignees

No one assigned

    Labels

    analyzerAbout the analyzer toolhelp wantedAn issue where third-party help is wanted on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions