[tools, web] Make sure to copy the dump-info file if dump-info is used (#165013)

Also fixed the wording of the dump-info build flag
This commit is contained in:
Kevin Moore 2025-03-11 17:52:06 -05:00 committed by GitHub
parent 81139dbcab
commit 292496f80d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View File

@ -252,6 +252,12 @@ class Dart2JSTarget extends Dart2WebTarget {
return true; return true;
} }
} }
if (compilerConfig.dumpInfo) {
if (file.basename == 'main.dart.js.info.json') {
return true;
}
}
return false; return false;
}); });

View File

@ -95,7 +95,7 @@ class BuildWebCommand extends BuildSubCommand {
negatable: false, negatable: false,
help: help:
'Passes "--dump-info" to the Javascript compiler which generates ' 'Passes "--dump-info" to the Javascript compiler which generates '
'information about the generated code is a .js.info.json file.', 'information about the generated code in main.dart.js.info.json.',
); );
argParser.addFlag( argParser.addFlag(
'no-frequency-based-minification', 'no-frequency-based-minification',

View File

@ -227,14 +227,18 @@ name: foo
..createSync(recursive: true) ..createSync(recursive: true)
..writeAsStringSync('A'); ..writeAsStringSync('A');
environment.buildDir.childFile('main.dart.js').createSync(); environment.buildDir.childFile('main.dart.js').createSync();
environment.buildDir.childFile('main.dart.js.info.json').createSync();
environment.buildDir.childFile('main.dart.js.map').createSync(); environment.buildDir.childFile('main.dart.js.map').createSync();
environment.buildDir.childFile('main.dart.js_1.part.js').createSync(); environment.buildDir.childFile('main.dart.js_1.part.js').createSync();
environment.buildDir.childFile('main.dart.js_1.part.js.map').createSync(); environment.buildDir.childFile('main.dart.js_1.part.js.map').createSync();
await WebReleaseBundle(<WebCompilerConfig>[const JsCompilerConfig()]).build(environment); await WebReleaseBundle(<WebCompilerConfig>[
const JsCompilerConfig(dumpInfo: true),
]).build(environment);
expect(environment.outputDir.childFile('foo.txt').readAsStringSync(), 'A'); expect(environment.outputDir.childFile('foo.txt').readAsStringSync(), 'A');
expect(environment.outputDir.childFile('main.dart.js').existsSync(), true); expect(environment.outputDir.childFile('main.dart.js').existsSync(), true);
expect(environment.outputDir.childFile('main.dart.js.info.json').existsSync(), true);
expect(environment.outputDir.childFile('main.dart.js.map').existsSync(), true); expect(environment.outputDir.childFile('main.dart.js.map').existsSync(), true);
expect(environment.outputDir.childFile('main.dart.js_1.part.js').existsSync(), true); expect(environment.outputDir.childFile('main.dart.js_1.part.js').existsSync(), true);
expect(environment.outputDir.childFile('main.dart.js_1.part.js.map').existsSync(), true); expect(environment.outputDir.childFile('main.dart.js_1.part.js.map').existsSync(), true);