Skip to content

integration_test embedded in shipping iOS apps when added to pubspec #74274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jmagman opened this issue Jan 20, 2021 · 5 comments
Open

integration_test embedded in shipping iOS apps when added to pubspec #74274

jmagman opened this issue Jan 20, 2021 · 5 comments
Assignees
Labels
a: tests "flutter test", flutter_test, or one of our tests f: integration_test The flutter/packages/integration_test plugin P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-ios Triaged by iOS platform team

Comments

@jmagman
Copy link
Member

jmagman commented Jan 20, 2021

@matanlurey update as of 2024-11-20:

As of HEAD today, with the following feature flag opt-in:

flutter config explicit-package-dependencies

The generated .flutter-plugins-dependencies file now includes dev_dependency: true|false per plugin. See #158009 for implementation details. We should be able to use the explicit appearance of dev_dependency: true in order to strip out plugins (such as integration_test) that are dev dependencies in production builds.


Original post:

integration_test was added to the pubspec template in #70240. This caused all newly flutter created iOS apps to ship with an embedded integration_test framework, and it requires all developers to install CocoaPods, even if they had not previously used any plugins. It also embedded the app in add-to-app host apps.

#70240 was reverted in #74068 due to NNBD issues. Before it is relanded, there should be a plan for how to prevent the above.

See also #68818

@jmagman jmagman added platform-ios iOS applications specifically f: integration_test The flutter/packages/integration_test plugin labels Jan 20, 2021
@jmagman
Copy link
Member Author

jmagman commented Jan 20, 2021

For the iOS side at least:

Avoid embedding in app

  1. dev_dependencies could be parsable from .flutter-plugins-dependencies (Strip plugins created from dev_dependencies from release-mode apps #56591)
    The injectPlugins/GeneratedPluginRegistrant code would also need to ignore dev_dependencies.
    List<Map<String, dynamic>> _extractPlatformMaps(List<Plugin> plugins, String type) {
    final List<Map<String, dynamic>> pluginConfigs = <Map<String, dynamic>>[];
    for (final Plugin p in plugins) {
    final PluginPlatform platformPlugin = p.platforms[type];
    if (platformPlugin != null) {
    pluginConfigs.add(platformPlugin.toMap());
    }
    }
    return pluginConfigs;
    }

Then the podhelper can exclude those plugins:

return [] unless dependencies_hash.has_key?('plugins')
return [] unless dependencies_hash['plugins'].has_key?('ios')

Something like

return [] if dependencies_hash['plugins'].has_key?('dev_dependency')
  1. integration_test can be hard-coded to be ignored in these places.

Embed in test

To add integration_test to the test target, it can be added via CocoaPods:

  target 'RunnerTests' do
    pod 'integration_test'
  end

Or we can figure out how to do this as a Swift Package #72482.

If there's plans to add the test target to the Xcode project template, this embedding can be done automatically.

@jmagman jmagman added the a: tests "flutter test", flutter_test, or one of our tests label Jan 20, 2021
@jmagman
Copy link
Member Author

jmagman commented Jan 20, 2021

\cc @dnfield @jonahwilliams

@bartekpacia
Copy link
Member

I'd really like to see it fixed. It makes it harder than necessary to develop a Flutter plugin that is intended to use only in integration tests.

@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Jul 8, 2023
@stuartmorgan-g stuartmorgan-g added the P2 Important issues not at the top of the work list label Jul 23, 2023
@matanlurey matanlurey self-assigned this Oct 22, 2024
@matanlurey matanlurey assigned cbracken and unassigned matanlurey Nov 19, 2024
@matanlurey
Copy link
Contributor

@cbracken Just checking in - this functionality is currently working e2e in Android, but not iOS. I'd love to get this into the next (not this) stable release so we can announce at the same time that both Android and iOS support it, but it's not critical.

@matanlurey
Copy link
Contributor

This is ready to get worked on whenever prioritized; see #163874 (can dedupe)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: tests "flutter test", flutter_test, or one of our tests f: integration_test The flutter/packages/integration_test plugin P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-ios Triaged by iOS platform team
Projects
None yet
Development

No branches or pull requests

8 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy