Unverified Commit 37f216bf authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Add support for 7Zip to the packaging script. (#13659)

A modern version of 7Zip (7za.exe) is now installed on the bots, this makes use of that.
parent d2d86e35
......@@ -65,7 +65,7 @@ class ArchiveCreator {
final ProcessRunner _runner;
String flutter;
final String git = Platform.isWindows ? 'git.bat' : 'git';
final String zip = Platform.isWindows ? 'zip.exe' : 'zip';
final String zip = Platform.isWindows ? '7za.exe' : 'zip';
final String tar = Platform.isWindows ? 'tar.exe' : 'tar';
Map<String, String> environment;
......@@ -154,13 +154,17 @@ class ArchiveCreator {
}
void createZipArchive(File output, Directory source) {
final List<String> args = <String>[
'-r',
'-9',
'-q',
final List<String> args = <String>[];
if (Platform.isWindows) {
// We use 7-Zip on Windows, which has different args.
args.addAll(<String>['a', '-tzip', '-mx=9']);
} else {
args.addAll(<String>['-r', '-9', '-q']);
}
args.addAll(<String>[
output.absolute.path,
path.basename(source.absolute.path),
];
]);
_runProcess(zip, args,
workingDirectory: new Directory(path.dirname(source.absolute.path)));
......
......@@ -21,7 +21,7 @@ void main() {
List<MockProcessResult> results;
final List<List<String>> args = <List<String>>[];
final List<Map<Symbol, dynamic>> namedArgs = <Map<Symbol, dynamic>>[];
final String zipExe = Platform.isWindows ? 'zip.exe' : 'zip';
final String zipExe = Platform.isWindows ? '7za.exe' : 'zip';
final String tarExe = Platform.isWindows ? 'tar.exe' : 'tar';
final String gitExe = Platform.isWindows ? 'git.bat' : 'git';
String flutterExe;
......@@ -135,8 +135,13 @@ void main() {
'$flutterExe create --template=package ${path.join(tmpDir.path, 'create_package')}',
'$flutterExe create --template=plugin ${path.join(tmpDir.path, 'create_plugin')}',
'$gitExe clean -f -X **/.packages',
'$zipExe -r -9 -q ${path.join(tmpDir.path, 'flutter_master.zip')} flutter',
];
if (Platform.isWindows) {
commands.add('$zipExe a -tzip -mx=9 ${path.join(tmpDir.path, 'flutter_master.zip')} flutter');
} else {
commands.add('$zipExe -r -9 -q ${path.join(tmpDir.path, 'flutter_master.zip')} flutter');
}
int step = 0;
for (String command in commands) {
_verifyCommand(args[step++], command);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment