Skip to content

Commit 21ec41e

Browse files
committed
fix(flutter_tools): preserve --track-widget-creation and --adb-log-filtering visibility
1 parent 95a913f commit 21ec41e

2 files changed

Lines changed: 79 additions & 1 deletion

File tree

‎packages/flutter_tools/lib/src/runner/options/common_options.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ abstract final class BuildInfoOptions {
237237
static const trackWidgetCreation = FlagOptionDescriptor(
238238
name: 'track-widget-creation',
239239
defaultsTo: true,
240-
verboseOnly: true,
241240
help:
242241
'Track widget creation locations. This enables features such as the widget inspector. '
243242
'This parameter is only functional in debug mode (i.e. when compiling JIT, not AOT).',
@@ -875,6 +874,7 @@ abstract final class DebuggingOptionDescriptors {
875874
static const adbLogFiltering = FlagOptionDescriptor(
876875
name: 'adb-log-filtering',
877876
defaultsTo: true,
877+
verboseOnly: true,
878878
help:
879879
'Filter adb logs so that logs not emitted by the current flutter application are not '
880880
'displayed.',

‎packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,84 @@ void main() {
15171517
},
15181518
);
15191519
});
1520+
1521+
testUsingContext('preserves expected hidden and visible options across verboseHelp modes', () {
1522+
final defaultCommand = AttachCommand(
1523+
buildSystem: buildSystem,
1524+
buildTargets: const BuildTargetsImpl(),
1525+
xcode: null,
1526+
toolContext: createToolContext(),
1527+
);
1528+
1529+
final visibleByDefault = <String>{
1530+
for (final entry in defaultCommand.argParser.options.entries)
1531+
if (!entry.value.hide) entry.key,
1532+
};
1533+
final hiddenByDefault = <String>{
1534+
for (final entry in defaultCommand.argParser.options.entries)
1535+
if (entry.value.hide) entry.key,
1536+
};
1537+
1538+
expect(
1539+
visibleByDefault,
1540+
unorderedEquals(<String>[
1541+
'help',
1542+
'debug',
1543+
'profile',
1544+
'target',
1545+
'device-vmservice-port',
1546+
'host-vmservice-port',
1547+
'dart-define',
1548+
'dart-define-from-file',
1549+
'device-user',
1550+
'device-timeout',
1551+
'device-connection',
1552+
'dds',
1553+
'dds-port',
1554+
'debug-url',
1555+
'app-id',
1556+
'pid-file',
1557+
'track-widget-creation',
1558+
]),
1559+
);
1560+
expect(
1561+
hiddenByDefault,
1562+
unorderedEquals(<String>[
1563+
'vm-service-port',
1564+
'ipv6',
1565+
'output-dill',
1566+
'filesystem-root',
1567+
'filesystem-scheme',
1568+
'initialize-from-dill',
1569+
'assume-initialize-from-dill-up-to-date',
1570+
'native-assets-yaml-file',
1571+
'disable-dds',
1572+
'devtools',
1573+
'devtools-server-address',
1574+
'target-model',
1575+
'module',
1576+
'enable-experiment',
1577+
'debug-port',
1578+
'report-ready',
1579+
'project-root',
1580+
'machine',
1581+
'adb-log-filtering',
1582+
]),
1583+
);
1584+
1585+
final verboseCommand = AttachCommand(
1586+
buildSystem: buildSystem,
1587+
buildTargets: const BuildTargetsImpl(),
1588+
xcode: null,
1589+
toolContext: createToolContext(),
1590+
verboseHelp: true,
1591+
);
1592+
final hiddenInVerboseMode = <String>{
1593+
for (final entry in verboseCommand.argParser.options.entries)
1594+
if (entry.value.hide) entry.key,
1595+
};
1596+
expect(hiddenInVerboseMode, isEmpty);
1597+
});
15201598
});
15211599
}
15221600

0 commit comments

Comments
 (0)