本文整理汇总了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.`)
}