From a8a53b81792c3c3e98b84ff56c66ec61c4699f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crash=20Co=E2=88=A5ison=20=E2=98=85=E2=98=86=E2=98=86?= =?UTF-8?q?=E2=98=86=E2=98=86?= <3751389+tehcrashxor@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:28:58 -0700 Subject: [PATCH] Support for PAC installed in any location, instead of using runnersDir --- src/Parameters.ts | 11 +++++++++++ src/pac/createPacRunner.ts | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Parameters.ts b/src/Parameters.ts index b0f32e3e..711ebc4e 100644 --- a/src/Parameters.ts +++ b/src/Parameters.ts @@ -13,5 +13,16 @@ export interface TelemetryParameters export interface RunnerParameters extends LoggerParameters, TelemetryParameters { workingDir: string; + + // Directory containing unzipped Windows and Linux PAC Nuget Packages. + // Expectation is that, both versions have been renamed such that + // linux PAC executable's path is /pac_linux/tools/pac + // and windows PAC executable's path is \pac\tools\pac.exe + // This should be ignored in favor of pacPath if specified. runnersDir: string; + + // Full path to pac.exe or pac (linux/mac) executable. Used instead of runnersDir if specified, + // for scenarios where PAC is installed in the pipeline instead of included in the + // ADO VSIX or GitHub tarball/zipball + pacPath?: string; } diff --git a/src/pac/createPacRunner.ts b/src/pac/createPacRunner.ts index b0744c98..4b15c948 100644 --- a/src/pac/createPacRunner.ts +++ b/src/pac/createPacRunner.ts @@ -3,11 +3,11 @@ import { resolve } from "path"; import { CommandRunner, createCommandRunner } from "../CommandRunner"; import { RunnerParameters } from "../Parameters"; -export default function createPacRunner({workingDir, runnersDir, logger, agent}: RunnerParameters): CommandRunner +export default function createPacRunner({workingDir, runnersDir, pacPath, logger, agent}: RunnerParameters): CommandRunner { return createCommandRunner( workingDir, - platform() === "win32" + pacPath ?? platform() === "win32" ? resolve(runnersDir, "pac", "tools", "pac.exe") : resolve(runnersDir, "pac_linux", "tools", "pac"), logger,