本文整理汇总了TypeScript中vsts-task-lib/toolrunner.ToolRunner.arg方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ToolRunner.arg方法的具体用法?TypeScript ToolRunner.arg怎么用?TypeScript ToolRunner.arg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vsts-task-lib/toolrunner.ToolRunner
的用法示例。
在下文中一共展示了ToolRunner.arg方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: configureBuild
/**
* Configures the provided ToolRunner instance with arguments which will invoke the tool represented by this class.
* @param toolRunner
* @returns {ToolRunner} ToolRunner instance with arguments applied
*/
public configureBuild(toolRunner: ToolRunner): ToolRunner {
if (this.isEnabled()) {
console.log(tl.loc('codeAnalysis_ToolIsEnabled'), this.toolName);
switch (this.buildOutput.buildEngine) {
case BuildEngine.Maven: {
toolRunner.arg(['findbugs:findbugs']);
break;
}
case BuildEngine.Gradle: {
tl.debug('Findbugs on Gradle is not implemented.');
throw new Error();
}
}
}
return toolRunner;
}
示例2: isMultiModuleProject
function isMultiModuleProject(wrapperScript: string): boolean {
let gradleBuild: ToolRunner = tl.tool(wrapperScript);
gradleBuild.arg('properties');
gradleBuild.line(tl.getInput('options', false));
let data: string = gradleBuild.execSync().stdout;
if (typeof data !== 'undefined' && data) {
let regex: RegExp = new RegExp('subprojects: .*');
let subProjects: RegExpExecArray = regex.exec(data);
tl.debug('Data: ' + subProjects);
if (typeof subProjects !== 'undefined' && subProjects && subProjects.length > 0) {
tl.debug('Sub Projects info: ' + subProjects.toString());
return (subProjects.join(',').toLowerCase() !== 'subprojects: []');
}
}
return false;
}
示例3: configureBuild
public configureBuild(toolRunner: ToolRunner): ToolRunner {
switch (this.buildOutput.buildEngine) {
case BuildEngine.Maven: {
tl.debug("Not implemented");
throw new Error();
}
case BuildEngine.Gradle: {
if (this.isEnabled()) {
console.log(tl.loc('codeAnalysis_ToolIsEnabled'), this.toolName);
var initScriptPath: string = path.join(__dirname, '../', this.toolName.toLowerCase() + '.gradle');
toolRunner.arg(['-I', initScriptPath]);
break;
}
}
}
return toolRunner;
}
示例4: printFromPlist
async function printFromPlist(itemToPrint: string, plistPath: string) {
let plist = tl.which('/usr/libexec/PlistBuddy', true);
let plistTool: ToolRunner = tl.tool(plist);
plistTool.arg(['-c', 'Print ' + itemToPrint, plistPath]);
let printedValue: string;
plistTool.on('stdout', function (data) {
if (data) {
printedValue = data.toString().trim();
}
});
try {
await plistTool.exec();
} catch (err) {
tl.debug('Exception when looking for ' + itemToPrint + ' in plist.');
printedValue = null;
}
return printedValue;
}
示例5: applySonarQubeConnectionParams
export function applySonarQubeConnectionParams(toolRunner: ToolRunner, sqHostUrl, sqHostUsername, sqHostPassword, sqDbUrl?, sqDbUsername?, sqDbPassword?): ToolRunner {
toolRunner.arg('-Dsonar.host.url=' + sqHostUrl);
toolRunner.arg('-Dsonar.login=' + sqHostUsername);
toolRunner.arg('-Dsonar.password=' + sqHostPassword);
if (sqDbUrl) {
toolRunner.arg('-Dsonar.jdbc.url=' + sqDbUrl);
}
if (sqDbUsername) {
toolRunner.arg('-Dsonar.jdbc.username=' + sqDbUsername);
}
if (sqDbPassword) {
toolRunner.arg('-Dsonar.jdbc.password=' + sqDbPassword);
}
return toolRunner;
}
示例6: setKeyPartitionList
/**
* Set the partition_id ACL so codesign has permission to use the signing key.
*/
async function setKeyPartitionList(keychainPath: string, keychainPwd: string, privateKeyName: string) {
// security set-key-partition-list -S apple-tool:,apple: -s -l <privateKeyName> -k <keychainPwd> <keychainPath>
// n.b. This command could update multiple keys (e.g. an expired signing key and a newer signing key.)
if (privateKeyName) {
tl.debug(`Setting the partition_id ACL for ${privateKeyName}`);
// "If you'd like to run /usr/bin/codesign with the key, "apple:" must be an element of the partition list." - security(1) man page.
// When you sign into your developer account in Xcode on a new machine, you get a private key with partition list "apple:". However
// "security import a.p12 -k login.keychain" results in the private key with partition list "apple-tool:". I'm preserving import's
// "apple-tool:" and adding the "apple:" codesign needs.
const partitionList = 'apple-tool:,apple:';
let setKeyCommand: ToolRunner = tl.tool(tl.which('security', true));
setKeyCommand.arg(['set-key-partition-list', '-S', partitionList, '-s', '-l', privateKeyName, '-k', keychainPwd, keychainPath]);
// Watch for "unknown command". set-key-partition-list was added in Sierra (macOS v10.12)
let unknownCommandErrorFound: boolean;
let incorrectPasswordErrorFound: boolean;
setKeyCommand.on('errline', (line: string) => {
if (!unknownCommandErrorFound && line.includes('security: unknown command')) {
unknownCommandErrorFound = true;
}
});
try {
await setKeyCommand.exec();
} catch (err) {
if (unknownCommandErrorFound) {
// If we're on an older OS, we don't need to run set-key-partition-list.
console.log(tl.loc('SetKeyPartitionListCommandNotFound'));
} else {
tl.error(err);
throw new Error(tl.loc('SetKeyPartitionListCommandFailed'));
}
}
}
}
示例7: findSigningIdentity
export async function findSigningIdentity(keychainPath: string) {
let signIdentity: string;
let findIdentityCmd: ToolRunner = tl.tool(tl.which('security', true));
findIdentityCmd.arg(['find-identity', '-v', '-p', 'codesigning', keychainPath]);
findIdentityCmd.on('stdout', function (data) {
if (data) {
let matches = data.toString().trim().match(/"(.+)"/g);
tl.debug('signing identity data = ' + matches);
if (matches && matches[0]) {
signIdentity = matches[0].replace(/"/gm, '');
tl.debug('signing identity data trimmed = ' + signIdentity);
}
}
})
await findIdentityCmd.exec();
if (signIdentity) {
tl.debug('findSigningIdentity = ' + signIdentity);
return signIdentity;
} else {
throw tl.loc('SignIdNotFound');
}
}
示例8: applySonarQubeConnectionParams
/**
* Applies required parameters for connecting a Java-based plugin (Maven, Gradle) to SonarQube.
* @param toolRunner ToolRunner to add parameters to
* @returns {ToolRunner} ToolRunner with parameters added
*/
private static applySonarQubeConnectionParams(toolRunner: ToolRunner): ToolRunner {
let sqEndpoint: SonarQubeEndpoint = SonarQubeEndpoint.getTaskSonarQubeEndpoint();
toolRunner.arg('-Dsonar.host.url=' + sqEndpoint.Url);
toolRunner.arg('-Dsonar.login=' + sqEndpoint.Username);
toolRunner.arg('-Dsonar.password=' + sqEndpoint.Password);
// sqDbUrl, sqDbUsername and sqDbPassword are required if the SonarQube version is less than 5.2.
let sqDbUrl: string = tl.getInput('sqDbUrl', false);
let sqDbUsername: string = tl.getInput('sqDbUsername', false);
let sqDbPassword: string = tl.getInput('sqDbPassword', false);
if (sqDbUrl) {
toolRunner.arg('-Dsonar.jdbc.url=' + sqDbUrl);
}
if (sqDbUsername) {
toolRunner.arg('-Dsonar.jdbc.username=' + sqDbUsername);
}
if (sqDbPassword) {
toolRunner.arg('-Dsonar.jdbc.password=' + sqDbPassword);
}
return toolRunner;
}
示例9: applySonarQubeConnectionParams
export function applySonarQubeConnectionParams(toolRunner: ToolRunner): ToolRunner {
var sqEndpoint: SonarQubeEndpoint = getSonarQubeEndpoint();
toolRunner.arg('-Dsonar.host.url=' + sqEndpoint.Url);
toolRunner.arg('-Dsonar.login=' + sqEndpoint.Username);
toolRunner.arg('-Dsonar.password=' + sqEndpoint.Password);
// sqDbUrl, sqDbUsername and sqDbPassword are required if the SonarQube version is less than 5.2.
var sqDbUrl = tl.getInput('sqDbUrl', false);
var sqDbUsername = tl.getInput('sqDbUsername', false);
var sqDbPassword = tl.getInput('sqDbPassword', false);
if (sqDbUrl) {
toolRunner.arg('-Dsonar.jdbc.url=' + sqDbUrl);
}
if (sqDbUsername) {
toolRunner.arg('-Dsonar.jdbc.username=' + sqDbUsername);
}
if (sqDbPassword) {
toolRunner.arg('-Dsonar.jdbc.password=' + sqDbPassword);
}
return toolRunner;
}
示例10: run
async function run() {
try {
tl.setResourcePath(path.join( __dirname, 'task.json'));
//--------------------------------------------------------
// Tooling
//--------------------------------------------------------
tl.setEnvVar('DEVELOPER_DIR', tl.getInput('xcodeDeveloperDir', false));
var useXctool : boolean = tl.getBoolInput('useXctool', false);
var tool : string = useXctool ? tl.which('xctool', true) : tl.which('xcodebuild', true);
tl.debug('Tool selected: '+ tool);
//--------------------------------------------------------
// Paths
//--------------------------------------------------------
var workingDir : string = tl.getPathInput('cwd');
tl.cd(workingDir);
var outPath : string = tl.resolve(workingDir, tl.getInput('outputPattern', true)); //use posix implementation to resolve paths to prevent unit test failures on Windows
tl.mkdirP(outPath);
//--------------------------------------------------------
// Xcode args
//--------------------------------------------------------
var ws : string = tl.getPathInput('xcWorkspacePath', false, false);
if(tl.filePathSupplied('xcWorkspacePath')) {
var workspaceMatches = tl.glob(ws);
tl.debug("Found " + workspaceMatches.length + ' workspaces matching.');
if (workspaceMatches.length > 0) {
ws = workspaceMatches[0];
if (workspaceMatches.length > 1) {
tl.warning(tl.loc('MultipleWorkspacesFound', ws));
}
}
else {
throw tl.loc('WorkspaceDoesNotExist');
}
}
var sdk : string = tl.getInput('sdk', false);
var configuration : string = tl.getInput('configuration', false);
var scheme : string = tl.getInput('scheme', false);
var useXcpretty : boolean = tl.getBoolInput('useXcpretty', false);
var xctoolReporter : string = tl.getInput('xctoolReporter', false);
var actions : string [] = tl.getDelimitedInput('actions', ' ', true);
var packageApp : boolean = tl.getBoolInput('packageApp', true);
var args : string = tl.getInput('args', false);
//--------------------------------------------------------
// Exec Tools
//--------------------------------------------------------
// --- Xcode Version ---
var xcv : ToolRunner = tl.tool(tool);
xcv.arg('-version');
await xcv.exec();
// --- Xcode build arguments ---
var xcb: ToolRunner = tl.tool(tool);
xcb.argIf(sdk, ['-sdk', sdk]);
xcb.argIf(configuration, ['-configuration', configuration]);
if(ws && tl.filePathSupplied('xcWorkspacePath')) {
xcb.arg('-workspace');
xcb.arg(ws);
}
xcb.argIf(scheme, ['-scheme', scheme]);
xcb.argIf(useXctool && xctoolReporter, ['-reporter', 'plain', '-reporter', xctoolReporter]);
xcb.arg(actions);
xcb.arg('DSTROOT=' + path.join(outPath, 'build.dst'));
xcb.arg('OBJROOT=' + path.join(outPath, 'build.obj'));
xcb.arg('SYMROOT=' + path.join(outPath, 'build.sym'));
xcb.arg('SHARED_PRECOMPS_DIR=' + path.join(outPath, 'build.pch'));
if (args) {
xcb.line(args);
}
//--------------------------------------------------------
// iOS signing and provisioning
//--------------------------------------------------------
var signMethod : string = tl.getInput('signMethod', false);
var keychainToDelete : string;
var profileToDelete : string;
if(signMethod === 'file') {
var p12 : string = tl.getPathInput('p12', false, false);
var p12pwd : string = tl.getInput('p12pwd', false);
var provProfilePath : string = tl.getPathInput('provProfile', false);
var removeProfile : boolean = tl.getBoolInput('removeProfile', false);
if(tl.filePathSupplied('p12') && tl.exist(p12)) {
p12 = tl.resolve(workingDir, p12);
var keychain : string = path.join(workingDir, '_xcodetasktmp.keychain');
var keychainPwd : string = '_xcodetask_TmpKeychain_Pwd#1';
//create a temporary keychain and install the p12 into that keychain
await sign.installCertInTemporaryKeychain(keychain, keychainPwd, p12, p12pwd);
xcb.arg('OTHER_CODE_SIGN_FLAGS=--keychain=' + keychain);
keychainToDelete = keychain;
//.........这里部分代码省略.........