当前位置: 首页>>代码示例>>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;未经允许,请勿转载。