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
81525fa1
Unverified
Commit
81525fa1
authored
Feb 06, 2020
by
Lau Ching Jun
Committed by
GitHub
Feb 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support downloading font-subset for all platforms (#50240)
parent
247f6a18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
cache.dart
packages/flutter_tools/lib/src/cache.dart
+8
-4
cache_test.dart
packages/flutter_tools/test/general.shard/cache_test.dart
+17
-0
No files found.
packages/flutter_tools/lib/src/cache.dart
View file @
81525fa1
...
@@ -1229,11 +1229,15 @@ class FontSubsetArtifacts extends EngineCachedArtifact {
...
@@ -1229,11 +1229,15 @@ class FontSubsetArtifacts extends EngineCachedArtifact {
'linux'
:
<
String
>[
'linux-x64'
,
'linux-x64/
$artifactName
.zip'
],
'linux'
:
<
String
>[
'linux-x64'
,
'linux-x64/
$artifactName
.zip'
],
'windows'
:
<
String
>[
'windows-x64'
,
'windows-x64/
$artifactName
.zip'
],
'windows'
:
<
String
>[
'windows-x64'
,
'windows-x64/
$artifactName
.zip'
],
};
};
final
List
<
String
>
binaryDirs
=
artifacts
[
globals
.
platform
.
operatingSystem
];
if
(
cache
.
includeAllPlatforms
)
{
if
(
binaryDirs
==
null
)
{
return
artifacts
.
values
.
toList
();
throwToolExit
(
'Unsupported operating system:
${globals.platform.operatingSystem}
'
);
}
else
{
final
List
<
String
>
binaryDirs
=
artifacts
[
globals
.
platform
.
operatingSystem
];
if
(
binaryDirs
==
null
)
{
throwToolExit
(
'Unsupported operating system:
${globals.platform.operatingSystem}
'
);
}
return
<
List
<
String
>>[
binaryDirs
];
}
}
return
<
List
<
String
>>[
binaryDirs
];
}
}
@override
@override
...
...
packages/flutter_tools/test/general.shard/cache_test.dart
View file @
81525fa1
...
@@ -499,6 +499,7 @@ void main() {
...
@@ -499,6 +499,7 @@ void main() {
testUsingContext
(
'FontSubset artifacts on linux'
,
()
{
testUsingContext
(
'FontSubset artifacts on linux'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
MockCache
mockCache
=
MockCache
();
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockCache
);
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockCache
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
false
);
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'linux-x64'
,
'linux-x64/font-subset.zip'
]]);
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'linux-x64'
,
'linux-x64/font-subset.zip'
]]);
},
overrides:
<
Type
,
Generator
>
{
},
overrides:
<
Type
,
Generator
>
{
Platform:
()
=>
FakePlatform
()..
operatingSystem
=
'linux'
,
Platform:
()
=>
FakePlatform
()..
operatingSystem
=
'linux'
,
...
@@ -507,6 +508,7 @@ void main() {
...
@@ -507,6 +508,7 @@ void main() {
testUsingContext
(
'FontSubset artifacts on windows'
,
()
{
testUsingContext
(
'FontSubset artifacts on windows'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
MockCache
mockCache
=
MockCache
();
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockCache
);
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockCache
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
false
);
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'windows-x64'
,
'windows-x64/font-subset.zip'
]]);
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'windows-x64'
,
'windows-x64/font-subset.zip'
]]);
},
overrides:
<
Type
,
Generator
>
{
},
overrides:
<
Type
,
Generator
>
{
Platform:
()
=>
FakePlatform
()..
operatingSystem
=
'windows'
,
Platform:
()
=>
FakePlatform
()..
operatingSystem
=
'windows'
,
...
@@ -515,6 +517,7 @@ void main() {
...
@@ -515,6 +517,7 @@ void main() {
testUsingContext
(
'FontSubset artifacts on macos'
,
()
{
testUsingContext
(
'FontSubset artifacts on macos'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
MockCache
mockCache
=
MockCache
();
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockCache
);
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockCache
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
false
);
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'darwin-x64'
,
'darwin-x64/font-subset.zip'
]]);
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[<
String
>[
'darwin-x64'
,
'darwin-x64/font-subset.zip'
]]);
},
overrides:
<
Type
,
Generator
>
{
},
overrides:
<
Type
,
Generator
>
{
Platform:
()
=>
FakePlatform
()..
operatingSystem
=
'macos'
,
Platform:
()
=>
FakePlatform
()..
operatingSystem
=
'macos'
,
...
@@ -523,10 +526,24 @@ void main() {
...
@@ -523,10 +526,24 @@ void main() {
testUsingContext
(
'FontSubset artifacts on fuchsia'
,
()
{
testUsingContext
(
'FontSubset artifacts on fuchsia'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
MockCache
mockCache
=
MockCache
();
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockCache
);
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockCache
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
false
);
expect
(()
=>
artifacts
.
getBinaryDirs
(),
throwsToolExit
(
message:
'Unsupported operating system:
${globals.platform.operatingSystem}
'
));
expect
(()
=>
artifacts
.
getBinaryDirs
(),
throwsToolExit
(
message:
'Unsupported operating system:
${globals.platform.operatingSystem}
'
));
},
overrides:
<
Type
,
Generator
>
{
},
overrides:
<
Type
,
Generator
>
{
Platform:
()
=>
FakePlatform
()..
operatingSystem
=
'fuchsia'
,
Platform:
()
=>
FakePlatform
()..
operatingSystem
=
'fuchsia'
,
});
});
testUsingContext
(
'FontSubset artifacts for all platforms'
,
()
{
final
MockCache
mockCache
=
MockCache
();
final
FontSubsetArtifacts
artifacts
=
FontSubsetArtifacts
(
mockCache
);
when
(
mockCache
.
includeAllPlatforms
).
thenReturn
(
true
);
expect
(
artifacts
.
getBinaryDirs
(),
<
List
<
String
>>[
<
String
>[
'darwin-x64'
,
'darwin-x64/font-subset.zip'
],
<
String
>[
'linux-x64'
,
'linux-x64/font-subset.zip'
],
<
String
>[
'windows-x64'
,
'windows-x64/font-subset.zip'
],
]);
},
overrides:
<
Type
,
Generator
>
{
Platform:
()
=>
FakePlatform
()..
operatingSystem
=
'fuchsia'
,
});
}
}
class
FakeCachedArtifact
extends
EngineCachedArtifact
{
class
FakeCachedArtifact
extends
EngineCachedArtifact
{
...
...
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