diff --git a/Tasks/ArchiveFiles/archivefiles.ts b/Tasks/ArchiveFiles/archivefiles.ts index 709a5753f8a6..ee358afed93d 100644 --- a/Tasks/ArchiveFiles/archivefiles.ts +++ b/Tasks/ArchiveFiles/archivefiles.ts @@ -80,9 +80,9 @@ function sevenZipArchive(archive: string, compression: string, files: string[]) sevenZip.arg('a'); sevenZip.arg('-t' + compression); - const sevenZipCompression = tl.getInput('sevenZipCompression', false); - if(sevenZipCompression) { - sevenZip.arg('-mx=' + sevenZipCompression); + const sevenZipCompression = tl.getInput('sevenZipCompression', false); + if (sevenZipCompression) { + sevenZip.arg('-mx=' + mapSevenZipCompressionLevel(sevenZipCompression)); } sevenZip.arg(archive); @@ -92,6 +92,26 @@ function sevenZipArchive(archive: string, compression: string, files: string[]) return handleExecResult(sevenZip.execSync(getOptions()), archive); } +// map from YAML-friendly value to 7-Zip numeric value +function mapSevenZipCompressionLevel(sevenZipCompression: string) { + switch (sevenZipCompression) { + case "ultra": + return "9"; + case "maximum": + return "7"; + case "normal": + return "5"; + case "fast": + return "3"; + case "fastest": + return "1"; + case "none": + return "0"; + default: + return "5"; + } +} + // linux & mac only function zipArchive(archive: string, files: string[]) { tl.debug('Creating archive with zip: ' + archive); diff --git a/Tasks/ArchiveFiles/task.json b/Tasks/ArchiveFiles/task.json index 308f036e0962..1cc0e4eb94e8 100644 --- a/Tasks/ArchiveFiles/task.json +++ b/Tasks/ArchiveFiles/task.json @@ -17,7 +17,7 @@ "demands": [], "version": { "Major": 2, - "Minor": 128, + "Minor": 135, "Patch": 0 }, "groups": [ @@ -70,12 +70,12 @@ "groupName": "archive", "visibleRule": "archiveType = 7z", "options": { - "9": "Ultra", - "7": "Maximum", - "5": "Normal", - "3": "Fast", - "1": "Fastest", - "0": "None" + "ultra": "Ultra", + "maximum": "Maximum", + "normal": "Normal", + "fast": "Fast", + "fastest": "Fastest", + "none": "None" } }, { diff --git a/Tasks/ArchiveFiles/task.loc.json b/Tasks/ArchiveFiles/task.loc.json index 267cb9912c8c..c506014bedd7 100644 --- a/Tasks/ArchiveFiles/task.loc.json +++ b/Tasks/ArchiveFiles/task.loc.json @@ -17,7 +17,7 @@ "demands": [], "version": { "Major": 2, - "Minor": 128, + "Minor": 135, "Patch": 0 }, "groups": [ @@ -70,12 +70,12 @@ "groupName": "archive", "visibleRule": "archiveType = 7z", "options": { - "0": "None", - "1": "Fastest", - "3": "Fast", - "5": "Normal", - "7": "Maximum", - "9": "Ultra" + "ultra": "Ultra", + "maximum": "Maximum", + "normal": "Normal", + "fast": "Fast", + "fastest": "Fastest", + "none": "None" } }, {