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


TypeScript task.resolve函數代碼示例

本文整理匯總了TypeScript中vsts-task-lib/task.resolve函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript resolve函數的具體用法?TypeScript resolve怎麽用?TypeScript resolve使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了resolve函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: run

async function run(){
    let version = tasks.getInput("version");
    let forceEmbedded = /embedded/i.test(version);

    try{
        if(forceEmbedded){
            console.log("Forcing the use of embedded octo.");
            await getEmbeddedOcto(tasks.resolve(__dirname, "embedded")).then(addToolToPath);
        }else{
            let option = await resolvePublishedOctoVersion(tasks.getInput("version"));
            console.log(`Using octo version ${option.version}`);
            await getOrDownloadOcto(option).then(addToolToPath);

        }

        tasks.setResult(tasks.TaskResult.Succeeded, "");
    }catch(error){
        if(forceEmbedded){
            tasks.setResult(tasks.TaskResult.Failed, error);
            return;
        }

        console.log(`Failed to resolve latest octo version. Using embedded version. ${error}`);

        try {
            await getEmbeddedOcto(tasks.resolve(__dirname, "embedded")).then(addToolToPath);
        }catch(embeddedOctoError){
            tasks.setResult(tasks.TaskResult.Failed, embeddedOctoError);
        }
    }
}
開發者ID:OctopusDeploy,項目名稱:OctoTFS,代碼行數:31,代碼來源:index.ts

示例2: Error

const findAndroidTool = (tool: string): string => {
    const androidHome = tl.getVariable('ANDROID_HOME');
    if (!androidHome) {
        throw new Error(tl.loc('AndroidHomeNotSet'));
    }

    // add * in search as on Windows the tool may end with ".exe" or ".bat"
    const toolsList = tl.findMatch(tl.resolve(androidHome, 'build-tools'), tool + '*', null, { matchBase: true });

    if (!toolsList || toolsList.length === 0) {
        throw new Error(tl.loc('CouldNotFindToolInAndroidHome', tool, androidHome));
    }

    return toolsList[0];
};
開發者ID:grawcho,項目名稱:vso-agent-tasks,代碼行數:15,代碼來源:androidsigning.ts

示例3: resolveToolPath

export function resolveToolPath(path: string ): string {
    return tl.resolve(path);
}
開發者ID:grawcho,項目名稱:vso-agent-tasks,代碼行數:3,代碼來源:Utility.ts

示例4: getSecureFileTempDownloadPath

 /**
  * Returns the temporary download location for the secure file
  * @param secureFileId
  */
 getSecureFileTempDownloadPath(secureFileId: string): string {
     const fileName: string = tl.getSecureFileName(secureFileId);
     return tl.resolve(tl.getVariable('Agent.TempDirectory'), fileName);
 }
開發者ID:grawcho,項目名稱:vso-agent-tasks,代碼行數:8,代碼來源:securefiles-common.ts

示例5: downloadSecureFile

 async downloadSecureFile(secureFileId: string) {
     tl.debug('Mock downloadSecureFile with id = ' + secureFileId);
     let fileName: string = secureFileId + '.filename';
     let tempDownloadPath: string = tl.resolve(tl.getVariable('Agent.TempDirectory'), fileName);
     return tempDownloadPath;
 }
開發者ID:DarqueWarrior,項目名稱:vsts-tasks,代碼行數:6,代碼來源:securefiles-common-mock.ts


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