From e51a6f995a70b8c87ded3647281a13aa81511aaa Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 1 Mar 2019 15:18:44 -0500 Subject: [PATCH 1/2] Special case ia32 --- Tasks/NodeToolV0/nodetool.ts | 12 ++++++++---- Tasks/NodeToolV0/task.json | 2 +- Tasks/NodeToolV0/task.loc.json | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Tasks/NodeToolV0/nodetool.ts b/Tasks/NodeToolV0/nodetool.ts index cd469e8f58b3..5da060beda7d 100644 --- a/Tasks/NodeToolV0/nodetool.ts +++ b/Tasks/NodeToolV0/nodetool.ts @@ -7,6 +7,10 @@ import * as path from 'path'; let osPlat: string = os.platform(); let osArch: string = os.arch(); +if (osArch.toLowerCase() == 'ia32') { + osArch = 'x86'; +} + async function run() { try { let versionSpec = taskLib.getInput('versionSpec', true); @@ -122,8 +126,8 @@ async function acquireNode(version: string): Promise { // Download - a tool installer intimately knows how to get the tool (and construct urls) // version = toolLib.cleanVersion(version); - let fileName: string = osPlat == 'win32'? 'node-v' + version + '-win-' + os.arch() : - 'node-v' + version + '-' + osPlat + '-' + os.arch(); + let fileName: string = osPlat == 'win32'? 'node-v' + version + '-win-' + osArch : + 'node-v' + version + '-' + osPlat + '-' + osArch; let urlFileName: string = osPlat == 'win32'? fileName + '.7z': fileName + '.tar.gz'; @@ -191,8 +195,8 @@ async function acquireNodeFromFallbackLocation(version: string): Promise let exeUrl: string; let libUrl: string; try { - exeUrl = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.exe`; - libUrl = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.lib`; + exeUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.exe`; + libUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.lib`; await toolLib.downloadTool(exeUrl, path.join(tempDir, "node.exe")); await toolLib.downloadTool(libUrl, path.join(tempDir, "node.lib")); diff --git a/Tasks/NodeToolV0/task.json b/Tasks/NodeToolV0/task.json index 2661e742696f..0fae38545eba 100644 --- a/Tasks/NodeToolV0/task.json +++ b/Tasks/NodeToolV0/task.json @@ -13,7 +13,7 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 148, + "Minor": 149, "Patch": 0 }, "satisfies": [ diff --git a/Tasks/NodeToolV0/task.loc.json b/Tasks/NodeToolV0/task.loc.json index 6211173e6bcf..f45ac6e8d06c 100644 --- a/Tasks/NodeToolV0/task.loc.json +++ b/Tasks/NodeToolV0/task.loc.json @@ -13,7 +13,7 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 148, + "Minor": 149, "Patch": 0 }, "satisfies": [ From f4305fc0d32dad9a99c4977831f8ce0fca32c51b Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Tue, 5 Mar 2019 11:26:12 -0500 Subject: [PATCH 2/2] Feedback --- Tasks/NodeToolV0/nodetool.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Tasks/NodeToolV0/nodetool.ts b/Tasks/NodeToolV0/nodetool.ts index 5da060beda7d..a9b289b33eee 100644 --- a/Tasks/NodeToolV0/nodetool.ts +++ b/Tasks/NodeToolV0/nodetool.ts @@ -5,11 +5,7 @@ import * as os from 'os'; import * as path from 'path'; let osPlat: string = os.platform(); -let osArch: string = os.arch(); - -if (osArch.toLowerCase() == 'ia32') { - osArch = 'x86'; -} +let osArch: string = getArch(); async function run() { try { @@ -218,4 +214,12 @@ async function acquireNodeFromFallbackLocation(version: string): Promise return await toolLib.cacheDir(tempDir, 'node', version); } +function getArch(): string { + let arch: string = os.arch(); + if (arch === 'ia32') { + arch = 'x86'; + } + return arch; +} + run();