當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ToolRunner.pathArg方法代碼示例

本文整理匯總了TypeScript中vsts-task-lib/toolrunner.ToolRunner.pathArg方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ToolRunner.pathArg方法的具體用法?TypeScript ToolRunner.pathArg怎麽用?TypeScript ToolRunner.pathArg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vsts-task-lib/toolrunner.ToolRunner的用法示例。


在下文中一共展示了ToolRunner.pathArg方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getProvisioningProfileUUID

export async function getProvisioningProfileUUID(provProfilePath: string) {

    //find the provisioning profile UUID
    var provProfileDetails : string;
    var getProvProfileDetailsCmd : ToolRunner = tl.createToolRunner(tl.which('security', true));
    getProvProfileDetailsCmd.arg(['cms', '-D', '-i']);
    getProvProfileDetailsCmd.pathArg(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();

    if(provProfileDetails) {
        //write the provisioning profile to a plist
        var tmpPlist = '_xcodetasktmp.plist';
        fs.writeFileSync(tmpPlist, provProfileDetails);
    } else {
        throw tl.loc('ProvProfileDetailsNotFound', provProfilePath);
    }

    //use PlistBuddy to figure out the UUID
    var provProfileUUID : string;
    var plist = tl.which('/usr/libexec/PlistBuddy', true);
    var plistTool : ToolRunner = tl.createToolRunner(plist);
    plistTool.arg(['-c', 'Print UUID']);
    plistTool.pathArg(tmpPlist);
    plistTool.on('stdout', function (data) {
        if (data) {
            provProfileUUID = data.toString();
        }
    })
    await plistTool.exec();

    //delete the temporary plist file
    var deletePlistCommand : ToolRunner = tl.createToolRunner(tl.which('rm', true));
    deletePlistCommand.arg('-f');
    deletePlistCommand.pathArg(tmpPlist);
    await deletePlistCommand.exec();

    if(provProfileUUID) {
        //copy the provisioning profile file to ~/Library/MobileDevice/Provisioning Profiles
        tl.mkdirP(userProvisioningProfilesPath); // Path may not exist if Xcode has not been run yet.
        var pathToProvProfile : string = getProvisioningProfilePath(provProfileUUID);
        var copyProvProfileCmd : ToolRunner = tl.createToolRunner(tl.which('cp', true));
        copyProvProfileCmd.arg('-f');
        copyProvProfileCmd.pathArg(provProfilePath); //source
        copyProvProfileCmd.pathArg(pathToProvProfile); //dest
        await copyProvProfileCmd.exec();

        return provProfileUUID;
    } else {
        throw tl.loc('ProvProfileUUIDNotFound', provProfilePath);
    }
}
開發者ID:PazSchori,項目名稱:vsts-tasks,代碼行數:60,代碼來源:ios-signing-common.ts

示例2: installCertInTemporaryKeychain

export async function installCertInTemporaryKeychain(keychainPath : string, keychainPwd: string, p12CertPath : string, p12Pwd: string) {
    //delete keychain if exists
    await deleteKeychain(keychainPath);

    //create keychain
    var createKeychainCommand : ToolRunner =  tl.createToolRunner(tl.which('security', true));
    createKeychainCommand.arg(['create-keychain', '-p', keychainPwd]);
    createKeychainCommand.pathArg(keychainPath);
    await createKeychainCommand.exec();

    //update keychain settings
    var keychainSettingsCommand : ToolRunner = tl.createToolRunner(tl.which('security', true));
    keychainSettingsCommand.arg(['set-keychain-settings', '-lut', '7200']);
    keychainSettingsCommand.pathArg(keychainPath);
    await keychainSettingsCommand.exec();

    //unlock keychain
    await unlockKeychain(keychainPath, keychainPwd);

    //import p12 cert into the keychain
    var importP12Command : ToolRunner = tl.createToolRunner(tl.which('security', true));
    importP12Command.arg('import');
    importP12Command.pathArg(p12CertPath);
    importP12Command.arg(['-P', p12Pwd, '-A', '-t', 'cert', '-f', 'pkcs12', '-k']);
    importP12Command.pathArg(keychainPath);
    await importP12Command.exec();

    //list the keychain
    var listCommand : ToolRunner = tl.createToolRunner(tl.which('security', true));
    listCommand.arg(['list-keychain', '-d', 'user', '-s',  keychainPath]);
    await listCommand.exec();
}
開發者ID:PazSchori,項目名稱:vsts-tasks,代碼行數:32,代碼來源:ios-signing-common.ts

示例3: unlockKeychain

export async function unlockKeychain(keychainPath: string, keychainPwd: string) {
    //unlock the keychain
    var unlockCommand : ToolRunner = tl.createToolRunner(tl.which('security', true));
    unlockCommand.arg(['unlock-keychain', '-p', keychainPwd]);
    unlockCommand.pathArg(keychainPath);
    await unlockCommand.exec();
}
開發者ID:PazSchori,項目名稱:vsts-tasks,代碼行數:7,代碼來源:ios-signing-common.ts

示例4: getSonarQubeRunner

export function getSonarQubeRunner(mvnPath:string, mavenPOMFile: string, mavenOptions: string, execFileJacoco?: string): ToolRunner {
    if (!sqCommon.isSonarQubeAnalysisEnabled()) {
        return null;
    }

    var mvnsq: ToolRunner;
    var sqEndpoint: SonarQubeEndpoint = sqCommon.getSonarQubeEndpointFromInput("sqConnectedServiceName");

    if (tl.getBoolInput('sqDbDetailsRequired')) {
        var sqDbUrl = tl.getInput('sqDbUrl', false);
        var sqDbUsername = tl.getInput('sqDbUsername', false);
        var sqDbPassword = tl.getInput('sqDbPassword', false);
        mvnsq = createMavenSonarQubeRunner(mvnPath, sqEndpoint.Url, sqEndpoint.Username, sqEndpoint.Password, sqDbUrl, sqDbUsername, sqDbPassword);
    }
    else {
        mvnsq = createMavenSonarQubeRunner(mvnPath, sqEndpoint.Url, sqEndpoint.Username, sqEndpoint.Password);
    }

    // Apply argument for the JaCoCo tool, if enabled
    if (typeof execFileJacoco != "undefined" && execFileJacoco) {
        mvnsq.arg('-Dsonar.jacoco.reportPath=' + execFileJacoco);
    }

    mvnsq.arg('-f');
    mvnsq.pathArg(mavenPOMFile);
    mvnsq.argString(mavenOptions); // add the user options to allow further customization of the SQ run
    mvnsq = sqCommon.applySonarQubeIssuesModeInPrBuild(mvnsq); // in PR builds run SQ in issues mode
    mvnsq.arg("sonar:sonar");

    return mvnsq;
}
開發者ID:Jason1978-Z,項目名稱:vsts-tasks,代碼行數:31,代碼來源:mavensonar.ts

示例5: deleteKeychain

export async function deleteKeychain(keychainPath: string) {
    if (fs.existsSync(keychainPath)) {
        var deleteKeychainCommand : ToolRunner = tl.createToolRunner(tl.which('security', true));
        deleteKeychainCommand.arg('delete-keychain');
        deleteKeychainCommand.pathArg(keychainPath);
        await deleteKeychainCommand.exec();
    }
}
開發者ID:PazSchori,項目名稱:vsts-tasks,代碼行數:8,代碼來源:ios-signing-common.ts

示例6: deleteProvisioningProfile

export async function deleteProvisioningProfile(uuid: string) {
    var provProfilePath : string = getProvisioningProfilePath(uuid);
    tl.warning('Deleting provisioning profile: ' + provProfilePath);
    if(fs.existsSync(provProfilePath)) {
        tl.warning('Deleting provisioning profile: ' + provProfilePath);

        var deleteProfileCommand : ToolRunner = tl.createToolRunner(tl.which('rm', true));
        deleteProfileCommand.arg('-f');
        deleteProfileCommand.pathArg(provProfilePath);
        await deleteProfileCommand.exec();
    }
}
開發者ID:PazSchori,項目名稱:vsts-tasks,代碼行數:12,代碼來源:ios-signing-common.ts

示例7: findSigningIdentity

export async function findSigningIdentity(keychainPath: string) {
    var signIdentity : string;
    var findIdentityCmd : ToolRunner = tl.createToolRunner(tl.which('security', true));
    findIdentityCmd.arg(['find-identity', '-v', '-p', 'codesigning']);
    findIdentityCmd.pathArg(keychainPath);
    findIdentityCmd.on('stdout', function (data) {
        if (data) {
            var 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');
    }
}
開發者ID:PazSchori,項目名稱:vsts-tasks,代碼行數:24,代碼來源:ios-signing-common.ts

示例8: 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 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.createToolRunner(tool);
        xcv.arg('-version');
        await xcv.exec();

        // --- Xcode build arguments ---
        var xcb: ToolRunner = tl.createToolRunner(tool);
        xcb.argIf(sdk, ['-sdk', sdk]);
        xcb.argIf(configuration, ['-configuration', configuration]);
        if(ws && tl.filePathSupplied('xcWorkspacePath')) {
            xcb.arg('-workspace');
            xcb.pathArg(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.argString(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 = path.posix.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;

//.........這裏部分代碼省略.........
開發者ID:PazSchori,項目名稱:vsts-tasks,代碼行數:101,代碼來源:xcode.ts

示例9: installCertInTemporaryKeychain

export async function installCertInTemporaryKeychain(keychainPath : string, keychainPwd: string, p12CertPath : string, p12Pwd: string) {
    //delete keychain if exists
    await deleteKeychain(keychainPath);

    //create keychain
    var createKeychainCommand : ToolRunner =  tl.createToolRunner(tl.which('security', true));
    createKeychainCommand.arg(['create-keychain', '-p', keychainPwd]);
    createKeychainCommand.pathArg(keychainPath);
    await createKeychainCommand.exec();

    //update keychain settings
    var keychainSettingsCommand : ToolRunner = tl.createToolRunner(tl.which('security', true));
    keychainSettingsCommand.arg(['set-keychain-settings', '-lut', '7200']);
    keychainSettingsCommand.pathArg(keychainPath);
    await keychainSettingsCommand.exec();

    //unlock keychain
    await unlockKeychain(keychainPath, keychainPwd);

    //import p12 cert into the keychain
    var importP12Command : ToolRunner = tl.createToolRunner(tl.which('security', true));
    importP12Command.arg('import');
    importP12Command.pathArg(p12CertPath);
    importP12Command.arg(['-P', p12Pwd, '-A', '-t', 'cert', '-f', 'pkcs12', '-k']);
    importP12Command.pathArg(keychainPath);
    await importP12Command.exec();

    //list the keychains to get current keychains in search path
    var listAllOutput : string;
    var listAllCommand : ToolRunner = tl.createToolRunner(tl.which('security', true));
    listAllCommand.arg(['list-keychain', '-d', 'user']);
    listAllCommand.on('stdout', function(data) {
        if(data) {
            if(listAllOutput) {
                listAllOutput = listAllOutput.concat(data.toString().trim());
            } else {
                listAllOutput = data.toString().trim();
            }
        }
    })

    await listAllCommand.exec();

    var allKeychainsArr:string [] = [];
    tl.debug('listAllOutput = ' + listAllOutput);

    //parse out all the existing keychains in search path
    if(listAllOutput) {
        allKeychainsArr = listAllOutput.split(/[\n\r\f\v]/gm);
    }

    if(!listAllOutput || listAllOutput.indexOf('login.keychain') < 0) {
        //login keychain is not in the search path,
        //this might have happened with the 2.1.21 version of Xcode task
        //add it back explicitly, this can be removed after a couple of sprints
        allKeychainsArr.push(path.join(tl.getVariable('HOME'), 'Library', 'Keychains', 'login.keychain'));
    }

    //add the temporary keychain to list path along with existing keychains
    var listAddCommand : ToolRunner = tl.createToolRunner(tl.which('security', true));
    listAddCommand.arg(['list-keychain', '-d', 'user', '-s',  keychainPath]);
    for(var i : number = 0; i < allKeychainsArr.length; i ++) {
        listAddCommand.arg(allKeychainsArr[i].trim().replace(/"/gm, ''));
    }

    await listAddCommand.exec();

    var listVerifyOutput : string;
    var listVerifyCommand : ToolRunner = tl.createToolRunner(tl.which('security', true));
    listVerifyCommand.arg(['list-keychain', '-d', 'user']);
    listVerifyCommand.on('stdout', function(data) {
        if(data) {
            if(listVerifyOutput) {
                listVerifyOutput = listVerifyOutput.concat(data.toString().trim());
            } else {
                listVerifyOutput = data.toString().trim();
            }
        }
    })

    await listVerifyCommand.exec();

    if(listVerifyOutput.indexOf(keychainPath) < 0) {
        throw tl.loc('TempKeychainSetupFailed');
    }

}
開發者ID:embix,項目名稱:vsts-tasks,代碼行數:87,代碼來源:ios-signing-common.ts


注:本文中的vsts-task-lib/toolrunner.ToolRunner.pathArg方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。