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
8f536ec1
Unverified
Commit
8f536ec1
authored
May 19, 2021
by
Jenn Magder
Committed by
GitHub
May 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default --no-tree-shake-icons to false for 'flutter build bundle' (#82773)
parent
2acd0007
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
1 deletion
+111
-1
build_bundle.dart
packages/flutter_tools/lib/src/commands/build_bundle.dart
+15
-1
build_bundle_test.dart
...ools/test/commands.shard/permeable/build_bundle_test.dart
+96
-0
No files found.
packages/flutter_tools/lib/src/commands/build_bundle.dart
View file @
8f536ec1
...
...
@@ -16,7 +16,6 @@ import 'build.dart';
class
BuildBundleCommand
extends
BuildSubCommand
{
BuildBundleCommand
({
bool
verboseHelp
=
false
,
this
.
bundleBuilder
})
{
addTreeShakeIconsFlag
();
usesTargetOption
();
usesFilesystemOptions
(
hide:
!
verboseHelp
);
usesBuildNumberOption
();
...
...
@@ -48,6 +47,13 @@ class BuildBundleCommand extends BuildSubCommand {
defaultsTo:
getAssetBuildDirectory
(),
help:
'The output directory for the kernel_blob.bin file, the native snapshet, the assets, etc. '
'Can be used to redirect the output when driving the Flutter toolchain from another build system.'
,
)
..
addFlag
(
'tree-shake-icons'
,
negatable:
true
,
defaultsTo:
false
,
hide:
!
verboseHelp
,
help:
'(deprecated) Icon font tree shaking is not supported by this command.'
,
);
usesPubOption
();
usesTrackWidgetCreation
(
verboseHelp:
verboseHelp
);
...
...
@@ -81,6 +87,14 @@ class BuildBundleCommand extends BuildSubCommand {
);
}
@override
Future
<
void
>
validateCommand
()
async
{
if
(
argResults
[
'tree-shake-icons'
]
as
bool
)
{
throwToolExit
(
'The "--tree-shake-icons" flag is deprecated for "build bundle" and will be removed in a future version of Flutter.'
);
}
return
super
.
validateCommand
();
}
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
String
targetPlatform
=
stringArg
(
'target-platform'
);
...
...
packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart
View file @
8f536ec1
...
...
@@ -132,6 +132,24 @@ void main() {
FeatureFlags:
()
=>
TestFeatureFlags
(
isMacOSEnabled:
false
),
});
testUsingContext
(
'bundle --tree-shake-icons fails'
,
()
async
{
globals
.
fs
.
file
(
'lib/main.dart'
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
globals
.
fs
.
file
(
'.packages'
).
createSync
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
BuildBundleCommand
()
..
bundleBuilder
=
FakeBundleBuilder
());
expect
(()
=>
runner
.
run
(<
String
>[
'bundle'
,
'--no-pub'
,
'--release'
,
'--tree-shake-icons'
,
]),
throwsToolExit
(
message:
'tree-shake-icons'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'bundle can build for Windows if feature is enabled'
,
()
async
{
globals
.
fs
.
file
(
'lib/main.dart'
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
...
...
@@ -369,6 +387,84 @@ void main() {
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'passes profile options through'
,
()
async
{
globals
.
fs
.
file
(
'lib/main.dart'
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
globals
.
fs
.
file
(
'.packages'
).
createSync
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
BuildBundleCommand
());
await
runner
.
run
(<
String
>[
'bundle'
,
'--no-pub'
,
'--profile'
,
'--dart-define=foo=bar'
,
'--target-platform=android-arm'
,
'--track-widget-creation'
,
'--filesystem-scheme=org-dartlang-root'
,
'--filesystem-root=test1,test2'
,
'--extra-gen-snapshot-options=--testflag,--testflag2'
,
'--extra-front-end-options=--testflagFront,--testflagFront2'
,
]);
},
overrides:
<
Type
,
Generator
>{
BuildSystem:
()
=>
TestBuildSystem
.
all
(
BuildResult
(
success:
true
),
(
Target
target
,
Environment
environment
)
{
expect
(
environment
.
defines
,
<
String
,
String
>{
kBuildMode:
'profile'
,
kTargetPlatform:
'android-arm'
,
kTargetFile:
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
),
kDartDefines:
'Zm9vPWJhcg=='
,
kTrackWidgetCreation:
'true'
,
kFileSystemScheme:
'org-dartlang-root'
,
kFileSystemRoots:
'test1,test2'
,
kExtraGenSnapshotOptions:
'--testflag,--testflag2'
,
kExtraFrontEndOptions:
'--testflagFront,--testflagFront2'
,
kIconTreeShakerFlag:
'false'
,
kDeferredComponents:
'false'
,
kDartObfuscation:
'false'
,
});
}),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'passes release options through'
,
()
async
{
globals
.
fs
.
file
(
'lib/main.dart'
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
globals
.
fs
.
file
(
'.packages'
).
createSync
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
BuildBundleCommand
());
await
runner
.
run
(<
String
>[
'bundle'
,
'--no-pub'
,
'--release'
,
'--dart-define=foo=bar'
,
'--target-platform=android-arm'
,
'--track-widget-creation'
,
'--filesystem-scheme=org-dartlang-root'
,
'--filesystem-root=test1,test2'
,
'--extra-gen-snapshot-options=--testflag,--testflag2'
,
'--extra-front-end-options=--testflagFront,--testflagFront2'
,
]);
},
overrides:
<
Type
,
Generator
>{
BuildSystem:
()
=>
TestBuildSystem
.
all
(
BuildResult
(
success:
true
),
(
Target
target
,
Environment
environment
)
{
expect
(
environment
.
defines
,
<
String
,
String
>{
kBuildMode:
'release'
,
kTargetPlatform:
'android-arm'
,
kTargetFile:
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
),
kDartDefines:
'Zm9vPWJhcg=='
,
kTrackWidgetCreation:
'true'
,
kFileSystemScheme:
'org-dartlang-root'
,
kFileSystemRoots:
'test1,test2'
,
kExtraGenSnapshotOptions:
'--testflag,--testflag2'
,
kExtraFrontEndOptions:
'--testflagFront,--testflagFront2'
,
kIconTreeShakerFlag:
'false'
,
kDeferredComponents:
'false'
,
kDartObfuscation:
'false'
,
});
}),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
}
class
FakeBundleBuilder
extends
Fake
implements
BundleBuilder
{
...
...
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