Commit Graph

55 Commits

Author SHA1 Message Date
Christopher Fujino
195dca02c0
[flutter_tools] Fix "FormatException: Invalid date format" during version freshness check (#134088)
Fixes https://github.com/flutter/flutter/issues/134067
2023-09-06 17:22:13 +00:00
Christopher Fujino
9e59a68c98
[flutter_tools] Fix legacy version file not being ensured (#133097)
Fixes https://github.com/flutter/flutter/issues/133093

When I introduced the new, more robust version file `//flutter/bin/cache/version.json` in https://github.com/flutter/flutter/pull/124558, I changed `class FlutterVersion` into an abstract interface, implemented by `_FlutterVersionFromGit` (which is essentially the previous behavior) and `_FlutterVersionFromFile`, which merely reads the data it would have computed via git from `//flutter/bin/cache/version.json`.

While doing this, I made `_FlutterVersionFromGit.ensureVersionFile()` to be a no-op, since I assumed this would not be necessary since we already had a version file in the cache. However, this method was what was previously responsible for ensuring `//flutter/version` existed on disk. This means that if, for whatever reason, the user had `//flutter/bin/cache/flutter.version.json` present but NOT `//flutter/version`, the tool would have never created that file, and they would hit the tool crash seen in https://github.com/flutter/flutter/issues/133093.

This fixes the tool by ensuring `//flutter/version` exists regardless of if we're hydrating `FlutterVersion` from `//flutter/bin/cache/flutter.version.json` or not.
2023-08-23 18:31:06 +00:00
Alex Li
7d64c676dd
️ Add ssh://git@github.com/flutter/flutter.git as a standard remote (#131333)
Resolves #98020.
2023-07-27 22:09:03 +00:00
Christopher Fujino
3246808cd2
[flutter_tools] cache flutter sdk version to disk (#124558)
Fixes https://github.com/flutter/flutter/issues/112833

Most of the actual changes here are in [packages/flutter_tools/lib/src/version.dart](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605), while the rest is largely just addressing changes to the constructor of `FlutterVersion` which now has different dependencies.

This change makes `FlutterVersion` an interface with two concrete implementations:

1. `_FlutterVersionGit` which is mostly the previous implementation, and
2. `_FlutterVersionFromFile` which will read a new `.version.json` file from the root of the repo

The [`FlutterVersion` constructor](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605R70) is now a factory that first checks if `.version.json` exists, and if so returns an instance of `_FlutterVersionFromGit` else it returns the fallback `_FlutterVersionGit` which will end up writing `.version.json` so that we don't need to re-calculate the version on the next invocation.

`.version.json` will be deleted in the bash/batch entrypoints any time we need to rebuild he tool (this will usually be because the user did `flutter upgrade` or `flutter channel`, or manually changed the commit with git).
2023-06-15 00:20:30 +00:00
Ian Hickson
9c7a9e779f
Give channel descriptions in flutter channel, use branch instead of upstream for channel name (#126936)
## How we determine the channel name

Historically, we used the current branch's upstream to figure out the current channel name. I have no idea why. I traced it back to https://github.com/flutter/flutter/pull/446/files where @abarth implement this and I reviewed that PR and left no comment on it at the time.

I think this is confusing. You can be on a branch and it tells you that your channel is different. That seems weird.

This PR changes the logic to uses the current branch as the channel name.

## How we display channels

The main reason this PR exists is to add channel descriptions to the `flutter channel` list:

```
ianh@burmese:~/dev/flutter/packages/flutter_tools$ flutter channel
Flutter channels:
  master (tip of tree, for contributors)
  main (tip of tree, follows master channel)
  beta (updated monthly, recommended for experienced users)
  stable (updated quarterly, for new users and for production app releases)
* foo_bar

Currently not on an official channel.
ianh@burmese:~/dev/flutter/packages/flutter_tools$
```

## Other changes

I made a few other changes while I was at it:

* If you're not on an official channel, we used to imply `--show-all`, but now we don't, we just show the official channels plus yours. This avoids flooding the screen in the case the user is on a weird channel and just wants to know what channel they're on.
* I made the tool more consistent about how it handles unofficial branches. Now it's always `[user branch]`.
* I slightly adjusted how unknown versions are rendered so it's clearer the version is unknown rather than just having the word "Unknown" floating in the output without context.
* Simplified some of the code.
* Made some of the tests more strict (checking all output rather than just some aspects of it).
* Changed the MockFlutterVersion to implement the FlutterVersion API more strictly.
* I made sure we escape the output to `.metadata` to avoid potential injection bugs (previously we just inlined the version and channel name verbatim with no escaping, which is super sketchy).
* Tweaked the help text for the `downgrade` command to be clearer.
* Removed some misleading text in some error messages.
* Made the `.metadata` generator consistent with the template file.
* Removed some obsolete code to do with the `dev` branch.

## Reviewer notes

I'm worried that there are implications to some of these changes that I am not aware of, so please don't assume I know what I'm doing when reviewing this code. :-)
2023-05-23 19:59:20 +00:00
Christopher Fujino
8361465f77
[flutter_tools] change the way version is calculated on master (#110791) 2022-09-01 20:32:36 +00:00
Jenn Magder
7c7ae991e5
Use hasNoRemainingExpectations matcher for fake process manager in tool tests (#108649) 2022-07-30 02:02:05 +00:00
Jonah Williams
db829c1e20
[flutter_tools] migrate more unit tests to null safety (#106153) 2022-06-17 21:34:27 -07:00
Phil Quitslund
b5e7fb076c
[flutter_tools] rename local functions with _s (#102688) 2022-04-27 16:19:07 -07:00
Anurag Roy
ae805de468
[flutter_tools] Remove usage of globals.flutterGit from version (#100744) 2022-04-14 14:44:09 -07:00
Anurag Roy
e7ab846d14
[flutter_tools] Fix VersionUpstreamValidator to respect FLUTTER_GIT_URL (#100605) 2022-03-25 17:35:10 -07:00
Anurag Roy
74f08c7352
[flutter_tools] Skip version freshness check for non-standard remotes (#97202) 2022-03-22 12:50:21 -07:00
Christopher Fujino
1d59d8d341
[flutter_tools] increment y instead of m when calling flutter --version on master (#97827) 2022-02-04 13:35:29 -08:00
Jenn Magder
3c0f3f4ee1
Add boxes around version freshness alerts (#96152) 2022-01-18 17:28:32 -08:00
Christopher Fujino
2d2cd1f5c0
[flutter_tools] Refactor checkVersionFreshness (#95056) 2021-12-28 17:59:16 -08:00
Kenzie (Schmoll) Davisson
7748731903
Add DevTools version to flutter --version and flutter doctor -v output. (#93065)
* Add DevTools version to `flutter --version` output.

* review comments

* fix test

* add explanatory comment

* dummy commit to kick bots

Co-authored-by: Christopher Fujino <christopherfujino@gmail.com>
2021-11-11 14:40:22 -08:00
Jenn Magder
9e88fe328e
Remove globals_null_migrated.dart, move into globals.dart (#92861) 2021-11-01 17:18: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
04933efb43
[flutter_tools] fully remove mocks from version_test.dart (#84311) 2021-06-10 11:09:03 -07:00
Jonah Williams
6a75e48607
[flutter_tools] remove substantial mocking from version test (#84007) 2021-06-08 10:47:03 -07:00
Jenn Magder
56c0002c47
Adopt FakeProcessManager.empty (#80480) 2021-04-15 14:19:02 -07:00
Jenn Magder
12ba9046d7
Migrate tool version to null safety (#79911) 2021-04-07 16:49:23 -07:00
Chris Bracken
3e7e06512c
Correct misspellings throughout the codebase (#79500) 2021-04-01 10:04:03 -07:00
Jenn Magder
d018c24bb8
MockProcessUtils->FakeProcessManager in version_test (#77985) 2021-03-12 16:38:04 -08:00
Michael Goderbauer
807bb29888
enable prefer_function_declarations_over_variables lint (#77398) 2021-03-05 18:29:04 -08:00
Sam Rawlins
ba58ad0385
Remove "unnecessary" imports in test/general.shard (#75954) 2021-02-18 13:38:24 -08:00
Sam Rawlins
e8d52be500
Remove "unnecessary" imports in flutter_tools tests (#75012) 2021-02-09 09:46:07 -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
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
Anurag Roy
05dadb0120
[flutter_tools] Make flutter upgrade --verify-only display framework version differences instead of commit hashes (#69420) 2020-11-19 18:03:05 -08:00
Jonah Williams
0b88269807
[flutter_tools] remove branch migration and standardize constructor style for version interface (#70058) 2020-11-12 15:29:03 -08:00
Dan Field
cfcb9887c9
Do not use --first-parent when determining version on master (#69726) 2020-11-05 10:11:32 -08:00
includecmath
71c42c9c54
[flutter_tools] Add channel order aware version_test (#62417) 2020-09-24 13:07:03 -07:00
Jenn Magder
f654346777
Check git commands in Flutter version check test (#66406) 2020-09-23 13:27:24 -07:00
Christopher Fujino
8dcb4c338a
Fix version parsing to use git tag --points-at (#63505) 2020-08-11 17:29:35 -07:00
Chris Yang
c9cd825fca
[flutter_tools] flutter version reports picks up release versions (#63019) 2020-08-05 15:20:27 -07:00
雷宇辰
7779a14794
[flutter_tools] Make flutter git upstream configurable (#61513) 2020-07-24 16:16:31 -07:00
Konstantin Scheglov
741e9675e7
Remote returns for function expression inferred return type void. (#61582) 2020-07-17 09:36:03 -07:00
Jonah Williams
eae77804fe
[flutter_tools] use -f when fetching tags (#58703)
use -f to overwrite local tags on master branch
2020-06-04 13:54:32 -07:00
Christopher Fujino
37ac9015ad
[flutter_tools] check first for stable tag, then dev tag (#55342) 2020-04-23 15:19:27 -07:00
Christopher Fujino
19c8948e61
Fix frameworkVersionFor for flutter doctor and usage (#54217) 2020-04-08 12:47:05 -07:00
Christopher Fujino
2396616e09
Support old and new git release tag formats (#53715) 2020-04-03 09:39:28 -07:00
Dan Field
c8efcb632b
Only fetch tags when not on dev/beta/stable (#53450) 2020-03-27 22:31:01 -07:00
Dan Field
e13e17009d
Reland fix --version (#52141) 2020-03-06 21:38:35 -08:00
Jonah Williams
e7d70fbf75
Revert "Fix version command for certain git workflows (#52062)" (#52128)
This reverts commit 20bf43b9eb.
2020-03-06 12:58:00 -08:00
Dan Field
20bf43b9eb
Fix version command for certain git workflows (#52062) 2020-03-05 23:51:02 -08:00
Jenn Magder
7f715628b0 Replace FlutterVersion.instance with FlutterVersion context fetch in global.dart (#49462) 2020-01-27 17:38:01 -08:00