Skip to content

[firebase_core]: firebase_sdk_version.rb lookup fails on macOS with SPM #16868

@stuartmorgan-g

Description

@stuartmorgan-g

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Core

Which platforms are affected?

macOS

Description

macOS builds fail with SPM enabled due to incorrect path construction in Packages.swift

Reproducing the issue

  1. flutter config --enable-swift-package-manager
  2. flutter create foo
  3. cd foo
  4. flutter pub add firebase_core
  5. flutter build macos

Firebase Core version

3.8.1

Flutter Version

master (or any version with SPM support)

Relevant Log Output

An error occurred when adding Swift Package Manager integration:
  Error: Unable to get Xcode project information:
 2024-12-12 10:13:05.506 xcodebuild[46931:39639271] Writing error result bundle to
 /var/folders/78/17y71k957t9g3wftxrwbd93h000x5_/T/ResultBundle_2024-12-12_10-13-0005.xcresult
xcodebuild: error: Could not resolve package dependencies:
  <unknown>:0: warning: legacy driver is now deprecated; consider avoiding specifying '-disallow-use-new-driver'main/Package.swift:76: Fatal
  error: Failed to load configuration: fileNotFound("Error loading or parsing firebase_sdk_version.rb: Error Domain=NSCocoaErrorDomain
  Code=260 \"The file “firebase_sdk_version.rb” couldn’t be opened because there is no such file.\"
  UserInfo={NSFilePath=/Users/someuser/.pub-cache/hosted/pub.dev/firebase_core-3.8.1/macos/firebase_core/../../../firebase_core/ios/firebase_sdk_version.rb,
  NSURL=file:///Users/someuser/.pub-cache/hosted/pub.dev/firebase_core-3.8.1/macos/firebase_core/../../../firebase_core/ios/firebase_sdk_version.rb, NSUnderlyingError=0x600003798000 {Error Domain=NSPOSIXErrorDomain Code=2 \"No such file or directory\"}}")

Flutter dependencies

No response

Additional context and comments

The path construction is clearly wrong, since firebase_core-3.8.1/macos/firebase_core/../../../ leaves the directory scope of the package and enters into the pub cache itself, so all bets are off as to what the relative paths are from there (perhaps this was written/tested only with overridden path dependencies?). It should be ../../ios/ rather than ../../../firebase_core/ios.

The same issue appears to have been fixed for iOS in #13804, but macOS is still using the same incorrect path logic that iOS used to have.

Metadata

Metadata

Labels

Needs AttentionThis issue needs maintainer attention.platform: macosIssues / PRs which are specifically for MacOS.plugin: coretype: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions