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.
This commit is contained in:
Greg Spencer 2017-12-18 14:40:29 -08:00 committed by GitHub
parent d2d86e35c5
commit 37f216bfab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 8 deletions

View File

@ -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)));

View File

@ -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);