capawesome-team / capacitor-firebase

⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the Web.

Home Page:https://capawesome.io/plugins/firebase/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Advice needed: Cannot build Authentication on Ionic Appflow due to "Multiple commands produce CapacitorFirebaseAuthentication.framework"

alextreppass opened this issue · comments

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Messaging
  • Cloud Storage
  • Performance
  • Remote Config

Version

5.4.1

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

Hi, we're using Capacitor and adding support for Sign in with Apple + Google to our app.

My podfile has the following in the base capacitor_pods:

  pod 'CapacitorFirebaseAuthentication', :path => '../../../node_modules/@capacitor-firebase/authentication'

It also has the following in our 'app-dev' flavor / scheme, under the 'add pods here' as per the docs:

  pod 'CapacitorFirebaseAuthentication/Google', :path => '../../../node_modules/@capacitor-firebase/authentication'

Building and running the app locally with Capacitor CLI works fine, as does XCode.

However on Ionic Appflow CI (where we do our production builds), I get the following issue:

[06:44:28]: ▸ ❌ error: Multiple commands produce '/Users/ionic-cloud-team/<some/path>/CapacitorFirebaseAuthentication.framework/CapacitorFirebaseAuthentication'
[06:44:28]: ▸ ❌ error: Multiple commands produce '/Users/ionic-cloud-team/<some/path>/CapacitorFirebaseAuthentication.framework'
[06:44:28]: ▸ ⚠️ Run script build phase '[CP] Copy XCFrameworks' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'IonicLiveUpdates' from project 'Pods')
[06:44:28]: ▸ ⚠️  /Users/ionic-cloud-team/builds/<some/path>/ios/App/App.xcodeproj: Multiple targets match implicit dependency for linker flags '-framework CapacitorFirebaseAuthentication'. Consider adding an explicit dependency on the intended target to resolve this ambiguity. (in target 'app-dev' from project 'App')
[06:44:28]: ▸     note: Target 'CapacitorFirebaseAuthentication' (in project 'Pods')
[06:44:28]: ▸     note: Target 'CapacitorFirebaseAuthentication.default-Google' (in project 'Pods')
[06:44:28]: ▸ ⚠️ Run script build phase '[CP] Embed Pods Frameworks' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'app-dev' from project 'App')
[06:44:28]: ▸ ⚠️ Run script build phase '[CP] Copy XCFrameworks' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'FirebaseAnalytics' from project 'Pods')
[06:44:28]: ▸ ⚠️ duplicate output file '/Users/ionic-cloud-team/<some/path>/CapacitorFirebaseAuthentication.framework/_CodeSignature' on task: CodeSign /Users/ionic-cloud-team/<some/path>/CapacitorFirebaseAuthentication.framework (in target 'CapacitorFirebaseAuthentication.default-Google' from project 'Pods')
[06:44:28]: ▸ ⚠️ duplicate

I have tried taking out the pod 'CapacitorFirebaseAuthentication/Google' line, but then signing in with Google no-longer works.

I cannot take out the main pod 'CapacitorFirebaseAuthentication' line because npx cap sync will regenerate it.

Expected behavior

That the build would not fail on Appflow, when it works ok locally.

Reproduction

TBD (see comment below)

Steps to reproduce

We run the build on Ionic Appflow, it fails after a few minutes

Other information

No response

Capacitor doctor

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 5.7.4
@capacitor/core: 5.7.4
@capacitor/android: 5.7.4
@capacitor/ios: 5.7.4

Installed Dependencies:

@capacitor/cli: 5.7.2
@capacitor/android: 5.7.2
@capacitor/core: 5.7.2
@capacitor/ios: 5.7.2

Before submitting

  • I have read and followed the bug report guidelines.
  • I have attached links to possibly related issues and discussions.
  • I understand that incomplete issues (e.g. without reproduction) are closed.

Hello, for this one — it's going to take a while for me to put together a minimal repro with schemes that will work with e.g. Appflow's free plan, and then to document how to set up the Appflow schemes / variants

Before I embark on this, I'd love to hear if you've run into this before or whether there's a simple Podfile solve.

I'm googling a bunch and I might be missing something simple here

Please show me your Podfile.

Thank you.

require_relative '../../../node_modules/@capacitor/ios/scripts/pods_helpers'

platform :ios, '13.0'
use_frameworks!

$AppsFlyerStrictMode=true

# workaround to avoid Xcode caching of Pods that requires
# Product -> Clean Build Folder after new Cordova plugins installed
# Requires CocoaPods 1.6 or newer
install! 'cocoapods', :disable_input_output_paths => true

def capacitor_pods
  pod 'Capacitor', :path => '../../../node_modules/@capacitor/ios'
  pod 'CapacitorCordova', :path => '../../../node_modules/@capacitor/ios'
  pod 'CapacitorFirebaseAuthentication', :path => '../../../node_modules/@capacitor-firebase/authentication'
  pod 'CapacitorApp', :path => '../../../node_modules/@capacitor/app'
  pod 'CapacitorBrowser', :path => '../../../node_modules/@capacitor/browser'
  pod 'CapacitorClipboard', :path => '../../../node_modules/@capacitor/clipboard'
  pod 'CapacitorHaptics', :path => '../../../node_modules/@capacitor/haptics'
  pod 'CapacitorLiveUpdates', :path => '../../../node_modules/@capacitor/live-updates'
  pod 'CapacitorLocalNotifications', :path => '../../../node_modules/@capacitor/local-notifications'
  pod 'CapacitorPreferences', :path => '../../../node_modules/@capacitor/preferences'
  pod 'CapacitorPushNotifications', :path => '../../../node_modules/@capacitor/push-notifications'
  pod 'CapacitorSplashScreen', :path => '../../../node_modules/@capacitor/splash-screen'
  pod 'CapacitorStatusBar', :path => '../../../node_modules/@capacitor/status-bar'
  pod 'PantristCapacitorFirebaseDynamicLinks', :path => '../../../node_modules/@pantrist/capacitor-firebase-dynamic-links'
  pod 'AppsflyerCapacitorPlugin', :path => '../../../node_modules/appsflyer-capacitor-plugin'
  pod 'CapacitorNativeSettings', :path => '../../../node_modules/capacitor-native-settings'
end

target 'app-dev' do
  capacitor_pods
  # Add your Pods here
  pod 'Firebase/Messaging'
  pod 'Firebase/Crashlytics'
  pod 'Firebase/AnalyticsWithoutAdIdSupport'
  pod 'CapacitorFirebaseAuthentication/Google', :path => '../../../node_modules/@capacitor-firebase/authentication'
end

target 'app-staging' do
  capacitor_pods
  # Add your Pods here
  pod 'Firebase/Messaging'
  pod 'Firebase/Crashlytics'
  pod 'Firebase/AnalyticsWithoutAdIdSupport'
  # note - not rolling out sign in with google / apple yet to staging
end

target 'app-prod' do
  capacitor_pods
  # Add your Pods here
  pod 'Firebase/Messaging'
  pod 'Firebase/Crashlytics'
  pod 'Firebase/AnalyticsWithoutAdIdSupport'
  # note - not rolling out sign in with google / apple yet to prod
end


post_install do |installer|
  assertDeploymentTarget(installer)
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
        if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
            target.build_configurations.each do |config|
                config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
            end
        end
    end
  end
end

Here it is — the pod 'CapacitorFirebaseAuthentication' is added automatically by npx cap sync / update

The pod 'CapacitorFirebaseAuthentication/Google one is me adding it to the app-dev target specifically.

Thanks, your Podfile is fine. If it works locally but not in Appflow, then I would report this to the Appflow team. There must be some difference between your local build environment and the Appflow build environment.

I am building an app myself via Appflow that uses this plugin and the last build a month ago was successful. Nothing has changed in the plugin since then.

For this reason, I am closing this issue for the time being. If it turns out that the plugin is at fault, I will open it again.

Thank you for the context.

Do you / did you use specific targets / variants with your latest app? Or is it just the one build?

No, i don't use any specific targets/variants.

Happy to report I figured it out. Leaving this here for future explorers.

The issue was that the main capacitor_pods section had the root "CapacitorFirebaseAuthentication" pod, and the app-dev flavour had only the "CapacitorFirebaseAuthentication/Google" pod.

I wanted to see if it would work if it was de-duped and both pods present in the target, and confirmed this by manually crafting a podfile here, which worked.

Now, running npx cap update or npx cap sync re-adds the duplicate root pod back to capacitor_pods, even though it's already in firebase_pods, but we can live with that.