Skip to content

Commit 0b33b85

Browse files
[devicelab] measure entire release folder size, zipped (#115612)
* [devicelab] measure entire release folder size, zipped * [devicelab] tar with more settings * super safe reland * Update perf_tests.dart
1 parent 450f162 commit 0b33b85

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

dev/devicelab/lib/tasks/perf_tests.dart

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,19 +1513,29 @@ class CompileTest {
15131513
watch.start();
15141514
await flutter('build', options: options);
15151515
watch.stop();
1516-
final String basename = path.basename(cwd);
1517-
final String exePath = path.join(
1516+
final String buildPath = path.join(
15181517
cwd,
15191518
'build',
15201519
'windows',
15211520
'runner',
15221521
'release',
1523-
'$basename.exe');
1524-
final File exe = file(exePath);
1522+
);
15251523
// On Windows, we do not produce a single installation package file,
1526-
// rather a directory containing an .exe and .dll files.
1527-
// The release size is set to the size of the produced .exe file
1528-
releaseSizeInBytes = exe.lengthSync();
1524+
// rather a directory containing an .exe and .dll files. Zip them all
1525+
// together to get an approximate release size.
1526+
final int result = await exec('tar.exe', <String>['-zcf', 'build/app.tar.gz', '"$buildPath"']);
1527+
if (result == 0) {
1528+
final File outputFile = file('build/app.tar.gz');
1529+
if (outputFile.existsSync()) {
1530+
releaseSizeInBytes = outputFile.lengthSync();
1531+
} else {
1532+
print('tar completed successfully, but ${outputFile.path} does not exist!');
1533+
releaseSizeInBytes = 0;
1534+
}
1535+
} else {
1536+
print('Failed to run tar.exe: $result');
1537+
releaseSizeInBytes = 0;
1538+
}
15291539
break;
15301540
}
15311541

0 commit comments

Comments
 (0)