Skip to content

Improve pods setup isolation on existing projects#30966

Closed
vmaraccini wants to merge 9 commits intoflutter:masterfrom
vmaraccini:fix-pods-setup
Closed

Improve pods setup isolation on existing projects#30966
vmaraccini wants to merge 9 commits intoflutter:masterfrom
vmaraccini:fix-pods-setup

Conversation

@vmaraccini
Copy link
Contributor

@vmaraccini vmaraccini commented Apr 12, 2019

Description

This PR adds a check to the Flutter tool Cocoapods integration that prevents adding the Pods include (#include "Pods/Target Support Files/Pods-Runner/...) if the project's Podfile does not contain the target Runner.

This is useful when attempting to integrate Flutter into an existing application that already has Cocoapods dependencies, but none of them point to the Runner target/project.

I'm facing this problem when integrating Flutter into my existing iOS app which has an xcworkspace with multiple projects and a single Podfile to manage all Cocoapods dependencies. None of the dependencies in that Podfile target the Runner project.

Related Issues

I could not find any related issues, but I reckon this is a trivial change and may not be deserving of one.

Tests

I added the following tests in packages/flutter_tools/test/ios/cocoapods_test.dart:

  • does not include Pod config in xcconfig files, if Runner target is not present

I also changed existing tests in the cocoapods_test.dart file to have valid Podfile content instead of just a mock string.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • No, this is not a breaking change.

@goderbauer goderbauer added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 12, 2019
@vmaraccini vmaraccini changed the title Fix pods setup Fix pods setup on existing projects Apr 20, 2019
@vmaraccini vmaraccini changed the title Fix pods setup on existing projects Improve pods setup isolation on existing projects Apr 20, 2019
@jonahwilliams
Copy link
Contributor

@jmagman can you take a look at this?

@jmagman
Copy link
Member

jmagman commented Jul 24, 2019

Apologies for not getting to this sooner.
You definitely point out a big problem the lack of isolation between Flutter and existing projects. I took a stab at a larger change that should hopefully solve things in a more complete, more CocoaPods-friendly way:
#36793
When that lands, you should be able to just update your Podfile targets that need the Flutter symbols, plugins, etc:

load File.join('my_flutter', '.ios', 'Flutter', 'podhelper.rb')
target 'MyApp' do
  install_all_flutter_pods 'my_flutter'
end

There will no longer be build settings added to the host app, or any references to "Runner".

@jmagman
Copy link
Member

jmagman commented Jul 31, 2019

@vmaraccini I'm hoping your issue is fixed by #36793. You can migrate your Podfile as I suggested above, and try it on the master channel. https://github.com/flutter/flutter/wiki/Flutter-build-release-channels
If it's not resolved, please file an issue and @ me!

@jmagman jmagman closed this Jul 31, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants