本文整理汇总了TypeScript中vso-task-lib/vsotask.warning函数的典型用法代码示例。如果您正苦于以下问题:TypeScript warning函数的具体用法?TypeScript warning怎么用?TypeScript warning使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warning函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: RegExp
}
tl.debug(`Using ${replaceRegex} as the replacement regex`);
var buildRegexObj = new RegExp(buildRegex);
if (buildRegexObj.test(buildNumber)) {
var versionNum = buildRegexObj.exec(buildNumber)[0];
console.info(`Using version ${versionNum} in folder ${sourcePath}`);
// get a list of all files under this root
var allFiles = tl.find(sourcePath);
// Now matching the pattern against all files
var filesToReplace = tl.match(allFiles, filePattern, { matchBase: true });
if (filesToReplace === undefined || filesToReplace.length === 0) {
tl.warning("No files found");
} else {
for(var i = 0; i < filesToReplace.length; i++){
var file = filesToReplace[i];
console.info(` -> Changing version in ${file}`);
// replace all occurrences by adding g to the pattern
sh.sed("-i", new RegExp(replaceRegex, "g"), versionNum, file);
}
console.info(`Replaced version in ${filesToReplace.length} files`);
}
} else {
tl.warning(`Could not extract a version from [${buildNumber}] using pattern [${buildRegex}]`);
}
tl.debug("Leaving Version Assemblies step");
示例2: RegExp
tl.debug(`Using ${replaceRegex} as the replacement regex`);
if (buildRegexIndex === undefined || buildRegexIndex.length === 0){
buildRegexIndex = "0";
}
tl.debug(`Using ${buildRegexIndex} as the build regex index regex`);
var buildRegexObj = new RegExp(buildRegex);
if (buildRegexObj.test(buildNumber)) {
var versionNum = buildRegexObj.exec(buildNumber)[buildRegexIndex];
console.info(`Using prefix [${replacePrefix}] and version [${versionNum}] in folder [${sourcePath}]`);
var filesToReplace = tl.glob(`${sourcePath}\\${filePattern}`);
if (filesToReplace === undefined || filesToReplace.length === 0) {
tl.warning("No files found");
} else {
for (var i = 0; i < filesToReplace.length; i++) {
var file = filesToReplace[i];
console.info(`Changing version in ${file}`);
var contents = fs.readFileSync(file, 'utf8').toString();
var checkMatches = new RegExp(replaceRegex).exec(contents);
if (!checkMatches || checkMatches.length === 0) {
if (failIfNoMatchFound) {
tl.error(`No matches for regex [${replaceRegex}] found in file ${file}`);
process.exit(1);
} else {
tl.warning(`No matches for regex [${replaceRegex}] found in file ${file}`);
}
} else {
示例3:
var sourceDir = tl.getVariable("Agent.ReleaseDirectory");
tl.cd(sourceDir);
// create a new dir for the source
tl.mkdirP("__s");
tl.cd("__s");
if (!ut.cloneRepo(repoUrl, pat)) {
tl.exit(1);
}
// cd to the repo directory
tl.cd(ut.findSubdirs(process.cwd())[0]);
tl.debug(`Working dir: ${process.cwd()}`);
} else {
tl.cd(sourceDir);
// set the remote creds using the token
if (ut.isEmpty(token)) {
tl.warning("Could not find System.AccessToken. Attempting to continue - if credentials fail, then please enable the token in the build Options page.");
} else {
ut.setRemote(repoUrl, token, remoteName);
}
}
// fetch the remote branches
if (ut.execGit(["fetch", remoteName]).code !== 0) {
tl.exit(1);
}
if (mergeType === "test") {
var branchesToMerge = branchesToMergeStr.split(',');
console.info(`Found ${branchesToMerge.length} branches to test`);
// pull all the branches that we're testing down so that they are locally