Skip to content

Flutter create's git clone doesn't build ios #9763

Closed

Description

@xster

I think we created a missing edge case with #9464/#9085 for Mac wrt cocoapods

  1. Check out flutter 7a57d37
  2. brew uninstall cocoapods
  3. flutter create project A
  4. that project builds ok
  5. git init, git add ., git ci -am
  6. git clone project A into project B
  7. try to build ios in project B

That project won't build because the Pod directory generated in project A isn't checked in by default. This creates a problem for team development since the references to Pod in Pod's parent directory is still present and building causes

    diff: /../Podfile.lock: No such file or directory
    diff: /Manifest.lock: No such file or directory
    error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

Perhaps we should make the flutter create's general dependency on cocoapods reduced until the user needs to use cocoapods.

Activity

  1. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    platform-macosBuilding on or for macOS specifically
    on May 3, 2017
  2. added this to the milestone on May 3, 2017
  3. changed the title [-]Flutter create's git clone doesn't build[/-] [+]Flutter create's git clone doesn't build ios[/+] on May 3, 2017
  4. xster commented on May 3, 2017

    @xster
    MemberAuthor

    cc @mit-mit @jakobr-google @cbracken

    Sorry for messing around cocoapods more. I think we're getting closer and closer though.

    Just trying to explicitly list out a few assumed criteria to make the solution finding easier.

    To satisfy all of the above, I tentatively propose (please violently scrutinize, I'm not sure I caught all the details)

    • flutter create doesn't include any traces of cocoapods. Not in ios/Pods and not ios/Podfile, ios/Podfile.lock, ios/Runner.xcodeproj/project.pbxproj etc either.
    • Let none of the example projects refer to cocoapods unless they actually use plugins
    • Let cocoapods create everything once the user starts plugins
    • Run something like pod deintegrate when users remove all plugins
  5. cbracken commented on May 3, 2017

    @cbracken
    Member

    We don't want source controlled files to keep changing as an effect of building.

    One exception I think would be acceptable is when a project changes state from no pod deps to having pod deps, I'd be fine with checking in the additional build phases. Otherwise we end up effectively having to pod install; buildl; pod deintegrate on each run.

  6. cbracken commented on May 3, 2017

    @cbracken
    Member

    flutter create doesn't include any traces of cocoapods. Not in ios/Pods and not ios/Podfile, ios/Podfile.lock, ios/Runner.xcodeproj/project.pbxproj etc either. [...] Let none of the example projects refer to cocoapods unless they actually use plugins

    I like this from the position of boilerplate reduction. To be clear, I think having the Pods and Frameworks folders in the xcworkspace is probably fine though.

  7. cbracken commented on May 3, 2017

    @cbracken
    Member

    Run something like pod deintegrate when users remove all plugins

    For the base case, this seems really nice. One potential edge-case to consider: are there cases where a user might add CocoaPods without it being specific to a Flutter plugin?

  8. mit-mit commented on May 3, 2017

    @mit-mit
    Member

    Yes, hybrid apps. I think even the flutter_view sample does that.

  9. cbracken commented on May 3, 2017

    @cbracken
    Member

    One more point re:

    flutter create doesn't include any traces of cocoapods.

    The vast majority of real-world apps will depend on pods, so I don't think our goal should necessarily be to avoid any mention of them in the default project.

    If we're going to assume all real-world projects rely on plugins, then it's probably fair to require Cocoapods to be installed for real-world projects. The main reason it'd be really nice to have the default initial project (and some of our examples) not require Cocoapods is to allow people new to the framework to try it out with low overhead and do some quick experimenting without 100s of MB of download first.

    I like the idea from the perspective of boilerplate reduction -- but perhaps that's a separate bug. On that end of things, I think the requirements are:

    • Any file that isn't .gitignored should be meaningful/editable to the developer. Everything else should be generated on the fly and not checked in.
    • We shouldn't expect any file that's .gitignored to be present. You should be able to fluter create then git add ., push to a repo, blow everything away, clone it back and it still works.
  10. xster commented on May 3, 2017

    @xster
    MemberAuthor

    I agree with #9763 (comment)

    #9763 (comment), you meant just the folder references right? Not the actual folder on disk (in case of Pods)

    #9763 (comment) in those cases, users have to likely modify the Podfile itself. I think we should defer the running of pod install to the user in those cases. i.e. only automatically run pod install/deintegrate in flutter build ios only if the Podfile's hash matches our version.

  11. cbracken commented on May 3, 2017

    @cbracken
    Member

    you meant just the folder references right?

    Yep.

  12. xster commented on May 3, 2017

    @xster
    MemberAuthor

    wrt

    flutter create doesn't include any traces of cocoapods. Not in ios/Pods and not ios/Podfile, ios/Podfile.lock, ios/Runner.xcodeproj/project.pbxproj etc either.

    I just tested it. We're actually not that far from it at all.

    I tried flutter create. Then go into the project and delete all traces of cocoapods. Everything builds fine. Then add url_launcher: ^0.3.0 to the pubspec, install cocoapods and run flutter build ios.

    The only things we're missing is

  13. jakobr-google commented on May 4, 2017

    @jakobr-google
    Contributor

    I'm not sure if it's a good idea to de-integrate pods if we go from having plugins to not having plugins. If we want to, then yes, we can only do it if the user hasn't modified the Podfile. Does pod deintegrate blow away the xcworkspace?

    You'll also have to handle the case where users have manually added a Podfile, and some time later start using plugins. You'll need to have a way to add our plugin boilerplate code to their existing Podfile - maybe just detect this situation and tell them what to do manually (they must know how, since they've already added their own Podfile).

    And I'd prefer always running pod install if there is a Podfile (assuming that it now only exists if the project is using pods, either directly or through plugins). And make it an error to not have CocoaPods installed if there is a Podfile - maybe only if the app uses plugins.

    Since we now only run pod install if someone has added a Podfile, we could also automatically run pod setup as a separate long-running step before invoking pod install if we detect the repo hasn't been initialized yet. That'd be nice of us, and still make it apparent what's going on.

  14. cbracken commented on May 4, 2017

    @cbracken
    Member

    I'd prefer always running pod install if there is a Podfile

    Agreed. Less conditional execution means simpler code and testing and a more predictable experience for developers.

    we could also automatically run pod setup as a separate long-running step before invoking pod install if we detect the repo hasn't been initialized yet

    I really like the idea of trying to detect that pod setup needs to be run, but from a developer experience point of view, I'd much rather we bail out with an error message indicating that pod setup needs to be run and that it can be a time-consuming step, rather than opting me into a 10-15 minute step (my experience on a 50Mbps connection) that I didn't explicitly know I was going to get. Developers who want to run it immediately can do so. Anyone working from a non-ideal environment or without 15 mins to spare, can defer till later.

  15. xster commented on May 5, 2017

    @xster
    MemberAuthor

    Closing this bug since its primary issue is fixed. Will open children bugs for other minor issues discovered during investigation.

    Whether to also generate Podfile via dart and not check in a static Podfile

    I feel a bit more strongly about this one. I think we should 'manage' the contents of a Podfile from flutter tools directly. This will 'permit' the injection of flutter's Podfile script in a hybrid case after a user already has a Podfile or allow 'versioning' of Podfiles as we find bugs or add improvements, we can 'update' and existing Podfile which may have hybrid user entries without deleting the whole file. This way, we don't need to create a Podfile in the initial flutter create either.

    Whether to automatically trigger pod install on pubspec plugins or on Podfile presence

    Umm, I don't really have a strong opinion on this. I'm slightly leaning on the side of, if the user made any manual changes to Podfile himself, he should probably manage his own executions of pod install. If there is also usage of pubspec plugins, we can of course warn/remind him to keep running pod install manually to keep things up to date.

    Whether to clean with pod deintegrate if no plugins are left

    I think this one's probably pretty simple especially if we manage the Podfile via dart. If it's a vanilla Podfile purely generated by the flutter tools, we can pod deintegrate and clean everything up. If the user has his own entries, don't.

    Whether to automatically pod setup

    I think from #9580, we shouldn't. It takes a really long time and consumes a lot of bandwidth and disk space. We should let the user install it themselves.

  16. github-actions commented on Sep 5, 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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform-macosBuilding on or for macOS specificallytoolAffects 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