Commit Graph

32 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
August
45f431fde9
feat: Arbitrary format options for localizations generation (#102983) (#167029)
Migration of Localization Generation [Option
1](https://docs.flutter.dev/release/breaking-changes/flutter-generate-i10n-source#migration-guide)
breaks `dart format . --set-exit-if-changed` checks (as commonly used in
pipelines), as the generated file does not comply the `dart format`
rules.

This PR:
- Formats the generated localization files by default
- In contrast to [this
comment](https://github.com/flutter/flutter/pull/109171#issuecomment-1209710029)
I don't see it as breaking as the files are generated dynamically on
every change and there's no need in migrating them. Also any tests
should not fail as either the format was done manually afterwards
anyways, or the formatting was not checked at all (in third party apps /
libraries) as the output had not a correct format in any use case of
checking via `dart format`.
- Add tests for `no-format`
- Add option to add arbitrary arguments to the `dart format` command to
allow customized formatting

Closes #167982
Contributes to:
https://github.com/flutter/flutter/issues/102983#issuecomment-2707419112

*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

## 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
2025-04-30 02:56:28 +00:00
Matan Lurey
8b9b6a39af
Fix tests to prepare for --explicit-package-dependencies and a bug. (#162289)
@camsim99 discovered these would fail here:
https://github.com/flutter/flutter/pull/161826#issuecomment-2617059566.

This fixes in preparation for the flag flipping, and also fixes a bug in
resolving `synthetic-package` I missed (it _can't_ be true if
`--explicit-package-dependencies` is set).
2025-01-29 02:04:50 +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
cb8c15c4f3
Replace --no-implicit-pubspec-resolution with flutter config --explicit-package-dependencies. (#160400)
This was a mistake, and should have already been removed and cleaned up.

Part of https://github.com/flutter/flutter/issues/160257.
2024-12-17 03:11:07 +00:00
Matan Lurey
f177d8aab4
Migrate test/commands.shard (mostly) to explicit-package-dependencies. (#160288)
Towards https://github.com/flutter/flutter/issues/160257.

I intentionally skipped `create_test.dart`, as that requires updating
the generated template which uses l10n, a feature changing. I'll do that
in the "big bang" PR that finally enables the feature to avoid getting
us into a bad state.
2024-12-16 22:59:16 +00:00
Michael Goderbauer
f601ed1862
Bump Dart SDK to 3.7 (#159812) 2024-12-05 21:39:53 +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
Polina Cherkasova
04d3d1a4c3
Reland1: "Revert "Add and plumb useImplicitPubspecResolution across flutter_tools."" (#158126)
Reverts flutter/flutter#158076
2024-11-05 08:49:42 -08:00
Polina Cherkasova
0505176f1b
Revert "Add and plumb useImplicitPubspecResolution across flutter_tools." (#158076)
Reverts flutter/flutter#157879 to unblock flutter roll.

Prerequisite reverts:
https://github.com/flutter/flutter/pull/157934

Reason: b/377107864
2024-11-03 17:29:24 +00:00
Matan Lurey
fb022290ff
Add and plumb useImplicitPubspecResolution across flutter_tools. (#157879)
Work towards https://github.com/flutter/flutter/issues/157819. **No behavior changes as a result of this PR**.

Based on a proof of concept by @jonahwilliams (https://github.com/flutter/flutter/pull/157818).

The existence of this flag (which for the time being, defaults to `true`) implies the following:

1. The (legacy, deprecated) `.flutter-plugins` file is not generated:
    https://docs.flutter.dev/release/breaking-changes/flutter-plugins-configuration
    
2. The (legacy, deprecated) `package:flutter_gen` is not synthetically generated:
    https://github.com/flutter/website/pull/11343
    (awaiting website approvers, but owners approve this change)

This change creates `useImplicitPubspecResolution` and plumbs it through as a required variable, parsing it from a `FlutterCommand.globalResults` where able. In tests, I've defaulted the value to `true` 100% of the time - except for places where the value itself is acted on directly, in which case there are true and false test-cases (e.g. localization and i10n based classes and functions).

I'm not extremely happy this needed to change 50+ files, but is sort of a result of how inter-connected many of the elements of the tools are. I believe keeping this as an explicit (flagged) argument will be our best way to ensure the default behavior changes consistently and that tests are running as expected.
2024-10-31 10:43:25 +00:00
Michael Goderbauer
240825a555
Enable private field promotion for flutter_tools (#134474)
New feature in upcoming Dart 3.2. See https://github.com/dart-lang/language/issues/2020. Feature is enabled by bumping the min SDK version to 3.2.

Part of https://github.com/flutter/flutter/issues/134476.
2023-09-12 20:20:04 +00:00
Alex Li
f2db93df01
🐛 Treat empty ARB content as empty map when decoding (#131242)
Fixes #128932.
2023-08-01 01:27:54 +00:00
Tae Hyung Kim
d75735eea6
Use platform specific line separator in gen-l10n (#130090)
Currently files are not generated with `\r\n` in windows. This PR should
fix the issue.

Fixes https://github.com/flutter/flutter/issues/109761.
2023-07-12 12:50:53 -07:00
Tae Hyung Kim
dabd7b3bb5
Throw error on unexpected positional arguments (#130274)
This PR fixes ignoring when random positional arguments added to the
`flutter gen-l10n`.

So we are no longer able to call `flutter gen-l10n hello world` or
`flutter gen-l10n --format false`.

Fixes https://github.com/flutter/flutter/issues/118203
2023-07-10 12:12:23 -07:00
Tae Hyung Kim
5596a0cdab
Fix gen-l10n format: true so that it applies to when it gets called via build target (#127886) 2023-05-31 15:25:54 -07:00
Tae Hyung Kim
5c44b1df0f
Refactor "gen-l10n" command to use same code path when "l10n.yaml" is present or not present (#125429)
I think this is a long needed change to the `gen-l10n` command.
Essentially, the arguments to `flutter gen-l10n` can be provided by two
different methods: via command line arguments or via the `l10n.yaml`
file. The existence of a `l10n.yaml` file causes the latter approach to
take precedence.

However, currently, there's several differences in how the two
approaches are handled, and most of the default arguments are all over
the place, causing unexpected issues such as #120457 or #120023.

This PR refactors the command so that
* `LocalizationOptions` are more consistent with the actual argument
names/yaml options.
* All default values are determined in `LocalizationOptions`'s
constructor (or in `argParser.addOption(...)` in the case a boolean
value needs to be explicitly true).
* New `parseLocalizationsOptionsFromCommand` function to parse
arguments.
* Parse `LocalizationOptions` at the beginning of `runCommand()` and
pass it to `generateLocalizations`.

Fixes #120023.
2023-04-26 11:49:25 -07:00
Tae Hyung Kim
b6c7df447d
l10n.yaml's nullable-getter option should default to true (#124353)
Currently, nullable-getter defaults to false when l10n.yaml is not present, which is not the same behavior as when an l10n.yaml file is present and nullable-getter is not set.

Fixes #120457.
2023-04-18 18:42:07 +00:00
Alex Li
4ae2d3b6df
🔥 Do not format the messages file for gen-l10n (#119596)
* 🔥 Do not format the messages file

*  Add test

*  Add the link to the test

*  Respect the path separator from the file system

*  Add the untranslated messages file existence test
2023-02-01 23:45:38 +00:00
Jackson Gardner
db1c3e208d
Platform binaries reland (#115502)
You can now specify a --local-web-sdk flag to point to a wasm_release folder. This will make it so that only artifacts that pertain to the web sdk are overridden to point to the wasm_release folder. Other artifacts (such as impellerc) will pull from the cache, or from the --local-engine path if that is specified.

This also uses precompiled platform kernel files for both ddc and dart2js
2022-12-02 14:13:40 -08:00
Liam Appelbe
22cef4898a
Null safety migration of packages/flutter_tools/test/commands.shard/hermetic, part 2/3 (#110708)
* Migrate packages/flutter_tools/test/commands.shard/hermetic, part 2/3

* Fix tests

* Fix analysis

* Chris's comments
2022-09-06 10:39:18 -07:00
Tae Hyung Kim
646666f8e7
[gen_l10n] Add option to format generated localizations files (#109171)
* init

* fix

* fix 2

* fix 3

* tests

* fix tests

* clarify help text

* fix all tests

* fix formatting?

* add second test

* unused import

* remove print

* trailing spaces

* artifacts is never null

* fix
2022-08-19 14:03:42 -07:00
Taha Tesser
d6d3283c8d
Fix flutter gen-l10n help message (#98147) 2022-02-11 01:40:14 -08:00
Jonah Williams
def601ac17
[flutter_tools] re-enable all tests on windows (#85384) 2021-06-27 05:26:02 -07:00
Alexandre Ardhuin
7d46d43635
use throwsXxx instead of throwsA(isA<Xxx>()) (#82328) 2021-05-12 09:59:02 -07:00
Sam Rawlins
133a55ae51
Remove "unnecessary" imports. (#81003) 2021-05-06 16:19:07 -07:00
Phil Quitslund
61c30c41b2
fix sort_directives violations (#80817) 2021-04-21 13:49:03 -07:00
Jenn Magder
a2f67720ef
Migrate test/src/common to null safety (#79907) 2021-04-06 22:55:03 -07: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
Shi-Hao Hong
a912030982
[gen_l10n] Use l10n.yaml file instead of command line arguments if it exists (#72950)
* Reorganize files

* Use l10n.yaml instead of command line args
2021-01-05 11:50:32 +08:00
Alexandre Ardhuin
73301a35a2
Sync lints (#68136) 2020-10-15 15:37:04 -07:00
Shi-Hao Hong
b80b432555
Move gen_l10n into flutter_tools (#65025) 2020-09-03 09:26:58 -07:00