Commit Graph

99 Commits

Author SHA1 Message Date
Matan Lurey
5458f42782
Remove isExplicitPackageDependenciesEnabled: true, it is the default. (#169156)
This flag has been enabled by default for quite some time in `master`,
and in the current `stable`.

This is the first of many PRs to get rid of the flag and the deprecated
code it is guarding.
2025-05-21 04:26:10 +00:00
Sigurd Meldgaard
b23840d044
Only bundle assets and plugins from transitive closure of dependencies (#160443)
Fixes https://github.com/dart-lang/pub/issues/4486
Fixes https://github.com/dart-lang/pub/issues/4473
Fixes https://github.com/flutter/flutter/issues/79261
Fixes https://github.com/flutter/flutter/issues/160142
Fixes https://github.com/flutter/flutter/issues/155242

Use the new `.dart_tool/package_graph.json` file to compute the
dependency graph. Determining

* which are transitive dependencies of the main app's direct and
dev-dependencies, (not other packages from the workspace)
* which of these are only in the transitive set of the direct
dependencies

Bundles assets from dev_dependencies when running `flutter test`, but
not otherwise.
2025-05-19 15:30:58 +00:00
Sigurd Meldgaard
45b21ec3bb
Refactor writing of package config in tests (#163734)
Seems like each test had its own way of doing this.

Extracted from https://github.com/flutter/flutter/pull/160443
2025-02-28 08:51:59 +00:00
Matan Lurey
f6543c3d45
Make releaseMode explicit, inform determineDevDependencies entirely on the flag (#163780)
Closes https://github.com/flutter/flutter/issues/163770.

This simplifies understanding "when I called function X, how is it
determining release mode and/or dev-dependencies?"

AFAICT, at HEAD, this is a NOP (will let integration tests run), but
would have avoided cases such as
https://github.com/flutter/flutter/issues/163706.
2025-02-21 00:07:48 +00:00
Andrew Kolos
bc7703f886
remove more (simple) usage of package:usage (#162354)
Towards https://github.com/flutter/flutter/issues/150575.

Tries to remove as much `Usage` as possible while avoiding more
complicated bits that require more scrutiny to make sure we aren't
losing test coverage or otherwise regressing. Said another way, almost
the entire diff is just deleting code to send GA3 events, and the
corresponding GA4 code can be found right next to it—making it easy to
verify we aren't losing events/tests.


<details>

<summary> Pre-launch checklist </summary> 


- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

</details>

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-01-30 18:09:19 +00:00
Loïc Sharma
593b40d3e4
Revert "[SwiftPM] Add separate feature flag for the app migration (#158897)" (#161342)
This reverts https://github.com/flutter/flutter/pull/158897 (commit
e7a1b68086) as it is intended to be in the
same release as https://github.com/flutter/flutter/pull/161275.

However, https://github.com/flutter/flutter/pull/161275 had to be
reverted and won't be relanded until after the release cutoff. Hence,
I'm reverting this as well.
2025-01-09 00:30:06 +00:00
Loïc Sharma
e7a1b68086
[SwiftPM] Add separate feature flag for the app migration (#158897)
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

### Overview

This splits the Swift Package Manager feature in two:

1. **SwiftPM feature**: This builds plugins using SwiftPM (if the app
supports it), and, uses the new app & plugin templates that support
SwiftPM
2. **SwiftPM app migration feature**: this updates an existing Flutter
iOS or macOS app to support Swift Package Manager. This feature requires
the SwiftPM feature - if SwiftPM is off, the app migration is also off.

For now, both features are off by default. We plan to turn on the first
feature in the next stable release. The app migration feature will be
stay off by default until we have higher confidence in the migration.

See this mini design doc:
https://github.com/flutter/flutter/issues/151567#issuecomment-2455941279

Here's the PR that updates the SwiftPM docs:
https://github.com/flutter/website/pull/11495

Part of https://github.com/flutter/flutter/issues/151567

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2025-01-07 19:46:03 +00:00
Michael Goderbauer
5491c8c146
Auto-format Framework (#160545)
This auto-formats all *.dart files in the repository outside of the
`engine` subdirectory and enforces that these files stay formatted with
a presubmit check.

**Reviewers:** Please carefully review all the commits except for the
one titled "formatted". The "formatted" commit was auto-generated by
running `dev/tools/format.sh -a -f`. The other commits were hand-crafted
to prepare the repo for the formatting change. I recommend reviewing the
commits one-by-one via the "Commits" tab and avoiding Github's "Files
changed" tab as it will likely slow down your browser because of the
size of this PR.

---------

Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
2024-12-19 20:06:21 +00:00
Matan Lurey
6bcb15db63
Migrate cocoapods_test.dart to explicit-package-dependencies. (#160264)
Work towards https://github.com/flutter/flutter/issues/160257.
2024-12-13 22:37:08 +00:00
Matan Lurey
125b4e945e
Move explicit package dependencies to a feature flag (#158016)
Closes https://github.com/flutter/flutter/issues/158012.

This is (effectively) a user-facing NOP, which is exchanging an
on-by-default command-line argument (`--implicit-pubspec-resolution`)
for an off-by-default global feature flag
(`explicit-package-dependencies`). It matches the mental model better,
is less painstaking to maintain and feed throughout, and will be easier
to globally flip on/off in a future PR.

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-11-13 18:33:34 -08:00
Matan Lurey
78cfc1ae9b
Plugin.isDevDependency if exclusively in dev_dependencies (#157462)
Work towards https://github.com/flutter/flutter/issues/56591.

I explicitly want an LGTM from @andrewkolos @jmagman @jonahwilliams before merging.

---

After this PR, `<Plugin>.isDevDependency` is resolved based on the following logic, IFF:

- The plugin comes from a package _A_ listed in the app's package's `dev_dependencies: ...`
- The package _A_ is not a normal dependency of any transitive non-dev dependency of the app

See [`compute_dev_dependencies_test.dart`](51676093a3/packages/flutter_tools/test/general.shard/compute_dev_dependencies_test.dart) for probably the best specification of this behavior.

We (still) do not write the property to disk (i.e. it never makes it to `.flutter-plugins-dependencies`), so there is no impact to build artifacts at this time; that would come in a follow-up PR (and then follow-up follow-up PRs for the various build systems in both Gradle and Xcode to actually use that value to omit dependencies).

Some tests had to be updated; for the most part it was updating the default `ProcessManager` because a call to `dart pub deps --json` is now made in code that computes what plugins are available, but there should be no change in behavior.

_/cc @jonasfj @sigurdm for FYI only (we talked on an internal thread about this; see https://github.com/dart-lang/sdk/issues/56968)._

_/cc @camsim99 @cbracken @johnmccutchan for visibility on the change._
2024-11-07 18:09:22 +00:00
LouiseHsu
dff191625f
Update error message for Cocoapods support for synchronized groups/folders (#158206)
Update to https://github.com/flutter/flutter/issues/156733
2024-11-06 01:08:54 +00:00
LouiseHsu
53bff28f2b
Add a tool warning when pod install does not work after adding a new test/watch/extension/other target with Xcode 16 (#156758)
Running `pod install` on Xcode projects with new test/targets in Xcode 16 will fail. Since this is a [Cocoapods bug](https://github.com/CocoaPods/CocoaPods/issues/12456), this PR adds a warning to the tool that links to a github work around and the current tracking issue.

Fixes https://github.com/flutter/flutter/issues/156733
<img width="567" alt="Screenshot 2024-10-14 at 14 48 39" src="https://github.com/user-attachments/assets/6befa601-4041-46fc-9ca2-f57662adda4a">
2024-10-16 18:58:07 +00:00
Sigurd Meldgaard
a9daf58829
Reland "Load parent package config" (#153754)
Reverts flutter/flutter#153752
Relands https://github.com/flutter/flutter/pull/150850

Now with attached g3fix
2024-08-20 15:30:46 +02:00
Sigurd Meldgaard
276674e760
Revert "Load parent package config" (#153752)
Reverts flutter/flutter#150850

Seems we need a G3Fix
2024-08-20 12:49:42 +02:00
Sigurd Meldgaard
1a2e25c2d8
Load parent package config (#150850)
Fixes #150196
2024-08-20 09:34:35 +02:00
Parker Lougheed
c946a5a526
Switch to more reliable flutter.dev link destinations in the tool (#150587)
Contributes to https://github.com/flutter/website/issues/10363.
2024-06-26 23:30:39 +00:00
stuartmorgan
3a27301013
Fix iOS reference in macOS Cocoapods error (#148506)
Fixes a Cocoapods error message that was hard-coded to reference iOS to instead reference iOS or macOS as appropriate.

Fixes https://github.com/flutter/flutter/issues/146744
2024-05-16 19:58:08 +00:00
Elliott Brooks
c1c7898b96
Bump dependencies in Flutter (#147546) 2024-04-29 15:53:25 -07:00
Victoria Ashworth
6d19fa3bfa
Add Swift Package Manager as new opt-in feature for iOS and macOS (#146256)
This PR adds initial support for Swift Package Manager (SPM). Users must opt in. Only compatible with Xcode 15+.

Fixes https://github.com/flutter/flutter/issues/146369.

## Included Features

This PR includes the following features:
* Enabling SPM via config 
`flutter config --enable-swift-package-manager`
* Disabling SPM via config (will disable for all projects) 
`flutter config --no-enable-swift-package-manager`
* Disabling SPM via pubspec.yaml (will disable for the specific project)
```
flutter:
  disable-swift-package-manager: true
```
* Migrating existing apps to add SPM integration if using a Flutter plugin with a Package.swift
  * Generates a Swift Package (named `FlutterGeneratedPluginSwiftPackage`) that handles Flutter SPM-compatible plugin dependencies. Generated package is added to the Xcode project.
* Error parsing of common errors that may occur due to using CocoaPods and Swift Package Manager together
* Tool will print warnings when using all Swift Package plugins and encourage you to remove CocoaPods

This PR also converts `integration_test` and `integration_test_macos` plugins to be both Swift Packages and CocoaPod Pods.

## How it Works
The Flutter CLI will generate a Swift Package called `FlutterGeneratedPluginSwiftPackage`, which will have local dependencies on all Swift Package compatible Flutter plugins.  

The `FlutterGeneratedPluginSwiftPackage` package will be added to the Xcode project via altering of the `project.pbxproj`. 

In addition, a "Pre-action" script will be added via altering of the `Runner.xcscheme`. This script will invoke the flutter tool to copy the Flutter/FlutterMacOS framework to the `BUILT_PRODUCTS_DIR` directory before the build starts. This is needed because plugins need to be linked to the Flutter framework and fortunately Swift Package Manager automatically uses `BUILT_PRODUCTS_DIR` as a framework search path.

CocoaPods will continue to run and be used to support non-Swift Package compatible Flutter plugins.

## Not Included Features

It does not include the following (will be added in future PRs):
* Create plugin template
* Create app template
* Add-to-App integration
2024-04-18 21:12:36 +00:00
Chris Bracken
d0670f0591
[macOS,iOS] CocoaPods recommended version: 1.13.0 (#135447)
Due to changes in Xcode 15, several variables such as `DT_TOOLCHAIN_DIR`
have been eliminateed in favour of others such as `TOOLCHAIN_DIR`. This
broke CocoaPods support under Xcode 15, as reported in:
https://github.com/CocoaPods/CocoaPods/issues/12012

@vashworth worked around this in Flutter in:
https://github.com/flutter/flutter/pull/132803

The CocoaPods issue was resolved by the following PR to their repo:
https://github.com/CocoaPods/CocoaPods/pull/12009
and was released in CocoaPods 1.13.0.

Also switches from an if-else chain to a switch for CocoaPodsStatus
handling.

Related: https://github.com/flutter/flutter/issues/133584
Related: https://github.com/flutter/flutter/issues/132755

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat

Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
2023-12-15 11:16:52 -08:00
stuartmorgan
d628a6ff97
Give an actionable error message when a Pod requires a higher minimum OS version (#138097)
Checks `pod install` output for the case where a pod requires a higher minimum OS deployment target version than the app is set to use, and attempts to turn it into a more actionable error message. This isn't foolproof since we are parsing the Ruby rather than actually executing it, but I would expect that the vast majority of cases would end up in the most useful version (and even those that don't are still much clearer with this as the final error message text than without it).

Fixes https://github.com/flutter/flutter/issues/113762
2023-11-27 16:22:54 +00:00
Elias Yishak
48187028c1
Add commandHasTerminal parameter + apple usage event + sendException events for package:unified_analytics (#138806)
Relates to tracker issue:
- https://github.com/flutter/flutter/issues/128251

This PR includes 3 major updates:
- Adding the `commandHasTerminal` parameter for `Event.flutterCommandResult`
  - In `packages/flutter_tools/lib/src/runner/flutter_command.dart`
- Adding the new event for `sendException` from package:usage to be `Event.exception` (this event can be used by all dash tools)
  - In `packages/flutter_tools/lib/runner.dart`
- Migrating the generic `UsageEvent` which was only used for Apple related workflows for iOS and macOS. I did an initial analysis in this [sheet](https://docs.google.com/spreadsheets/d/11KJLkHXFpECMX7tw-trNkYSr5MHDG15XNGv6TgLjfQs/edit?resourcekey=0-j4qdvsOEEg3wQW79YlY1-g#gid=0) to identify all the call sites
  - Found in several files, highlighted in the sheet above
2023-11-22 12:25:10 +00:00
Jenn Magder
d4934fb6ab
Add readlink -f flag to CocoaPods script to workaround Xcode 14.3 issue (#124062) 2023-04-03 16:55:00 -07:00
Todd Volkert
c4ef072369
Cocoapods ffi error can be in stdout or stderr (#121470)
Cocoapods ffi error can be in stdout or stderr
2023-02-28 00:11:29 +00:00
Ian Hickson
6205c110d6
Remove "note that" in our documentation (as per style guide) (#120842)
* lerp documentation

* Remove Note, Note That from repo

* Improve BorderSide documentation.

* apply review comments
2023-02-17 22:27:33 +00:00
Jonah Williams
db829c1e20
[flutter_tools] migrate more unit tests to null safety (#106153) 2022-06-17 21:34:27 -07:00
Michael Goderbauer
3fa355c97d
Remove dead code in tools tests (#104567) 2022-05-25 12:48:17 -07:00
Jenn Magder
bf7a32628e
Up CocoaPods minumum to 1.10 (#103655) 2022-05-16 17:42:19 -07:00
Jenn Magder
2e1c146eec
Update ffi gem installation instructions (#103008) 2022-05-04 13:24:08 -07:00
Jenn Magder
c9825d24dd
Handle CocoaPods ffi stderr (#102327) 2022-04-21 15:49:08 -07:00
Jenn Magder
fe11f57c61
Detect ARM ffi CocoaPods bus error (#101796) 2022-04-14 14:34:10 -07:00
Jenn Magder
320d2cff64
Increase recommended CocoaPods version to 1.11 (#98621) 2022-02-24 12:11:21 -08:00
Jenn Magder
f7bd20fc09
Detect additional ARM ffi CocoaPods error (#94385) 2021-12-07 15:29:03 -08:00
Greg Spencer
52ae102f18
Adds tool warning log level and command line options to fail on warning/error output (#92031) 2021-11-10 16:13:04 -08:00
Jenn Magder
aff69e43ef
Add integration_test to flavor test project (#92520) 2021-10-27 12:53:05 -07:00
Hattomo (TomohiroHattori)
08a70e7ac8
Enable avoid_escaping_inner_quotes lint (#81153) 2021-05-19 09:54:02 -07:00
Jenn Magder
db3f49b1b4
Use cached Xcode build settings during iOS build (#80904) 2021-04-27 17:20:11 -07:00
Jenn Magder
56c0002c47
Adopt FakeProcessManager.empty (#80480) 2021-04-15 14:19:02 -07:00
Jenn Magder
d40cc5af8f
Migrate flutter_tool plugins.dart to null safety (#80304) 2021-04-13 13:52:58 -07:00
Jenn Magder
ba764ebc38
Update Podfile.lock modified timestamp when pod install is run (#78823) 2021-04-06 15:54:02 -07:00
Jenn Magder
8ddc27e607
Split globals.dart into null sound and unsound libraries (#79016) 2021-03-31 16:55:20 -07:00
Jenn Magder
5a6d2a0a8e
Check for outdated Podfile before running pod install (#79343) 2021-03-30 12:42:39 -07:00
Jenn Magder
0cf1007276
Remove mocks from cocoapods_test (#78279) 2021-03-16 13:53:04 -07:00
Sam Rawlins
ba58ad0385
Remove "unnecessary" imports in test/general.shard (#75954) 2021-02-18 13:38:24 -08:00
Jonah Williams
04182572f7
[flutter_tools] allow bypassing context for FlutterProject creation, remove fromPath (#76258) 2021-02-18 12:36:04 -08:00
Jenn Magder
ba5e237e24
Avoid duplicating Pods-Runner xcconfig #includes (#75822) 2021-02-11 14:11:15 -08:00
Jonah Williams
021311ed8a
Revert "[flutter_tools] move process manager into tool (#75350)" (#75639)
This reverts commit 8b6baae44c.
2021-02-08 09:21:46 -08:00
Jonah Williams
8b6baae44c
[flutter_tools] move process manager into tool (#75350)
Our current top crasher is an unclear error when ProcessManager fails to resolve an executable path. To fix this, we'd like to being adjusting the process resolution logic and adding more instrumentation to track failures. In order to begin the process, the ProcessManager has been folded back into the flutter tool
2021-02-04 13:19:11 -08:00
Jenn Magder
dc30327a4d
Replace MockProcessManager with FakeProcessManager in cocoapods_test (#74956) 2021-01-29 14:32:33 -08:00