本文整理汇总了TypeScript中azure-pipelines-task-lib/task.tool函数的典型用法代码示例。如果您正苦于以下问题:TypeScript tool函数的具体用法?TypeScript tool怎么用?TypeScript tool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tool函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getVSTestConsolePath
export function getVSTestConsolePath(versionLowerLimit : string, versionUpperLimit : string): string {
let vswhereTool = tl.tool(path.join(__dirname, 'vswhere.exe'));
console.log(tl.loc('LookingForVsInstalltion'));
vswhereTool.line(`-version [${versionLowerLimit},${versionUpperLimit}) -latest -products * -requires Microsoft.VisualStudio.PackageGroup.TestTools.Core -property installationPath`);
let vsPath = vswhereTool.execSync({ silent: true } as tr.IExecSyncOptions).stdout;
vsPath = utils.Helper.trimString(vsPath);
if (!utils.Helper.isNullOrWhitespace(vsPath)) {
tl.debug('Visual Studio 15.0 or higher installed path: ' + vsPath);
return vsPath;
}
// look for build tool installation if full VS not present
console.log(tl.loc('LookingForBuildToolsInstalltion'));
vswhereTool = tl.tool(path.join(__dirname, 'vswhere.exe'));
vswhereTool.line(`-version [${versionLowerLimit},${versionUpperLimit}) -latest -products * -requires Microsoft.VisualStudio.Component.TestTools.BuildTools -property installationPath`);
vsPath = vswhereTool.execSync({ silent: true } as tr.IExecSyncOptions).stdout;
vsPath = utils.Helper.trimString(vsPath);
if (!utils.Helper.isNullOrWhitespace(vsPath)) {
tl.debug('Build tools installed path: ' + vsPath);
return vsPath;
}
return null;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:25,代码来源:versionfinder.ts
示例2: setProxy
private static setProxy(proxyConfig: tl.ProxyConfiguration) {
const nugetPath = tl.which('nuget');
console.log(tl.loc("SettingUpNugetProxySettings"));
// Set proxy url
let nuget = tl.tool(nugetPath);
nuget.arg('config');
nuget.arg('-set');
nuget.arg('http_proxy=' + proxyConfig.proxyUrl);
nuget.exec({} as trm.IExecOptions);
// Set proxy username
nuget = tl.tool(nugetPath);
nuget.arg('config');
nuget.arg('-set');
nuget.arg('http_proxy.user=' + proxyConfig.proxyUsername);
nuget.exec({} as trm.IExecOptions);
// Set proxy password
nuget = tl.tool(nugetPath);
nuget.arg('config');
nuget.arg('-set');
nuget.arg('http_proxy.password=' + proxyConfig.proxyPassword);
nuget.exec({} as trm.IExecOptions);
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:25,代码来源:nugetinstaller.ts
示例3: getmacOSProvisioningProfileType
export async function getmacOSProvisioningProfileType(provProfilePath: string) {
let provProfileType: string;
try {
//find the provisioning profile details
let provProfileDetails: string;
let getProvProfileDetailsCmd: ToolRunner = tl.tool(tl.which('security', true));
getProvProfileDetailsCmd.arg(['cms', '-D', '-i', provProfilePath]);
getProvProfileDetailsCmd.on('stdout', function (data) {
if (data) {
if (provProfileDetails) {
provProfileDetails = provProfileDetails.concat(data.toString().trim().replace(/[,\n\r\f\v]/gm, ''));
} else {
provProfileDetails = data.toString().trim().replace(/[,\n\r\f\v]/gm, '');
}
}
})
await getProvProfileDetailsCmd.exec();
let tmpPlist: string;
if (provProfileDetails) {
//write the provisioning profile to a plist
tmpPlist = '_xcodetasktmp.plist';
tl.writeFile(tmpPlist, provProfileDetails);
} else {
throw tl.loc('ProvProfileDetailsNotFound', provProfilePath);
}
//get ProvisionsAllDevices - this will exist for developer-id profiles
let provisionsAllDevices: string = await printFromPlist('ProvisionsAllDevices', tmpPlist);
tl.debug('provisionsAllDevices = ' + provisionsAllDevices);
if (provisionsAllDevices && provisionsAllDevices.trim().toLowerCase() === 'true') {
//ProvisionsAllDevices = true in developer-id profiles
provProfileType = 'developer-id';
} else {
let provisionedDevices: string = await printFromPlist('ProvisionedDevices', tmpPlist);
if (!provisionedDevices) {
// no provisioned devices means it is an app-store profile
provProfileType = 'app-store';
} else {
// profile with provisioned devices - use development
provProfileType = 'development';
}
}
//delete the temporary plist file
let deletePlistCommand: ToolRunner = tl.tool(tl.which('rm', true));
deletePlistCommand.arg(['-f', tmpPlist]);
await deletePlistCommand.exec();
} catch (err) {
tl.debug(err);
}
return provProfileType;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:54,代码来源:ios-signing-common.ts
示例4: detectMachineOS
private detectMachineOS(): string[] {
let osSuffix = [];
let scriptRunner: trm.ToolRunner;
try {
console.log(tl.loc("DetectingPlatform"));
if (tl.osType().match(/^Win/)) {
let escapedScript = path.join(this.getCurrentDir(), 'externals', 'get-os-platform.ps1').replace(/'/g, "''");
let command = `& '${escapedScript}'`
let powershellPath = tl.which('powershell', true);
scriptRunner = tl.tool(powershellPath)
.line('-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command')
.arg(command);
}
else {
let scriptPath = path.join(this.getCurrentDir(), 'externals', 'get-os-distro.sh');
this.setFileAttribute(scriptPath, "777");
scriptRunner = tl.tool(tl.which(scriptPath, true));
}
let result: trm.IExecSyncResult = scriptRunner.execSync();
if (result.code != 0) {
throw tl.loc("getMachinePlatformFailed", result.error ? result.error.message : result.stderr);
}
let output: string = result.stdout;
let index;
if ((index = output.indexOf("Primary:")) >= 0) {
let primary = output.substr(index + "Primary:".length).split(os.EOL)[0];
osSuffix.push(primary);
console.log(tl.loc("PrimaryPlatform", primary));
}
if ((index = output.indexOf("Legacy:")) >= 0) {
let legacy = output.substr(index + "Legacy:".length).split(os.EOL)[0];
osSuffix.push(legacy);
console.log(tl.loc("LegacyPlatform", legacy));
}
if (osSuffix.length == 0) {
throw tl.loc("CouldNotDetectPlatform");
}
}
catch (ex) {
throw tl.loc("FailedInDetectingMachineArch", JSON.stringify(ex));
}
return osSuffix;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:53,代码来源:versionfetcher.ts
示例5: deleteKeychain
export async function deleteKeychain(keychainPath: string): Promise<void> {
if (tl.exist(keychainPath)) {
let deleteKeychainCommand: ToolRunner = tl.tool(tl.which('security', true));
deleteKeychainCommand.arg(['delete-keychain', keychainPath]);
await deleteKeychainCommand.exec();
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:7,代码来源:ios-signing-common.ts
示例6: getVsTestRunnerDetails
export function getVsTestRunnerDetails(testConfig: models.TestConfigurations) {
const vstestexeLocation = locateVSTestConsole(testConfig);
// Temporary hack for 16.0. All this code will be removed once we migrate to the Hydra flow
if (testConfig.vsTestVersion === '16.0') {
testConfig.vsTestVersionDetails = new version.VSTestVersion(vstestexeLocation, 16, 0, 0);
return;
}
const vstestLocationEscaped = vstestexeLocation.replace(/\\/g, '\\\\');
const wmicTool = tl.tool('wmic');
const wmicArgs = ['datafile', 'where', 'name=\''.concat(vstestLocationEscaped, '\''), 'get', 'Version', '/Value'];
wmicTool.arg(wmicArgs);
let output = wmicTool.execSync({ silent: true } as tr.IExecSyncOptions).stdout;
if (utils.Helper.isNullOrWhitespace(output)) {
tl.error(tl.loc('ErrorReadingVstestVersion'));
throw new Error(tl.loc('ErrorReadingVstestVersion'));
}
output = output.trim();
tl.debug('VSTest Version information: ' + output);
const verSplitArray = output.split('=');
if (verSplitArray.length !== 2) {
tl.error(tl.loc('ErrorReadingVstestVersion'));
throw new Error(tl.loc('ErrorReadingVstestVersion'));
}
const versionArray = verSplitArray[1].split('.');
if (versionArray.length !== 4) {
tl.warning(tl.loc('UnexpectedVersionString', output));
throw new Error(tl.loc('UnexpectedVersionString', output));
}
const majorVersion = parseInt(versionArray[0]);
const minorVersion = parseInt(versionArray[1]);
const patchNumber = parseInt(versionArray[2]);
ci.publishEvent({ testplatform: `${majorVersion}.${minorVersion}.${patchNumber}` });
if (isNaN(majorVersion) || isNaN(minorVersion) || isNaN(patchNumber)) {
tl.warning(tl.loc('UnexpectedVersionNumber', verSplitArray[1]));
throw new Error(tl.loc('UnexpectedVersionNumber', verSplitArray[1]));
}
switch (majorVersion) {
case 14:
testConfig.vsTestVersionDetails = new version.Dev14VSTestVersion(vstestexeLocation, minorVersion, patchNumber);
break;
case 15:
testConfig.vsTestVersionDetails = new version.Dev15VSTestVersion(vstestexeLocation, minorVersion, patchNumber);
break;
default:
testConfig.vsTestVersionDetails = new version.VSTestVersion(vstestexeLocation, majorVersion, minorVersion, patchNumber);
break;
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:56,代码来源:versionfinder.ts
示例7: getCloudEntitlement
export async function getCloudEntitlement(provisioningProfilePath: string, exportMethod: string): Promise<string> {
//find the provisioning profile details
let provProfileDetails: string;
const getProvProfileDetailsCmd: ToolRunner = tl.tool(tl.which('security', true));
getProvProfileDetailsCmd.arg(['cms', '-D', '-i', provisioningProfilePath]);
getProvProfileDetailsCmd.on('stdout', function (data) {
if (data) {
if (provProfileDetails) {
provProfileDetails = provProfileDetails.concat(data.toString().trim().replace(/[,\n\r\f\v]/gm, ''));
} else {
provProfileDetails = data.toString().trim().replace(/[,\n\r\f\v]/gm, '');
}
}
});
await getProvProfileDetailsCmd.exec();
let tmpPlist: string;
if (provProfileDetails) {
//write the provisioning profile to a plist
tmpPlist = '_xcodetasktmp.plist';
tl.writeFile(tmpPlist, provProfileDetails);
} else {
throw tl.loc('ProvProfileDetailsNotFound', provisioningProfilePath);
}
//use PlistBuddy to figure out if cloud entitlement exists.
const cloudEntitlement: string = await printFromPlist('Entitlements:com.apple.developer.icloud-container-environment', tmpPlist);
//delete the temporary plist file
const deletePlistCommand: ToolRunner = tl.tool(tl.which('rm', true));
deletePlistCommand.arg(['-f', tmpPlist]);
await deletePlistCommand.exec();
if (!cloudEntitlement) {
return null;
}
tl.debug('Provisioning Profile contains cloud entitlement');
return (exportMethod === 'app-store' || exportMethod === 'enterprise' || exportMethod === 'developer-id')
? "Production"
: "Development";
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:43,代码来源:ios-signing-common.ts
示例8: getP12PrivateKeyName
export async function getP12PrivateKeyName(p12Path: string, p12Pwd: string): Promise<string> {
//openssl pkcs12 -in <p12Path> -nocerts -passin pass:"<p12Pwd>" -passout pass:"<p12Pwd>" | grep 'friendlyName'
tl.debug('getting the P12 private key name');
const opensslPath: string = tl.which('openssl', true);
const openssl: ToolRunner = tl.tool(opensslPath);
if (!p12Pwd) {
// if password is null or not defined, set it to empty
p12Pwd = '';
}
// since we can't suppress the private key bytes, encrypt them before we pass them to grep.
const privateKeyPassword = p12Pwd ? p12Pwd : generatePassword();
openssl.arg(['pkcs12', '-in', p12Path, '-nocerts', '-passin', 'pass:' + p12Pwd, '-passout', 'pass:' + privateKeyPassword]);
//we pipe through grep so we we don't log the private key to the console.
//even if it's encrypted, it's noise and could cause concern for some users.
const grepPath: string = tl.which('grep', true);
const grep: ToolRunner = tl.tool(grepPath);
grep.arg(['friendlyName']);
openssl.pipeExecOutputToTool(grep);
let privateKeyName: string;
openssl.on('stdout', function (data) {
if (data) {
// find the private key name
data = data.toString().trim();
const match = data.match(/friendlyName: (.*)/);
if (match && match[1]) {
privateKeyName = match[1].trim();
}
}
});
await openssl.exec();
tl.debug('P12 private key name = ' + privateKeyName);
if (!privateKeyName) {
throw new Error(tl.loc('P12PrivateKeyNameNotFound', p12Path));
}
return privateKeyName;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:41,代码来源:ios-signing-common.ts
示例9: getDefaultKeychainPath
export async function getDefaultKeychainPath() {
let defaultKeychainPath: string;
let getKeychainCmd: ToolRunner = tl.tool(tl.which('security', true));
getKeychainCmd.arg('default-keychain');
getKeychainCmd.on('stdout', function (data) {
if (data) {
defaultKeychainPath = data.toString().trim().replace(/[",\n\r\f\v]/gm, '');
}
})
await getKeychainCmd.exec();
return defaultKeychainPath;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:12,代码来源:ios-signing-common.ts
示例10: run
async function run()
{
try {
const version = taskLib.getInput("version", true);
const checkLatest = taskLib.getBoolInput("checkLatest", false) || false;
await getTfx(version, checkLatest);
await taskLib.tool("tfx").arg(["version", "--no-color"]).exec();
}
catch (error) {
taskLib.setResult(taskLib.TaskResult.Failed, error.message);
}
}
开发者ID:Microsoft,项目名称:vsts-extension-build-release-tasks,代码行数:13,代码来源:TfxInstaller.ts
注:本文中的azure-pipelines-task-lib/task.tool函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论