本文整理汇总了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);
}
}
}
示例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];
};
示例3: resolveToolPath
export function resolveToolPath(path: string ): string {
return tl.resolve(path);
}
示例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);
}
示例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;
}