Skip to content

Commit 89b263d

Browse files
authored
fix(tool): remove redundant --enable-experiment=record-use flag (flutter#190475)
When compiling web targets (dart2js and dart2wasm) or running dry runs with the record-use feature flag enabled, flutter_tools explicitly passed --enable-experiment=record-use to the compiler. Since record-use is enabled by default in recent Dart SDKs, passing this flag caused warning spam during standard compilation and dry runs. * Remove --enable-experiment=record-use from Dart2JSTarget and Dart2WasmTarget in web.dart. * Remove expected flag from test commands in web_test.dart and web_dry_run_test.dart. Fixes flutter#190465
1 parent 3c12de8 commit 89b263d

3 files changed

Lines changed: 2 additions & 10 deletions

File tree

‎packages/flutter_tools/lib/src/build_system/targets/web.dart‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,7 @@ class Dart2JSTarget extends Dart2WebTarget {
199199
else if (buildMode == BuildMode.release)
200200
'-Ddart.vm.product=true',
201201
for (final String dartDefine in computeDartDefines(environment)) '-D$dartDefine',
202-
if (featureFlags.isRecordUseEnabled) ...<String>[
203-
'--write-resources',
204-
'--enable-experiment=record-use',
205-
],
202+
if (featureFlags.isRecordUseEnabled) '--write-resources',
206203
];
207204

208205
// NOTE: most args should be populated in [toSharedCommandOptions].
@@ -374,10 +371,8 @@ class Dart2WasmTarget extends Dart2WebTarget {
374371
...decodeCommaSeparated(environment.defines, kExtraFrontEndOptions),
375372
for (final String dartDefine in dartDefines) '-D$dartDefine',
376373
'--extra-compiler-option=--depfile=${depFile.path}',
377-
if (featureFlags.isRecordUseEnabled) ...<String>[
374+
if (featureFlags.isRecordUseEnabled)
378375
'--recorded-uses=${environment.buildDir.childFile(LinkHooks.recordedUsesWasmFileName).path}',
379-
'--enable-experiment=record-use',
380-
],
381376
...compilerConfig.toCommandOptions(buildMode),
382377
'-o',
383378
outputWasmFile.path,

‎packages/flutter_tools/test/general.shard/build_system/targets/web_dry_run_test.dart‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ name: my_app
9898
'-DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/abcdefghijklmnopqrstuvwxyz/',
9999
'--extra-compiler-option=--depfile=${environment.buildDir.childFile('dart2wasm.d').path}',
100100
'--recorded-uses=${environment.buildDir.childFile('recorded_uses_wasm.json').path}',
101-
'--enable-experiment=record-use',
102101
'-O0',
103102
'--no-strip-wasm',
104103
'--no-minify',

‎packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const _kStandardFlutterWebDefines = <String>[
4141
'-DFLUTTER_WEB_USE_SKWASM=false',
4242
'-DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/abcdefghijklmnopqrstuvwxyz/',
4343
'--write-resources',
44-
'--enable-experiment=record-use',
4544
];
4645

4746
const _kDart2WasmLinuxArgs = <String>[
@@ -1367,7 +1366,6 @@ _flutter.loader.load();
13671366
'-DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/abcdefghijklmnopqrstuvwxyz/',
13681367
'--extra-compiler-option=--depfile=${depFile.absolute.path}',
13691368
'--recorded-uses=${environment.buildDir.childFile('recorded_uses_wasm.json').absolute.path}',
1370-
'--enable-experiment=record-use',
13711369
'-O$expectedLevel',
13721370
if (strip && buildMode == 'release')
13731371
'--strip-wasm'

0 commit comments

Comments
 (0)