當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript azure-pipelines-task-lib.tool函數代碼示例

本文整理匯總了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.`)
}
開發者ID:Microsoft,項目名稱:vsts-extension-build-release-tasks,代碼行數:16,代碼來源:Utils.ts

示例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.`)
}
開發者ID:Microsoft,項目名稱:vsts-extension-build-release-tasks,代碼行數:16,代碼來源:Utils.ts

示例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;
 }
開發者ID:Microsoft,項目名稱:vsts-extension-build-release-tasks,代碼行數:18,代碼來源:Utils.ts

示例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.`)
}
開發者ID:Microsoft,項目名稱:vsts-extension-build-release-tasks,代碼行數:18,代碼來源:Utils.ts


注:本文中的azure-pipelines-task-lib.tool函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。