mirror of
https://github.com/flutter/flutter
synced 2024-10-13 19:52:53 +00:00
Download secondary SDK (#29633)
This commit is contained in:
parent
c72f18fcd5
commit
5f727126ca
|
@ -24,6 +24,7 @@ class Cache {
|
||||||
_artifacts.add(MaterialFonts(this));
|
_artifacts.add(MaterialFonts(this));
|
||||||
_artifacts.add(FlutterEngine(this));
|
_artifacts.add(FlutterEngine(this));
|
||||||
_artifacts.add(GradleWrapper(this));
|
_artifacts.add(GradleWrapper(this));
|
||||||
|
_artifacts.add(FlutterWebSdk(this));
|
||||||
} else {
|
} else {
|
||||||
_artifacts.addAll(artifacts);
|
_artifacts.addAll(artifacts);
|
||||||
}
|
}
|
||||||
|
@ -162,6 +163,12 @@ class Cache {
|
||||||
return getCacheArtifacts().childDirectory(name);
|
return getCacheArtifacts().childDirectory(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The web sdk has to be co-located with the dart-sdk so that they can share source
|
||||||
|
/// code.
|
||||||
|
Directory getWebSdkDirectory() {
|
||||||
|
return getRoot().childDirectory('flutter_web_sdk');
|
||||||
|
}
|
||||||
|
|
||||||
String getVersionFor(String artifactName) {
|
String getVersionFor(String artifactName) {
|
||||||
final File versionFile = fs.file(fs.path.join(_rootOverride?.path ?? flutterRoot, 'bin', 'internal', '$artifactName.version'));
|
final File versionFile = fs.file(fs.path.join(_rootOverride?.path ?? flutterRoot, 'bin', 'internal', '$artifactName.version'));
|
||||||
return versionFile.existsSync() ? versionFile.readAsStringSync().trim() : null;
|
return versionFile.existsSync() ? versionFile.readAsStringSync().trim() : null;
|
||||||
|
@ -357,6 +364,34 @@ class MaterialFonts extends CachedArtifact {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A cached artifact containing the web dart:ui sources, platform dill files,
|
||||||
|
/// and libraries.json.
|
||||||
|
///
|
||||||
|
/// This SDK references code within the regular Dart sdk to reduce download size.
|
||||||
|
class FlutterWebSdk extends CachedArtifact {
|
||||||
|
FlutterWebSdk(Cache cache) : super('flutter_web_sdk', cache);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Directory get location => cache.getWebSdkDirectory();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get version => cache.getVersionFor('engine');
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> updateInner() {
|
||||||
|
String platformName = 'flutter-web-sdk-';
|
||||||
|
if (platform.isMacOS) {
|
||||||
|
platformName += 'darwin-x64';
|
||||||
|
} else if (platform.isLinux) {
|
||||||
|
platformName += 'linux-x64';
|
||||||
|
} else if (platform.isWindows) {
|
||||||
|
platformName += 'windows-x64';
|
||||||
|
}
|
||||||
|
final Uri url = Uri.parse('$_storageBaseUrl/flutter_infra/flutter/$version/$platformName.zip');
|
||||||
|
return _downloadZipArchive('Downloading Web SDK...', url, location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A cached artifact containing the Flutter engine binaries.
|
/// A cached artifact containing the Flutter engine binaries.
|
||||||
class FlutterEngine extends CachedArtifact {
|
class FlutterEngine extends CachedArtifact {
|
||||||
FlutterEngine(Cache cache) : super('engine', cache);
|
FlutterEngine(Cache cache) : super('engine', cache);
|
||||||
|
|
Loading…
Reference in a new issue