Unverified Commit 717f9de6 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] enable tree-shake-icons by default for non-web targets (#56633)

Enable tree-shake-icons by default for non-web targets. Make missing fonts a status print
parent 7eff0a87
......@@ -21,7 +21,7 @@ import 'dart.dart';
const String kIconTreeShakerFlag = 'TreeShakeIcons';
/// Whether icon font subsetting is enabled by default.
const bool kIconTreeShakerEnabledDefault = false;
const bool kIconTreeShakerEnabledDefault = true;
List<Map<String, dynamic>> _getList(dynamic object, String errorMessage) {
try {
......@@ -127,7 +127,7 @@ class IconTreeShaker {
);
if (fonts.length != iconData.length) {
throwToolExit(
environment.logger.printStatus(
'Expected to find fonts for ${iconData.keys}, but found '
'${fonts.keys}. This usually means you are refering to '
'font families in an IconData class but not including them '
......
......@@ -110,7 +110,7 @@ void main() {
testUsingContext('build aot outputs timing info', () async {
globals.fs
.file('.dart_tool/flutter_build/0c21fd4ab3b8bde8b385ff01d08e0093/app.so')
.file('.dart_tool/flutter_build/3f206b606f73e08587a94405f2e86fad/app.so')
.createSync(recursive: true);
when(globals.buildSystem.build(any, any))
.thenAnswer((Invocation invocation) async {
......
......@@ -238,6 +238,7 @@ void main() {
'-Ptarget=${globals.fs.path.join(tempDir.path, 'flutter_project', 'lib', 'main.dart')}',
'-Ptrack-widget-creation=true',
'-Pshrink=true',
'-Ptree-shake-icons=true',
'assembleRelease',
],
workingDirectory: anyNamed('workingDirectory'),
......@@ -267,6 +268,7 @@ void main() {
'-Ptrack-widget-creation=true',
'-Pshrink=true',
'-Psplit-debug-info=${tempDir.path}',
'-Ptree-shake-icons=true',
'assembleRelease',
],
workingDirectory: anyNamed('workingDirectory'),
......@@ -299,6 +301,7 @@ void main() {
'-Ptrack-widget-creation=true',
'-Pextra-front-end-options=foo,bar',
'-Pshrink=true',
'-Ptree-shake-icons=true',
'assembleRelease',
],
workingDirectory: anyNamed('workingDirectory'),
......@@ -329,6 +332,7 @@ void main() {
'-Ptarget-platform=android-arm,android-arm64,android-x64',
'-Ptarget=${globals.fs.path.join(tempDir.path, 'flutter_project', 'lib', 'main.dart')}',
'-Ptrack-widget-creation=true',
'-Ptree-shake-icons=true',
'assembleRelease',
],
workingDirectory: anyNamed('workingDirectory'),
......@@ -353,6 +357,7 @@ void main() {
'-Ptarget=${globals.fs.path.join(tempDir.path, 'flutter_project', 'lib', 'main.dart')}',
'-Ptrack-widget-creation=true',
'-Pshrink=true',
'-Ptree-shake-icons=true',
'assembleRelease',
],
workingDirectory: anyNamed('workingDirectory'),
......@@ -420,6 +425,7 @@ void main() {
'-Ptarget=${globals.fs.path.join(tempDir.path, 'flutter_project', 'lib', 'main.dart')}',
'-Ptrack-widget-creation=true',
'-Pshrink=true',
'-Ptree-shake-icons=true',
'assembleRelease',
],
workingDirectory: anyNamed('workingDirectory'),
......@@ -476,6 +482,7 @@ void main() {
'-Ptarget=${globals.fs.path.join(tempDir.path, 'flutter_project', 'lib', 'main.dart')}',
'-Ptrack-widget-creation=true',
'-Pshrink=true',
'-Ptree-shake-icons=true',
'assembleRelease',
],
workingDirectory: anyNamed('workingDirectory'),
......
......@@ -225,6 +225,7 @@ void main() {
'-Ptarget=${globals.fs.path.join(tempDir.path, 'flutter_project', 'lib', 'main.dart')}',
'-Ptrack-widget-creation=true',
'-Pshrink=true',
'-Ptree-shake-icons=true',
'bundleRelease',
],
workingDirectory: anyNamed('workingDirectory'),
......@@ -257,6 +258,7 @@ void main() {
'-Ptarget-platform=android-arm,android-arm64,android-x64',
'-Ptarget=${globals.fs.path.join(tempDir.path, 'flutter_project', 'lib', 'main.dart')}',
'-Ptrack-widget-creation=true',
'-Ptree-shake-icons=true',
'bundleRelease',
],
workingDirectory: anyNamed('workingDirectory'),
......@@ -272,7 +274,6 @@ void main() {
testUsingContext('guides the user when the shrinker fails', () async {
final String projectPath = await createProject(tempDir,
arguments: <String>['--no-pub', '--template=app']);
when(mockProcessManager.start(
<String>[
gradlew,
......@@ -281,6 +282,7 @@ void main() {
'-Ptarget=${globals.fs.path.join(tempDir.path, 'flutter_project', 'lib', 'main.dart')}',
'-Ptrack-widget-creation=true',
'-Pshrink=true',
'-Ptree-shake-icons=true',
'bundleRelease',
],
workingDirectory: anyNamed('workingDirectory'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment