本文整理匯總了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;
}