本文整理匯總了TypeScript中azure-pipelines-task-lib.tool函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript tool函數的具體用法?TypeScript tool怎麽用?TypeScript tool使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了tool函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: publish
export function publish(vsixPath: string, manifestPath: string, warningsToIgnore: string) {
let vsixPublisherExe = getVsixPublisherExe();
let vsixPublisher = tl.tool(vsixPublisherExe);
vsixPublisher.arg("publish");
vsixPublisher.arg(["-payload", vsixPath]);
vsixPublisher.arg(["-publishManifest", manifestPath]);
vsixPublisher.arg(["-ignoreWarnings", warningsToIgnore]);
if (vsixPublisher.execSync({ failOnStdErr: true } as tr.IExecOptions).code !== 0)
{
throw new Error("Publish failed.");
}
console.info(`Published successfully.`)
}
示例2: login
export function login(publisher: string, token: string) {
let vsixPublisherExe = getVsixPublisherExe();
let vsixPublisher = tl.tool(vsixPublisherExe);
vsixPublisher.arg("login");
vsixPublisher.arg(["-personalAccessToken", token]);
vsixPublisher.arg(["-publisherName", publisher]);
if (vsixPublisher.execSync({ failOnStdErr: true } as tr.IExecOptions).code !== 0)
{
throw new Error("Login failed.");
}
loggedIn = true;
console.info(`Login successful.`)
}
示例3: getVsixPublisherExe
export function getVsixPublisherExe(): string {
if (cacheVsixPublisherExe === "") {
const vswhereTool = tl.tool(path.join(__dirname, "tools", "vswhere.exe"));
vswhereTool.line("-version [15.0,17.0) -latest -requires Microsoft.VisualStudio.Component.VSSDK -find VSSDK\\VisualStudioIntegration\\Tools\\Bin\\VsixPublisher.exe");
const vswhereResult = vswhereTool.execSync({ silent: true } as tr.IExecSyncOptions);
const vsixPublisherExe = vswhereResult.stdout.trim();
if (vswhereResult.code === 0 && vsixPublisherExe && tl.exist(vsixPublisherExe))
{
tl.debug('VsixPublisher.exe installed path: ' + vsixPublisherExe);
cacheVsixPublisherExe = vsixPublisherExe;
}
else
{
throw new Error("Could not locate vsixpublisher.exe. Ensure the Visual Studio SDK is installed on the agent.");
}
}
return cacheVsixPublisherExe;
}
示例4: logout
export function logout(publisher: string) {
if (loggedIn)
{
let vsixPublisherExe = getVsixPublisherExe();
let vsixPublisher = tl.tool(vsixPublisherExe);
vsixPublisher.arg("logout");
vsixPublisher.arg(["-publisherName", publisher]);
vsixPublisher.arg("-ignoreMissingPublisher");
if (vsixPublisher.execSync({ failOnStdErr: true } as tr.IExecOptions).code !== 0)
{
throw new Error("Logout failed.");
}
loggedIn = false;
}
console.info(`Logout successful.`)
}