Commit Graph

110 Commits

Author SHA1 Message Date
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
Michael Goderbauer
8fee7cb832
Adjust ignores for 'dart format' (#160382)
When running `dart format` over these lines the `// ignore` ended up on
a line where it wasn't properly ignoring the lint. This adjusts the
placement of `// ignore`s so they will continue to ignore the right
thing even after the code is auto formatted.

I am hoping that if we do this now the large PR that formats the entire
repo will go in smoother without manual intervention.
2024-12-16 22:01:25 +00:00
Andrew Kolos
c803c1346f
Remove more references to deprecated package:usage (executable, runner) (#160369)
Helps https://github.com/flutter/flutter/issues/150575

<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
2024-12-16 20:39:43 +00:00
Andrew Kolos
6b12651419
Fix analytics enabled/disabled event not being sent when the user enables/disables analytics (#160060)
Fixes https://github.com/flutter/flutter/issues/160058.

In addition, only send an event when the enabled-state of analytics
actually gets flipped.


<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
2024-12-12 19:59:50 +00:00
Andrew Kolos
9cd2fc90af
Handle ProcessExceptions due to git missing on the host (#154445)
Fixes https://github.com/flutter/flutter/issues/133585.

This PR elects to add a new catch within `_handleToolError` that checks any uncaught error. This new catch will exit the tool without crashing provided the following conditions are met:

1. the error is a `ProcessException`,
2. the error message contains `git` somewhere in the message (we don't match on the entire string in case it changes or is locale-dependent), and
3. `git` does not appear to be runnable on the host system (`ProcessManager.canRun` returns `false` for git).

This is preferable to checking for runnability of `git` before we run it for 1) its simplicity and 2) lack of performance penalty for users that already have git installed (almost every single one).

This PR also does some light refactoring to runner_test.dart to make room for tests that aren't related to crash reporting.
2024-09-09 20:47:05 +00:00
Andrew Kolos
ac6409b311
Swap crash reporting with unified analytics (#148525)
Fixes: https://github.com/flutter/flutter/issues/147260

(this is a remake of https://github.com/flutter/flutter/pull/147296; in hindsight I could have force-pushed there instead but 🤷)
2024-05-18 01:30:13 +00:00
Elias Yishak
be0eb721d5
Update docs around ga3 ga4 mismatch (#147075)
Fixing nit in code doc
2024-04-19 19:15:09 +00:00
Elias Yishak
1c3372fa38
Opt out users from GA3 if opted out of GA4 (#146453)
This PR will opt out users from legacy analytics if they have already been opted out from package:unified_analytics.

After successfully merging into main, this will be CP'd into beta and stable channels
2024-04-19 01:03:15 +00:00
Michael Goderbauer
3f09b23338
cleanup now-irrelevant ignores for deprecated_member_use (#143403)
Follow-up to https://github.com/flutter/flutter/pull/143347.
2024-02-14 21:08:25 +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
Ian Hickson
4d788b109d
Reduce animations further when --no-cli-animations is set. (#133598) 2023-11-16 21:05:22 +00:00
Elias Yishak
56ae555992
Unified analytics events for doctor validators (#136647)
Related to tracking issue:
- https://github.com/flutter/flutter/issues/128251

This PR sends analytic events for each of the doctor validators.

This PR below will need to land first in `dart-lang/tools` before this merges.
2023-10-26 18:23:24 +00:00
Christopher Fujino
3d7cd3594a
[flutter_tools] Run ShutdownHooks when handling signals (#134590)
Fixes https://github.com/flutter/flutter/issues/134566.

Prior to this fix, `ShutdownHooks` were run in the private helper
function `_exit()` defined in the `package:flutter_tools/runner.dart`
library. Independent of this, the tool had signal handling logic that
traps SIGINT and SIGTERM. However, these handlers called `exit()` from
`dart:io`, and didn't run these hooks.

This PR moves the `_exit()` private helper to
`package:flutter_tools/src/base/process.dart` and renames it to
`exitWithHooks()`, so that it can be called by the signal handlers in
`package:flutter_tools/src/base/signals.dart`.
2023-09-13 13:05:29 -07:00
Elias Yishak
e9beaea061
Clean up analytics opt in/out flags (#132588)
Fixes:
- #132258
2023-09-12 22:49:05 +00:00
Ian Hickson
487bd69078
Support disabling animations in the CLI (#132239) 2023-08-23 03:35:22 +00:00
Elias Yishak
0d5875274b
Clearer text about what happens with --disable-telemetry + enable-telemetry command (#125995)
Fixes:
- https://github.com/flutter/flutter/issues/124411

This PR is cleaning up the `--disable-telemetry` help message to make it clear that opting out will opt out of all telemetry collection for flutter and dart commands. It is also adding the opposite flag `--enable-telemetry` which will enable telemetry collection
2023-05-08 13:01:25 +00:00
Elias Yishak
ca3a900d5d
[reland] Update helper message for --suppress-analytics (#125145)
Relanding: https://github.com/flutter/flutter/pull/124810

Fixes: https://github.com/flutter/flutter/issues/124808
2023-04-19 18:51:08 +00:00
godofredoc
03d725620a
Revert "Update helper message for --suppress-analytics" (#125141)
Reverts flutter/flutter#124810
2023-04-19 16:43:29 +00:00
Elias Yishak
3476b96652
Update helper message for --suppress-analytics (#124810)
Fixes: https://github.com/flutter/flutter/issues/124808
2023-04-19 14:00:20 +00:00
Elias Yishak
51b23bc961
Update runner to handle logic for both analytics packages (#124606)
Update runner to handle logic for both analytics packages
2023-04-12 19:34:11 +00:00
Elias Yishak
a32f0bb7a0
Add analytics package + setTelemetry method attached (#124015)
The first of many PRs for transitioning to `package:unified_analytics`.
This PR is only focused on disabling and enabling telemetry via the
`flutter config --[no-]analytics` flag

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

## 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: Christopher Fujino <fujino@google.com>
Co-authored-by: Christopher Fujino <christopherfujino@gmail.com>
2023-04-05 14:08:56 -04:00
Lau Ching Jun
944a4c9714
Write crash report in temp directory if writing to CWD failed. (#113316) 2022-10-12 17:13:24 +00:00
Christopher Fujino
08d5d51a98
[flutter_tools] Instantiate shutdown hooks before localfilesystem (#110693) 2022-09-02 17:38:56 +00:00
Pierre-Louis
0c2f7bc2a2
Remove errant double spaces (#110758) 2022-09-02 04:00:58 +00:00
Jonah Williams
92034482f9
[flutter_tool] partial null safety migration of tool source code (#105798) 2022-06-15 20:02:07 +00:00
Jenn Magder
1c0eade94c
Hide PII from doctor validators for GitHub template (#96250) 2022-01-10 13:20:21 -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
868e417e57
Remove globals_null_migrated.dart, move into globals.dart (#92948) 2021-11-03 12:53:04 -07:00
Jenn Magder
8865212254
Migrate doctor to null safety (#92131) 2021-11-01 12:13:02 -07:00
Ian Hickson
299d484903
Enable more lints (#91642) 2021-10-14 22:03:03 -07:00
Ian Hickson
61a0add286
Enable avoid_redundant_argument_values lint (#91409) (#91462) 2021-10-08 09:25:14 -07:00
Zachary Anderson
b9d2177da0
Revert "Enable avoid_redundant_argument_values lint (#91409)" (#91461)
This reverts commit 5fd259be24.
2021-10-07 21:11:07 -07:00
Ian Hickson
5fd259be24
Enable avoid_redundant_argument_values lint (#91409) 2021-10-07 20:13:02 -07:00
Jonah Williams
63a4013160
Revert "[flutter_tools] let the logger know about machine mode (#86116)" (#86363)
This reverts commit 53d8cba3ec.
2021-07-13 10:39:35 -07:00
Jonah Williams
53d8cba3ec
[flutter_tools] let the logger know about machine mode (#86116) 2021-07-12 10:41:03 -07:00
Jenn Magder
e29595d4b6
Remove crash_reporting and github_template from reporting library (#80139) 2021-04-09 15:24:15 -07:00
Jonah Williams
cf903d7392
[flutter_tools] remove globals from process, filesystem (#78357) 2021-03-22 10:35:40 -07:00
Michael Goderbauer
cb867bbedc
Enable unnecessary_await_in_return lint (#77434) 2021-03-05 18:38:15 -08:00
Michael Goderbauer
7b251f5f37
Enable use_function_type_syntax_for_parameters lint (#77163) 2021-03-04 08:59:17 -08:00
Ian Hickson
ce318b7b53
All arguments must be documented. (#75888) 2021-02-14 12:56:05 -08:00
Jonah Williams
fb808b40f9
[flutter_tools] add package:http to forbidden imports test (#75925) 2021-02-12 14:23:08 -08:00
Jonah Williams
74bd7b6f6d
[flutter_tools] opt all flutter tool libraries and tests out of null safety. (#74832)
* opt out the flutter tool

* oops EOF

* fix import

* Update tool_backend.dart

* Update daemon_client.dart

* fix more
2021-01-27 15:17:53 -08:00
Jonah Williams
b1e99182a8
Move async guard wrapping of crash reporter up a level (#73877) 2021-01-13 14:14:07 -08:00
Jonah Williams
08576cb671
[flutter_tools] HACKTOBERFEST (#67882)
HACKTOBERFEST
2020-10-12 09:31:02 -07:00
Jonah Williams
bd3eee75f3
[flutter_tools] rethrow process exceptions as tool exit from gradle build (#64745)
The flutter tool is currently unable to detect missing permissions in gradle/gradle.bat that would cause a gradle build to fail via process exception. Rather than crashing and exiting, we can display the exception as an error message and tool exit.

While linux/macOS are able to add the +x bit, this is not possible on windows with our current file system/OS API. These crashes represent a substantial amount of crash reporting, but are otherwise not actionable on our end.
2020-09-03 11:55:55 -07:00
James D. Lin
c21b3233e4
[flutter tools] Don't return success if we trigger runZoned's error callback (#58474) 2020-06-15 09:35:04 -07:00
Jonah Williams
f5de6aadd4
[flutter_tools] remove zone level overrides of verbose and daemon logging (#57448)
Make it possible for all FlutterCommands to be global free, by moving instantiation to inside the Zone context. Additionally, provide VerboseLogger and NotifyLogger (daemon) at the top level and remove from command-specific overrides.

This allows removing a work around where web devices needed to look up directly from the context in non-test code.

Technically the output preferences are still zone injected, but these will be moved soon as they were not being used correctly by the top level command (the injection comes after ArgParser reads the overflow values, causing numerous wrap issues)
2020-06-04 16:35:36 -07:00
James D. Lin
b7fd24a7dc
[flutter tools] Move _informUserOfCrash into crash_reporting.dart (#55614) 2020-04-28 10:34:03 -07:00
James D. Lin
566c1d1124
flutter_tools: Prefer using .of() over .from() when possible (#55250)
Prefer using `.of()` (which is statically type-checked) over
`.from()` (which is dynamically type-checked) when possible.
2020-04-21 22:09:50 -07:00
Jenn Magder
8109dcc2b4
CrashReportSender dependency injection (#54924) 2020-04-20 15:23:09 -07:00