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
77378934
Unverified
Commit
77378934
authored
Nov 04, 2021
by
Yegor
Committed by
GitHub
Nov 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[web:tools] always use CanvasKit from the cache when building web apps (#93002)
parent
6cd39cce
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
9 deletions
+19
-9
web.dart
packages/flutter_tools/lib/src/build_system/targets/web.dart
+14
-4
assemble.dart
packages/flutter_tools/lib/src/commands/assemble.dart
+1
-1
compile.dart
packages/flutter_tools/lib/src/web/compile.dart
+1
-1
web_test.dart
...ols/test/general.shard/build_system/targets/web_test.dart
+3
-3
No files found.
packages/flutter_tools/lib/src/build_system/targets/web.dart
View file @
77378934
...
...
@@ -410,9 +410,10 @@ class WebReleaseBundle extends Target {
/// These assets can be cached forever and are only invalidated when the
/// Flutter SDK is upgraded to a new version.
class
WebBuiltInAssets
extends
Target
{
const
WebBuiltInAssets
(
this
.
fileSystem
);
const
WebBuiltInAssets
(
this
.
fileSystem
,
this
.
cache
);
final
FileSystem
fileSystem
;
final
Cache
cache
;
@override
String
get
name
=>
'web_static_assets'
;
...
...
@@ -431,7 +432,15 @@ class WebBuiltInAssets extends Target {
@override
Future
<
void
>
build
(
Environment
environment
)
async
{
final
Directory
flutterWebSdk
=
globals
.
artifacts
.
getHostArtifact
(
HostArtifact
.
flutterWebSdk
)
as
Directory
;
// TODO(yjbanov): https://github.com/flutter/flutter/issues/52588
//
// Update this when we start building CanvasKit from sources. In the
// meantime, get the Web SDK directory from cache rather than through
// Artifacts. The latter is sensitive to `--local-engine`, which changes
// the directory to point to ENGINE/src/out. However, CanvasKit is not yet
// built as part of the engine, but fetched from CIPD, and so it won't be
// found in ENGINE/src/out.
final
Directory
flutterWebSdk
=
cache
.
getWebSdkDirectory
();
final
Directory
canvasKitDirectory
=
flutterWebSdk
.
childDirectory
(
'canvaskit'
);
for
(
final
File
file
in
canvasKitDirectory
.
listSync
(
recursive:
true
).
whereType
<
File
>())
{
final
String
relativePath
=
fileSystem
.
path
.
relative
(
file
.
path
,
from:
canvasKitDirectory
.
path
);
...
...
@@ -443,9 +452,10 @@ class WebBuiltInAssets extends Target {
/// Generate a service worker for a web target.
class
WebServiceWorker
extends
Target
{
const
WebServiceWorker
(
this
.
fileSystem
);
const
WebServiceWorker
(
this
.
fileSystem
,
this
.
cache
);
final
FileSystem
fileSystem
;
final
Cache
cache
;
@override
String
get
name
=>
'web_service_worker'
;
...
...
@@ -454,7 +464,7 @@ class WebServiceWorker extends Target {
List
<
Target
>
get
dependencies
=>
<
Target
>[
const
Dart2JSTarget
(),
const
WebReleaseBundle
(),
WebBuiltInAssets
(
fileSystem
),
WebBuiltInAssets
(
fileSystem
,
cache
),
];
@override
...
...
packages/flutter_tools/lib/src/commands/assemble.dart
View file @
77378934
...
...
@@ -49,7 +49,7 @@ List<Target> _kDefaultTargets = <Target>[
const
ReleaseBundleLinuxAssets
(
TargetPlatform
.
linux_x64
),
const
ReleaseBundleLinuxAssets
(
TargetPlatform
.
linux_arm64
),
// Web targets
WebServiceWorker
(
globals
.
fs
),
WebServiceWorker
(
globals
.
fs
,
globals
.
cache
),
const
ReleaseAndroidApplication
(),
// This is a one-off rule for bundle and aot compat.
const
CopyFlutterBundle
(),
...
...
packages/flutter_tools/lib/src/web/compile.dart
View file @
77378934
...
...
@@ -37,7 +37,7 @@ Future<void> buildWeb(
final
Status
status
=
globals
.
logger
.
startProgress
(
'Compiling
$target
for the Web...'
);
final
Stopwatch
sw
=
Stopwatch
()..
start
();
try
{
final
BuildResult
result
=
await
globals
.
buildSystem
.
build
(
WebServiceWorker
(
globals
.
fs
),
Environment
(
final
BuildResult
result
=
await
globals
.
buildSystem
.
build
(
WebServiceWorker
(
globals
.
fs
,
globals
.
cache
),
Environment
(
projectDir:
globals
.
fs
.
currentDirectory
,
outputDir:
outputDirectory
,
buildDir:
flutterProject
.
directory
...
...
packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
View file @
77378934
...
...
@@ -637,7 +637,7 @@ void main() {
environment
.
outputDir
.
childDirectory
(
'a'
).
childFile
(
'a.txt'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'A'
);
await
WebServiceWorker
(
globals
.
fs
).
build
(
environment
);
await
WebServiceWorker
(
globals
.
fs
,
globals
.
cache
).
build
(
environment
);
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
),
exists
);
// Contains file hash.
...
...
@@ -656,7 +656,7 @@ void main() {
environment
.
outputDir
.
childFile
(
'index.html'
)
.
createSync
(
recursive:
true
);
await
WebServiceWorker
(
globals
.
fs
).
build
(
environment
);
await
WebServiceWorker
(
globals
.
fs
,
globals
.
cache
).
build
(
environment
);
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
),
exists
);
// Contains file hash for both `/` and index.html.
...
...
@@ -674,7 +674,7 @@ void main() {
environment
.
outputDir
.
childFile
(
'main.dart.js.map'
)
.
createSync
(
recursive:
true
);
await
WebServiceWorker
(
globals
.
fs
).
build
(
environment
);
await
WebServiceWorker
(
globals
.
fs
,
globals
.
cache
).
build
(
environment
);
// No caching of source maps.
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
).
readAsStringSync
(),
...
...
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