• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

TypeScript toolrunner.ToolRunner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中azure-pipelines-task-lib/toolrunner.ToolRunner的典型用法代码示例。如果您正苦于以下问题:TypeScript ToolRunner类的具体用法?TypeScript ToolRunner怎么用?TypeScript ToolRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ToolRunner类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: getWorkspaceSchemes

export async function getWorkspaceSchemes(xcbuild: string, workspace: string) : Promise<string[]> {
    let xcv: ToolRunner = tl.tool(xcbuild);
    xcv.arg(['-workspace', workspace]);
    xcv.arg('-list');

    let schemes: string[] = [];
    let inSchemesSection = false;

    let output = '';
    xcv.on('stdout', (data) => {
        output = output + data.toString();
    });
    await xcv.exec();

    output.split('\n').forEach((line: string) => {
        tl.debug(`Line: ${line}`);

        line = line.trim();

        if (inSchemesSection) {
            if (line !== '') {
                tl.debug(`Scheme: ${line}`);
                schemes.push(line);
            }
            else {
                inSchemesSection = false;
            }
        }
        else if (line === 'Schemes:') {
            inSchemesSection = true;
        }
    });

    return schemes;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:35,代码来源:xcodeutils.ts


示例2: 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


示例3: acquireTfx

async function acquireTfx(version: string): Promise<string> {
    try{
        version = toolLib.cleanVersion(version);
        
        let extPath: string;
        taskLib.assertAgent('2.115.0');
        extPath = taskLib.getVariable('Agent.TempDirectory');
        if (!extPath) {
            throw new Error('Expected Agent.TempDirectory to be set');
        }
        extPath = path.join(extPath, 'tfx'); // use as short a path as possible due to nested node_modules folders

        taskLib.mkdirP(path.join(extPath));
        const npmRunner = new tr.ToolRunner("npm");
        npmRunner.arg(["install", "tfx-cli@" + version, "--prefix", extPath]);

        const result = npmRunner.execSync({ failOnStdErr: false, silent: true, ignoreReturnCode: false} as tr.IExecOptions);
        if (result.code === 0)
        {
            if (os.platform() === "win32")
            {
                fs.unlinkSync(path.join(extPath, "/tfx"));
            }
            return await toolLib.cacheDir(extPath, 'tfx', version);
        }
    }
    catch {
        return Promise.reject(new Error("Failed to install tfx"));
    }
}
开发者ID:Microsoft,项目名称:vsts-extension-build-release-tasks,代码行数:30,代码来源:TfxInstaller.ts


示例4: 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


示例5: queryLatestMatch

function queryLatestMatch(versionSpec: string): string {
    const npmRunner = new tr.ToolRunner("npm");
    npmRunner.arg(["show", "tfx-cli", "versions", "--json"]);
    const result = npmRunner.execSync({ failOnStdErr: false, silent: true, ignoreReturnCode: false} as tr.IExecOptions);
    if (result.code === 0)
    {
        let versions: string[] = JSON.parse(result.stdout.trim());
        let version: string = toolLib.evaluateVersions(versions, versionSpec);
        return version;
    }
    return "";
}
开发者ID:Microsoft,项目名称:vsts-extension-build-release-tasks,代码行数:12,代码来源:TfxInstaller.ts


示例6: deleteProvisioningProfile

export async function deleteProvisioningProfile(uuid: string): Promise<void> {
    if (uuid && uuid.trim()) {
        const provProfiles: string[] = tl.findMatch(getUserProvisioningProfilesPath(), uuid.trim() + '*');
        if (provProfiles) {
            for (const provProfilePath of provProfiles) {
                console.log('Deleting provisioning profile: ' + provProfilePath);
                if (tl.exist(provProfilePath)) {
                    const deleteProfileCommand: ToolRunner = tl.tool(tl.which('rm', true));
                    deleteProfileCommand.arg(['-f', provProfilePath]);
                    await deleteProfileCommand.exec();
                }
            }
        }
    }
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:15,代码来源:ios-signing-common.ts


示例7: 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;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:21,代码来源:ios-signing-common.ts


示例8: 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


示例9: 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'));
            }
        }
    }
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:41,代码来源:ios-signing-common.ts


示例10: 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');
    }
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:23,代码来源:ios-signing-common.ts



注:本文中的azure-pipelines-task-lib/toolrunner.ToolRunner类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript tool.downloadTool函数代码示例发布时间:2022-05-25
下一篇:
TypeScript task.writeFile函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap