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

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

Closed
1 task done
stuartmorgan opened this issue Dec 12, 2024 · 4 comments · Fixed by #16890
Closed
1 task done

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

stuartmorgan opened this issue Dec 12, 2024 · 4 comments · Fixed by #16890
Assignees
Labels
Needs Attention This issue needs maintainer attention. platform: macos Issues / PRs which are specifically for MacOS. plugin: core type: bug Something isn't working

Comments

@stuartmorgan
Copy link

stuartmorgan commented Dec 12, 2024

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.

@stuartmorgan stuartmorgan added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Dec 12, 2024
@SelaseKay SelaseKay added plugin: core platform: macos Issues / PRs which are specifically for MacOS. labels Dec 12, 2024
@SelaseKay
Copy link
Contributor

Hi @stuartmorgan, what flutter version are you using?

@SelaseKay SelaseKay added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Dec 13, 2024
@stuartmorgan
Copy link
Author

I was using a current master from yesterday.

The Flutter version is irrelevant beyond needing to be one with SPM support, because the bug is in the path construction in firebase_core's Package.swift, on the lines that I linked to. There is—and I say this as the TL of the Flutter team responsible for plugin tooling—no scenario under which it is a good idea for a package to construct a relative path that leaves the directory structure that is controlled by the package author and moves into the enclosing directory where the naming conventions are an internal implementation detail of pub. It already doesn't work for hosted packages, which is how essentially all clients will interact with the package.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Dec 13, 2024
@SelaseKay
Copy link
Contributor

cc @russellwheatley

@SelaseKay
Copy link
Contributor

I was able to reproduce this issue using the steps provided above on Flutter version 3.27.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention This issue needs maintainer attention. platform: macos Issues / PRs which are specifically for MacOS. plugin: core type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants