[web] Make flutter web profile builds always keep wasm symbols (#144130)

So far `flutter build web --wasm` was always stripping wasm symbols
except if `--no-strip-wasm` is passed.

=> Ensure that in profile mode we also keep the symbols
This commit is contained in:
Martin Kustermann
2024-02-27 21:21:42 +01:00
committed by GitHub
parent 871d59221c
commit 616a0260fe
3 changed files with 50 additions and 46 deletions

View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '../build_info.dart' show BuildMode;
import '../convert.dart';
import 'compile.dart';
@@ -106,7 +107,8 @@ class JsCompilerConfig extends WebCompilerConfig {
/// Arguments to use in the full JS compile, but not CFE-only.
///
/// Includes the contents of [toSharedCommandOptions].
List<String> toCommandOptions() => <String>[
List<String> toCommandOptions(BuildMode buildMode) => <String>[
if (buildMode == BuildMode.profile) '--no-minify',
...toSharedCommandOptions(),
'-O$optimizationLevel',
if (dumpInfo) '--dump-info',
@@ -145,10 +147,11 @@ class WasmCompilerConfig extends WebCompilerConfig {
@override
CompileTarget get compileTarget => CompileTarget.wasm;
List<String> toCommandOptions() {
List<String> toCommandOptions(BuildMode buildMode) {
final bool stripSymbols = buildMode == BuildMode.release && stripWasm;
return <String>[
'-O$optimizationLevel',
'--${stripWasm? 'no-' : ''}name-section',
'--${stripSymbols ? 'no-' : ''}name-section',
];
}