Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
529184bc
Unverified
Commit
529184bc
authored
Oct 07, 2022
by
Harry Terkelsen
Committed by
GitHub
Oct 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tool] Don't download CanvasKit if it's already in flutter_web_sdk (#113072)
parent
f36b9c5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
7 deletions
+63
-7
flutter_cache.dart
packages/flutter_tools/lib/src/flutter_cache.dart
+14
-7
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+49
-0
No files found.
packages/flutter_tools/lib/src/flutter_cache.dart
View file @
529184bc
...
...
@@ -206,13 +206,20 @@ class FlutterWebSdk extends CachedArtifact {
}
}
final
String
canvasKitVersion
=
cache
.
getVersionFor
(
'canvaskit'
)!;
final
String
canvasKitUrl
=
'
${cache.cipdBaseUrl}
/flutter/web/canvaskit_bundle/+/
$canvasKitVersion
'
;
return
artifactUpdater
.
downloadZipArchive
(
'Downloading CanvasKit...'
,
Uri
.
parse
(
canvasKitUrl
),
location
,
);
// If the flutter_web_sdk folder doesn't already contain CanvasKit, then
// download it from CIPD.
// TODO(hterkelsen): This whole section can be removed when we are always building
// CanvasKit as part of flutter_web_sdk. See https://github.com/flutter/flutter/issues/113073
final
File
expectedCanvasKitFile
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
location
.
path
,
'canvaskit'
,
'canvaskit.wasm'
));
if
(!
expectedCanvasKitFile
.
existsSync
())
{
final
String
canvasKitVersion
=
cache
.
getVersionFor
(
'canvaskit'
)!;
final
String
canvasKitUrl
=
'
${cache.cipdBaseUrl}
/flutter/web/canvaskit_bundle/+/
$canvasKitVersion
'
;
return
artifactUpdater
.
downloadZipArchive
(
'Downloading CanvasKit...'
,
Uri
.
parse
(
canvasKitUrl
),
location
,
);
}
}
}
...
...
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
529184bc
...
...
@@ -840,6 +840,55 @@ void main() {
]);
});
testWithoutContext
(
'FlutterWebSdk does not download CanvasKit if it is already in flutter_web_sdk'
,
()
async
{
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
Directory
internalDir
=
fileSystem
.
currentDirectory
.
childDirectory
(
'cache'
)
.
childDirectory
(
'bin'
)
.
childDirectory
(
'internal'
);
final
File
canvasKitVersionFile
=
internalDir
.
childFile
(
'canvaskit.version'
);
canvasKitVersionFile
.
createSync
(
recursive:
true
);
canvasKitVersionFile
.
writeAsStringSync
(
'abcdefg'
);
final
File
engineVersionFile
=
internalDir
.
childFile
(
'engine.version'
);
engineVersionFile
.
createSync
(
recursive:
true
);
engineVersionFile
.
writeAsStringSync
(
'hijklmnop'
);
final
Cache
cache
=
Cache
.
test
(
processManager:
FakeProcessManager
.
any
(),
fileSystem:
fileSystem
);
final
FakeArtifactUpdater
artifactUpdater
=
FakeArtifactUpdater
();
final
FlutterWebSdk
webSdk
=
FlutterWebSdk
(
cache
,
platform:
FakePlatform
());
final
List
<
String
>
messages
=
<
String
>[];
final
List
<
String
>
downloads
=
<
String
>[];
final
List
<
String
>
locations
=
<
String
>[];
artifactUpdater
.
onDownloadZipArchive
=
(
String
message
,
Uri
uri
,
Directory
location
)
{
messages
.
add
(
message
);
downloads
.
add
(
uri
.
toString
());
locations
.
add
(
location
.
path
);
location
.
createSync
(
recursive:
true
);
location
.
childDirectory
(
'canvaskit'
).
createSync
();
location
.
childDirectory
(
'canvaskit'
).
childFile
(
'canvaskit.js'
).
createSync
();
location
.
childDirectory
(
'canvaskit'
).
childFile
(
'canvaskit.wasm'
).
createSync
();
location
.
childDirectory
(
'canvaskit'
).
childDirectory
(
'profiling'
).
createSync
();
location
.
childDirectory
(
'canvaskit'
).
childDirectory
(
'profiling'
).
childFile
(
'canvaskit.js'
).
createSync
();
location
.
childDirectory
(
'canvaskit'
).
childDirectory
(
'profiling'
).
childFile
(
'canvaskit.wasm'
).
createSync
();
};
await
webSdk
.
updateInner
(
artifactUpdater
,
fileSystem
,
FakeOperatingSystemUtils
());
expect
(
messages
,
<
String
>[
'Downloading Web SDK...'
,
]);
expect
(
downloads
,
<
String
>[
'https://storage.googleapis.com/flutter_infra_release/flutter/hijklmnop/flutter-web-sdk-linux-x64.zip'
,
]);
expect
(
locations
,
<
String
>[
'cache/bin/cache/flutter_web_sdk'
,
]);
});
testWithoutContext
(
'FlutterWebSdk uses tryToDelete to handle directory edge cases'
,
()
async
{
final
FileExceptionHandler
handler
=
FileExceptionHandler
();
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
(
opHandle:
handler
.
opHandle
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment