diff --git a/packages/flutter_tools/lib/src/zip.dart b/packages/flutter_tools/lib/src/zip.dart index 1eb874bfe4..fb6c28ef18 100644 --- a/packages/flutter_tools/lib/src/zip.dart +++ b/packages/flutter_tools/lib/src/zip.dart @@ -91,16 +91,21 @@ class _ZipToolBuilder extends ZipBuilder { } } - runCheckedSync( - ['zip', '-q', outFile.absolute.path]..addAll(_getCompressedNames()), - workingDirectory: zipBuildDir.path, - truncateCommand: true - ); - runCheckedSync( - ['zip', '-q', '-0', outFile.absolute.path]..addAll(_getStoredNames()), - workingDirectory: zipBuildDir.path, - truncateCommand: true - ); + if (_getCompressedNames().isNotEmpty) { + runCheckedSync( + ['zip', '-q', outFile.absolute.path]..addAll(_getCompressedNames()), + workingDirectory: zipBuildDir.path, + truncateCommand: true + ); + } + + if (_getStoredNames().isNotEmpty) { + runCheckedSync( + ['zip', '-q', '-0', outFile.absolute.path]..addAll(_getStoredNames()), + workingDirectory: zipBuildDir.path, + truncateCommand: true + ); + } } Iterable _getCompressedNames() {