Commit Graph

26 Commits

Author SHA1 Message Date
Andrew Kolos
907bbe1bbe
refactor asset bundle code to not depend on the global Cache.flutterRoot (#142277)
Fixes https://github.com/flutter/flutter/issues/142285.

Part of work on https://github.com/flutter/flutter/pull/141194.

This is a refactor. There should be no changes in tool behavior.
2024-01-26 22:01:26 +00:00
Andrew Kolos
cfe4fedca2
rename generated asset manifest file back to AssetManifest.bin (from AssetManifest.smcbin) (#128529)
Closes https://github.com/flutter/flutter/issues/128456, which is now linked to in a code comment in this change.
Reopens https://github.com/flutter/flutter/issues/124883.

This effectively reverts https://github.com/flutter/flutter/pull/126077 and is intended to be cherry-picked into stable.
2023-06-09 21:20:50 +00:00
Andrew Kolos
759ebef689
Do not try to load main/default asset image if only higher-res variants exist (#128143)
Fixes https://github.com/flutter/flutter/issues/127090.

https://github.com/flutter/flutter/pull/122505 did a few things to speed up the first asset load that a flutter app performs. One of those things was to not include the main asset in its own list of variants in the asset manifest. The idea was that we know that the main asset always exists, so including it in its list of variants is a waste of storage space and loading time (even if the cost was tiny).

However, the assumption that the main asset always exists is wrong. From [Declaring resolution-aware image assets](https://docs.flutter.dev/ui/assets-and-images#resolution-aware), which predates https://github.com/flutter/flutter/pull/122505:

> Each entry in the asset section of the pubspec.yaml should correspond to a real file, with the exception of the main asset entry. If the main asset entry doesn’t correspond to a real file, then the asset with the lowest resolution is used as the fallback for devices with device pixel ratios below that resolution. The entry should still be included in the pubspec.yaml manifest, however.

For example, it's valid to declare `assets/image.png` as an asset even if only `assets/3x/image.png` exists on disk.

This fix restores older behavior of including a main asset as a variant of itself in the manifest if it exists.

This fix also includes a non-user-visible behavior change:
* `"dpr"` is no longer a required field in the asset manifest's underlying structure. For the main asset entry, we do not include `"dpr"`. It makes less sense for the tool to decide what the default target dpr for an image should be. This should be left to the framework.
2023-06-07 03:19:15 +00:00
Andrew Kolos
4a9660881e
Reland "Stop recursively including assets from asset directories" (#120312)
* stop recursively including assets from asset directories

* remove unused imports

* lint
2023-02-08 21:41:19 +00:00
Mouad Debbar
7f578fb01f
Revert "Stop recursively including assets from asset folders (#120167)" (#120283)
This reverts commit da36bd6fc0.
2023-02-08 10:42:02 -05:00
Andrew Kolos
da36bd6fc0
Stop recursively including assets from asset folders (#120167)
* add test

* fix

* use preexisting testFileSystem

* fix variant tests

* Revert "use preexisting testFileSystem"

This reverts commit b6df288ef4.

* nit: grammar
2023-02-07 16:20:23 +00:00
Casey Hillers
7673108d7e
Revert "Speed up first asset load by encoding asset manifest in binary rather than JSON (#113637)" (#116662)
This reverts commit 56cad89b1e.
2022-12-07 17:29:05 +00:00
Andrew Kolos
56cad89b1e
Speed up first asset load by encoding asset manifest in binary rather than JSON (#113637) 2022-12-05 10:39:10 -08:00
Andrew Kolos
f8c9f72b94
URI-decode asset paths before writing them to the asset manifest (#112415) 2022-10-01 01:09:06 +00:00
Andrew Kolos
cb5b5c3459
Tighten asset variant detection criteria to only include device-pixel-ratio variants (#110721) 2022-09-27 20:57:33 +00:00
Jonah Williams
db829c1e20
[flutter_tools] migrate more unit tests to null safety (#106153) 2022-06-17 21:34:27 -07:00
Jenn Magder
9e88fe328e
Remove globals_null_migrated.dart, move into globals.dart (#92861) 2021-11-01 17:18:03 -07:00
Jenn Magder
8ddc27e607
Split globals.dart into null sound and unsound libraries (#79016) 2021-03-31 16:55:20 -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
Jonah Williams
f98c468317
[flutter_tools] remove unused JSON schema (#70480) 2020-11-13 13:02:40 -08:00
Jonah Williams
dbcd7868a4
[flutter_tools] remove most globals from asset system and remove Cache manipulation in unit tests (#70011) 2020-11-09 18:01:04 -08:00
Jonah Williams
82a6f9bf0b
[flutter_tools] remove most use of global packages path (#60231)
The global packages path could cause tests to fail when it would be overriden to unexpected (in test setup) values. Remove most usage and make it a configuration on buildInfo, along with most other build information. Cleanup the asset builder to require the .packages path and the resident runners to no longer require it, since they already have the information in build_info.

It needs to stick around for the fuchsia deps we do not control.

Filled #60232 for remaining work.
2020-06-25 12:52:14 -07:00
Alexandre Ardhuin
c2ae654ddf
enable avoid_single_cascade_in_expression_statements (#51944) 2020-03-05 08:03:26 +01:00
Alexandre Ardhuin
4f9b6cf017
enable lint prefer_final_in_for_each (#47724) 2020-01-07 16:32:04 +01:00
Jonah Williams
ee7a37f1d3
[flutter_tools] Ensure that global variables are easily identifiable (#47398) 2020-01-06 11:04:20 -08:00
Ian Hickson
449f4a6673
License update (#45373)
* Update project.pbxproj files to say Flutter rather than Chromium

Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright.

* Update the copyright notice checker to require a standard notice on all files

* Update copyrights on Dart files. (This was a mechanical commit.)

* Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine.

Some were already marked "The Flutter Authors", not clear why. Their
dates have been normalized. Some were missing the blank line after the
license. Some were randomly different in trivial ways for no apparent
reason (e.g. missing the trailing period).

* Clean up the copyrights in non-Dart files. (Manual edits.)

Also, make sure templates don't have copyrights.

* Fix some more ORGANIZATIONNAMEs
2019-11-27 15:04:02 -08:00
Jonah Williams
4c677e4148
Extra defensive programming for pub modification time assert (#43315) 2019-10-22 22:05:00 -07:00
Jonah Williams
46ea99122b
Revert "Extra defensive programming for pub modification time assert (#42491)" (#43235)
This reverts commit 3597bae6a0.
2019-10-21 20:54:02 -07:00
Ian Hickson
3597bae6a0 Extra defensive programming for pub modification time assert (#42491) 2019-10-21 20:15:20 -07:00
Ian Hickson
08643c41d7
Always fake ProcessManager when you fake Filesystem in tests (#42369)
...because otherwise, processes that think they're manipulating your
filesystem will be doing crazy things the test is ignoring, leading to
(at best) failures and (at worst) flakes or disk corruption.
2019-10-11 11:23:12 -07:00
Ian Hickson
d919e694b8
Move tools tests into a general.shard directory in preparation to changing how we shard tools tests (#36108) 2019-07-13 11:51:44 -07:00