Commit Graph

33 Commits

Author SHA1 Message Date
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
d3e0e03e2e
rename AssetManifest.bin (#126077)
Fixes #124883. Will require a g3fix.

Renames `AssetManifest.bin` to `AssetManifest.smcbin` (madeup extension for "Standard Message Codec binary").
2023-05-15 15:45:09 +00:00
Andrew Kolos
5630d531b1
[tool] Generate a binary version of the asset manifest (#117233)
* initial

* update asset_bundle_package_test

* Update asset_bundle_test.dart

* Update asset_bundle_package_fonts_test.dart

* update pubspec checksum for smc dependency

* flutter update-packages --force-upgrade

* prefer += 1 over ++

Co-authored-by: Jonah Williams <jonahwilliams@google.com>

* add regexp comment

* rescope int list comparison function

* update packages

Co-authored-by: Jonah Williams <jonahwilliams@google.com>
2023-01-12 19:33:30 +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
Jason Simmons
74dfc0708d
Treat assets as variants only if they share the same filename (#112602) 2022-09-29 01:36:20 +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
Michael R Fairhurst
7f3c9b6bda
Remove unused 'dart:async' imports. (#65568) 2020-09-16 14:14:06 -07: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
Jonah Williams
afdc440840
[flutter_tools] surface missing assets originating package (#55701) 2020-05-16 14:52:04 -07:00
Zachary Anderson
6c408a0567
Reland: [flutter_tool] Where possible, catch only subtypes of Exception (#52021)
* Reland: [flutter_tool] Where possible, catch only subtypes of Exception

* Add armv7f to getIOSArchForName
2020-03-06 10:22:12 -08:00
Jenn Magder
cbbb7ec5a7
Revert "Reland: [flutter_tool] Where possible, catch only subtypes of Exception (#51774)" (#51960)
This reverts commit 57c6721cd5.
2020-03-04 12:40:15 -08:00
Flutter GitHub Bot
57c6721cd5
Reland: [flutter_tool] Where possible, catch only subtypes of Exception (#51774) 2020-03-04 11:41:02 -08:00
Zachary Anderson
b32ee2f15c
Revert "Reland: [flutter_tool] Where possible, catch only subtypes of Exception (#51567)" (#51616)
This reverts commit 9de7787f25.
2020-02-27 22:57:13 -08:00
Zachary Anderson
9de7787f25
Reland: [flutter_tool] Where possible, catch only subtypes of Exception (#51567) 2020-02-27 22:46:23 -08:00
Zachary Anderson
483f49962c
Revert "[flutter_tool] Where possible, catch only subtypes of Exception (#51440)" (#51539)
This reverts commit f1cd47ef5c.
2020-02-26 23:42:19 -08:00
Zachary Anderson
f1cd47ef5c
[flutter_tool] Where possible, catch only subtypes of Exception (#51440) 2020-02-26 21:45:02 -08: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
Alexandre Ardhuin
b873162194
fix some bad indentations (#41172) 2019-09-24 21:03:37 +02: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