invertase / flutterfire_cli

A CLI to help with using FlutterFire in your Flutter applications.
Apache License 2.0
170 stars 47 forks source link

[bug]: `flutterfire configure` always add `GoogleService-Info.plist` to `project.pbxproj` even it is already exists #235

Closed husainazkas closed 9 months ago

husainazkas commented 10 months ago

Is there an existing issue for this?

CLI Version

0.3.0-dev.18

Firebase Tools version

12.7.0

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.13.9, on macOS 14.1.1 23B81 darwin-x64, locale en-ID) • Flutter version 3.13.9 on channel stable at /Users/husainazkas/fvm/versions/stable • Upstream repository https://github.com/flutter/flutter.git • Framework revision d211f42860 (4 weeks ago), 2023-10-25 13:42:25 -0700 • Engine revision 0545f8705d • Dart version 3.1.5 • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/husainazkas/Library/Android/sdk • Platform android-33, build-tools 33.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15A507 • CocoaPods version 1.13.0

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • android-studio-dir = /Applications/Android Studio.app • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.84.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.76.0

[✓] Connected device (3 available) • sdk gphone x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator) • macOS (desktop) • macos • darwin-x64 • macOS 14.1.1 23B81 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119

[✓] Network resources • All expected network resources are available.

• No issues found!

Description

I'm working with flavors (and ios schemes). So here are the location of google service information.

Every time I run this:

flutterfire configure \
    --project="{PROJECT_ID}" \
    --out="lib/firebase_options.staging.dart" \
    --platforms="android,ios" \
    --android-package-name="{ANDROID_PACKAGE_NAME}" \
    --android-out="android/app/src/staging/" \
    --ios-bundle-id="{IOS_BUNDLE_ID}" \
    --ios-out="ios/config/staging/GoogleService-Info.plist" \
    --ios-target="Runner" \
    --overwrite-firebase-options

It generates expected file output BUT adds same file of GoogleService-Info.plist to project.pbxproj so it comes to be duplicated like this.

image   image
image

Steps to reproduce

Just run the script then it will adds GoogleService-Info.plist to project.pbxproj every time run.

Expected behavior

Only add GoogleService-Info.plist to project.pbxproj if no exists OR update existing reference. It means, it should not duplicate like unexpected in the description.

Screenshots

No response

Additional context and comments

Besides that, why I install dart pub global activate flutterfire_cli 0.3.0-dev.18 --overwrite then I run flutterfire_cli --version it shows 0.3.0-dev.16 ? I think you may forgot to run generator version, LOL (see https://github.com/invertase/flutterfire_cli/blob/flutterfire_cli-v0.3.0-dev.18/packages/flutterfire_cli/lib/version.g.dart)

russellwheatley commented 9 months ago

Thanks for the report, I have observed this behaviour and will get a fix out for it 👍