Skip to content

flutter run should fail if the initial cocoapods podspec repo hasn't been cloned instead of doing a 20 minute clone #9580

Closed

Description

@eseidelGoogle

Right now if you don't have cocoapods installed we will (silently) set it up for you as part of the pod install run as part of flutter run. This first install can take 20 minutes. :/

It seems like it would be better to separate setup from running so we don't have a bad first-run experience.

%rm -rf ~/.cocoapods
%flutter run

Launching lib/main.dart on iPhone 6s in debug mode...
Running pod install...                                    
CoreSimulatorBridge: Getting container class internal daemon!

It's just hanging checking out cocoapods:
32981 ttys000 0:00.02 /usr/local/git/current/bin/git clone https://github.com/CocoaPods/Specs.git master --progress

I think a better experience would be to just fail instead of silently installing. @mit-mit

Activity

  1. eseidelGoogle commented on Apr 25, 2017

    @eseidelGoogle
    ContributorAuthor

    I think this is in part that #8983 doesn't appear solved. But I guess what I've learned is that I don't think we actually want that solved, but rather we probably want to fail-fast and force setup to be separate from running.

  2. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Apr 25, 2017
  3. eseidelGoogle commented on Apr 27, 2017

    @eseidelGoogle
    ContributorAuthor

    I was bit by this again today. It's a really bad experience in intellij since it just prints

    Launching lib/main.dart on iPhone 6s in debug mode...
    

    There is a window which shows up with background tasks "pod install", but the user won't know what that is. :(

    FYI @devoncarew @mit-mit @jakobr-google

  4. devoncarew commented on Apr 27, 2017

    @devoncarew
    Contributor

    Urk. I agree that we're better off failing the run (w/ good messaging), and having an explicit step to get cocoapods set up.

  5. eseidelGoogle commented on Apr 27, 2017

    @eseidelGoogle
    ContributorAuthor

    Actually intelliJ eventually gives up:

    Launching lib/main.dart on iPhone 6s in debug mode...
    Observatory connection never became ready.
    Application finished.
    

    So this is worse than I thought. If you don't have cocaopods installed and flutter run, your runs will just eventually time out. :(

  6. mit-mit commented on Apr 27, 2017

    @mit-mit
    Member

    Yes, we all agree. This has to be fixed. Just need to find someone who has cycles right now...

  7. eseidelGoogle commented on Apr 27, 2017

    @eseidelGoogle
    ContributorAuthor

    Just making it error out should be straightforward. Maybe @xster could help?

  8. xster commented on Apr 27, 2017

    @xster
    Member

    Maybe we should just show a prompt and let the user decide:

    > flutter run
    [...]
    we use cocoapods to automatically resolve iOS dependencies, would you like to install cocoapods now (Y/n)
    
    (Y/n) y
    Installing cocoapods, this may take minutes...
    ↳   downloading...
        configuring...
        wtv...
    
    Resolving cocoapods dependencies...
    Building...
    
    (Y/n) n
    cocoapods is needed to build the flutter app. You can install it by running `brew install blah`.
    >
    

    Showing prompts is probably a pattern we can expand more on with like #7863

  9. sethladd commented on Apr 27, 2017

    @sethladd
    Contributor

    If you do this (would you like to install cocoapods now (Y/n)) please help the user understand how to make the decision. If I saw that on my first run, I wouldn't know how to answer. :/

    • What if I don't install cocapods now?
    • Can I install it later?
    • What's the impact if I choose Y or N?
  10. sethladd commented on Apr 27, 2017

    @sethladd
    Contributor

    How about this:

    • Can we prompt to download cocoapods when the user needs it ?

    • If we detect the user needs cocoapods, and they don't have it, we error out, give them a nice message, and say "run flutter install cocoapods to get the hotness"

  11. jakobr-google commented on Apr 27, 2017

    @jakobr-google
    Contributor
  12. xster commented on Apr 27, 2017

    @xster
    Member

    Let's defer the reasoning for the dependency to #9035. We should do it generally regardless of timing.

  13. eseidelGoogle commented on Apr 27, 2017

    @eseidelGoogle
    ContributorAuthor

    pod repo list appears to say if there are repos or not?

  14. self-assigned this
    on Apr 28, 2017
  15. changed the title [-]`flutter run` should fail if cocoapods is missing instead of doing a 20 minute install[/-] [+]`flutter run` should fail if the initial cocoapods podspec repo hasn't been cloned instead of doing a 20 minute clone[/+] on Apr 29, 2017
  16. xster commented on Apr 29, 2017

    @xster
    Member

    Step took 12 minutes on my monster mac pro too :(
    Just to make sure I'm listing this correctly in sequence:

    During build/run

    1. If the project being built isn't iOS, nothing to do [✓]
    2. If the project being built doesn't have a Podfile, nothing to do [~]
    3. If the user doesn't have cocoapods installed, dump error and instructions and continue without resolving native dependencies [~]
    4. If the user has cocoapods installed but never cloned the specs, dump error and instructions and continue without resolving native dependencies to stay consistent with 3
      • Not sure I trust pod repo list's output's format. Probably safer to just check for ~/.cocoapods/repos/master's presence

    In doctor

    1. If the user doesn't have cocoapods, ask user to brew install and pod setup (i.e. clone) [✓]
    2. If the user has cocoapods but doesn't have ~/.cocoapods/repos/master, ask the user to pod setup [✗]
    3. In both cases 1 and 2, explain inline that it's not mandatory to build and run but without it, plugins won't work [✗]
    4. In the future Add description for why some dependencies are needed in doctor #9035, move inline messaging 3 to something hierarchical to more clearly illustrate the cause-effect chain to the user [✗]
  17. xster commented on May 1, 2017

    @xster
    Member

    With the 3 PRs above (#9687, #9741, #9703):

    During build/run

    1. If the project being built isn't iOS, nothing to do [✓]
    2. If the project being built doesn't have a flutter: plugin: in their pubspec, nothing to do [✓]
    3. If the user doesn't have cocoapods installed, dump error and instructions and continue without resolving native dependencies [✓]
    4. If the user has cocoapods installed but never cloned the specs, dump error and instructions and continue without resolving native dependencies to stay consistent with 3 [✓]

    In doctor

    1. If the user doesn't have cocoapods, ask user to brew install and pod setup (i.e. clone) [✓]
    2. If the user has cocoapods but doesn't have ~/.cocoapods/repos/master, ask the user to pod setup [✓]
    3. In both cases 1 and 2, explain inline that it's not mandatory to build and run but without it, plugins won't work [✓]
    4. In the future Add description for why some dependencies are needed in doctor #9035, move inline messaging 3 to something hierarchical to more clearly illustrate the cause-effect chain to the user [✗]
  18. mit-mit commented on May 2, 2017

    @mit-mit
    Member

    Thanks @xster, great improvements!

  19. mit-mit commented on May 2, 2017

    @mit-mit
    Member

    One comment: I don't think that prompting is a good solution; we invoke Flutter tools also from IntelliJ, and while we do print the output to the console pane, that may be closed and thus the user won't see the prompt.

    But also looks like we ended up not pursuing that approach?

  20. xster commented on May 2, 2017

    @xster
    Member

    ya, I didn't realize it took 10+ minutes on a beast machine. Let's skip the prompting for this scenario.

  21. jakobr-google commented on May 2, 2017

    @jakobr-google
    Contributor
  22. eseidelGoogle commented on May 2, 2017

    @eseidelGoogle
    ContributorAuthor

    My impression is this is very close to resolved? Is there more work to do here for M2?

  23. xster commented on May 2, 2017

    @xster
    Member

    Still need to un-revert #9701 then merge #9703.
    Should be good for Friday.

  24. CharlesCleveJr commented on Aug 9, 2017

    @CharlesCleveJr

    Has there been a fix for this issue?

  25. xster commented on Aug 9, 2017

    @xster
    Member

    @CharlesCleveJr, it's fixed in the sense that Flutter doesn't automatically and silently trigger a CocoaPods spec repo clone while building anymore.

    Though we nevertheless still have a dependency on CocoaPods and the spec repo still needs to be cloned. We provide a message asking the user to perform that step (pod setup) manually now.

  26. github-actions commented on Sep 4, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  27. locked as resolved and limited conversation to collaborators on Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

toolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions