Add support for flutter build web --debug. (#157186)

There have been various requests for this for a while. See https://github.com/flutter/flutter/issues/96283 for an example. This has become more important with dart2wasm builds in the mix, as the profiling versions of the dart2wasm builds are a lot less debuggable than the debug versions. Most of this is already wired up so it just requires taking out a few explicit checks for it and making sure that we compile with the right optimization levels when compiling debug.
This commit is contained in:
Jackson Gardner
2024-10-21 08:35:11 -07:00
committed by GitHub
parent 3512745071
commit e19d352fc9
5 changed files with 35 additions and 42 deletions

View File

@@ -83,25 +83,6 @@ void main() {
ProcessManager: () => processManager,
});
testUsingContext('Refuses to build a debug build for web', () async {
final CommandRunner<void> runner = createTestCommandRunner(BuildCommand(
artifacts: artifacts,
androidSdk: FakeAndroidSdk(),
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
fileSystem: fileSystem,
logger: logger,
processUtils: processUtils,
osUtils: FakeOperatingSystemUtils(),
));
expect(() => runner.run(<String>['build', 'web', '--debug', '--no-pub']),
throwsA(isA<UsageException>()));
}, overrides: <Type, Generator>{
Platform: () => fakePlatform,
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
ProcessManager: () => processManager,
});
testUsingContext('Refuses to build for web when feature is disabled', () async {
final CommandRunner<void> runner = createTestCommandRunner(BuildCommand(
artifacts: artifacts,

View File

@@ -909,7 +909,7 @@ void main() {
'--no-minify',
'--no-source-maps',
'--enable-asserts',
'-O4',
'-O1',
'-o',
environment.buildDir.childFile('main.dart.js').absolute.path,
environment.buildDir.childFile('app.dill').absolute.path,

View File

@@ -107,7 +107,7 @@ void main() {
label: 'web-compile',
parameters: CustomDimensions(
buildEventSettings:
'optimizationLevel: 4; web-renderer: skwasm,canvaskit; web-target: wasm,js;',
'optimizationLevel: 0; web-renderer: skwasm,canvaskit; web-target: wasm,js;',
),
),
@@ -121,7 +121,7 @@ void main() {
Event.flutterBuildInfo(
label: 'web-compile',
buildType: 'web',
settings: 'optimizationLevel: 4; web-renderer: skwasm,canvaskit; web-target: wasm,js;',
settings: 'optimizationLevel: 0; web-renderer: skwasm,canvaskit; web-target: wasm,js;',
),
]),
);