Skip to content

Lazily download artifacts (Part II): The Clone Wars#27735

Merged
jonahwilliams merged 40 commits intoflutter:masterfrom
jonahwilliams:lazy_download
Feb 13, 2019
Merged

Lazily download artifacts (Part II): The Clone Wars#27735
jonahwilliams merged 40 commits intoflutter:masterfrom
jonahwilliams:lazy_download

Conversation

@jonahwilliams
Copy link
Contributor

Fixes #6491

Only download the minimum*** set of artifacts needed for a particular host, target, and build mode.

*** I still include gradle and fonts in the minimum set.


Adds additional arguments to several Cache methods:

  • buildMode & targetPlatform for filtering by artifacts, can be null. If null, retrieve all artifacts matching one of the other parameters. For example, targetPlatform.ios and null buildMode downloads debug, profile, and release for iOS.
    -skipUnknown, which allows downloading artifacts when targetPlatform and hostPlatform are unknown.
  • clobber, whether to force re-downloading of artifacts

flutter precache will still download the full set of artifacts for a given host platform.
flutter precache -f/--force will re download all artifacts.

Re-organizes engine artifacts into a class from lists of lists of strings.

Flutter commands now check the artifacts for the given or default build mode, and any connected devices. (note: android-arm-profile is downloaded unconditionally because we currently need it for a Flutter doctor check).

This is accomplished via a new method on FlutterCommand called updateCache. This is only called if shouldUpdateCache is true. The default implementation is:

  Future<void> updateCache() async {
    // Only download the minimum set of binaries.
    await cache.updateAll(
      clobber: false,
      skipUnknown: true,
    );
  }

Run, for example, looks at the current set of attached devices and ensures the binaries are downloaded for each kind.

Example doctor command:

jonahwilliams@jonahwilliams0:~/Documents/flutter/examples/hello_world$ rm -rf ../../bin/cache/
jonahwilliams@jonahwilliams0:~/Documents/flutter/examples/hello_world$ flutter doctor
Downloading Dart SDK from Flutter engine 15f2b92cce916982b7dd8ce658bbf2a465c06ba4...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 50.4M  100 50.4M    0     0  43.4M      0  0:00:01  0:00:01 --:--:-- 43.4M
Building flutter tool...
Downloading Material fonts...                                       1.7s
Downloading package sky_engine...                                   0.3s
Downloading common tools...                                         2.0s
Downloading linux-x64 tools...                                      1.0s
Downloading android-arm-profile/linux-x64 tools...                  1.7s
Downloading Gradle Wrapper...                                       1.0s
Doctor summary (to see all details, run flutter doctor -v):

jonahwilliams added 30 commits January 31, 2019 12:24
Fix flutter import
@zoechi zoechi added the tool Affects the "flutter" command-line tool. See also t: labels. label Feb 11, 2019
@jonahwilliams
Copy link
Contributor Author

Includes fix to flutter drive not fetching all artifacts

await artifact.update();
bool localClobber = clobber;
if (localClobber) {
await artifact.update(buildModes: buildModes, targetPlatforms: targetPlatforms, skipUnknown: skipUnknown, clobber: localClobber);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we're pretty lax about line length, but these update calls are getting a little long to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the tools don't contain widget trees, it seems like we should really consider dartfmt

@gspencergoog
Copy link
Contributor

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

Modulo doc nits above.

@jonahwilliams jonahwilliams merged commit 76061c4 into flutter:master Feb 13, 2019
jonahwilliams pushed a commit that referenced this pull request Feb 13, 2019
jonahwilliams pushed a commit that referenced this pull request Feb 13, 2019
@jonahwilliams jonahwilliams changed the title Lazily download artifacts (Part II) Lazily download artifacts (Part II): The Clone Wars Mar 27, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Would be nice if flutter run only downloaded the necessary artifacts

4 participants