当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript task.findMatch函数代码示例

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


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

示例1: run

async function run() {
    try {
        // Configure localization
        tl.setResourcePath(path.join(__dirname, 'task.json'));

        // Get files to be signed
        const filesPattern: string = tl.getInput('files', true);

        // Signing the APK?
        const apksign: boolean = tl.getBoolInput('apksign');

        // Zipaligning the APK?
        const zipalign: boolean = tl.getBoolInput('zipalign');

        // Resolve files for the specified value or pattern
        const filesToSign: string[] = tl.findMatch(null, filesPattern);

        // Fail if no matching files were found
        if (!filesToSign || filesToSign.length === 0) {
            throw new Error(tl.loc('NoMatchingFiles', filesPattern));
        }

        for (const file of filesToSign) {
            if (zipalign) {
                await zipaligning(file);
            }

            if (apksign) {
                await apksigning(file);
            }
        }
    } catch (err) {
        tl.setResult(tl.TaskResult.Failed, err);
    }
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:35,代码来源:androidsigning.ts

示例2: getProjectFiles

export function getProjectFiles(projectPattern: string[]): string[] {
    if (projectPattern.length == 0) {
        return [""];
    }
    var projectFiles: string[] = tl.findMatch(tl.getVariable("System.DefaultWorkingDirectory") || process.cwd(), projectPattern);

    if (!projectFiles || !projectFiles.length) {
        return [];
    }

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

示例3: Error

const findAndroidTool = (tool: string): string => {
    const androidHome = tl.getVariable('ANDROID_HOME');
    if (!androidHome) {
        throw new Error(tl.loc('AndroidHomeNotSet'));
    }

    // add * in search as on Windows the tool may end with ".exe" or ".bat"
    const toolsList = tl.findMatch(tl.resolve(androidHome, 'build-tools'), tool + '*', null, { matchBase: true });

    if (!toolsList || toolsList.length === 0) {
        throw new Error(tl.loc('CouldNotFindToolInAndroidHome', tool, androidHome));
    }

    return toolsList[0];
};
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:15,代码来源:androidsigning.ts

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

示例5:

var zipaligning = (fn: string) => {
    // file must exist
    tl.checkPath(fn, 'file to zipalign');

    var zipaligner = tl.getInput('zipalignLocation', false);

    // if the tool path is not set, let's find one (anyone) from the SDK folder
    if (!zipaligner) {

        var android_home = tl.getVariable('ANDROID_HOME');
        if (!android_home) {
            throw tl.loc('AndroidHomeNotSet');
        }

        var zipalignToolsList = tl.findMatch(tl.resolve(android_home, 'build-tools'), "zipalign*", null, { matchBase: true });

        if (!zipalignToolsList || zipalignToolsList.length === 0) {
            throw tl.loc('CouldNotFindZipalignInAndroidHome', android_home);
        }

        zipaligner = zipalignToolsList[0];
    }

    if (!zipaligner) {
        throw tl.loc('CouldNotFindZipalign');
    }

    var zipalignRunner = tl.tool(zipaligner);

    // alignment must be 4 or play store will reject, hard code this to avoid user errors
    zipalignRunner.arg(["-v", "4"]);

    var unalignedFn = fn + ".unaligned";
    var success = tl.mv(fn, unalignedFn, '-f', false);

    zipalignRunner.arg([unalignedFn, fn]);
    return zipalignRunner.exec(null);
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:38,代码来源:androidsigning.ts

示例6: if

void common.runTfx(async tfx => {
    let cleanupTfxArgs: () => void;

    try {
        tfx.arg(["extension", "publish", "--json", "--no-color"]);
        const outputVariable = tl.getInput("outputVariable", false);

        common.setTfxMarketplaceArguments(tfx);

        // Read file type
        const fileType = tl.getInput("fileType", true);
        let vsixOutput;

        if (fileType === "manifest") {
            // Set tfx manifest arguments
            cleanupTfxArgs = common.validateAndSetTfxManifestArguments(tfx);

            // Update tasks version if needed
            await common.checkUpdateTasksManifests();
        } else {
            // Set vsix file argument
            let vsixFilePattern = tl.getPathInput("vsixFile", true);
            let matchingVsixFile: string[];
            if (vsixFilePattern.indexOf("*") >= 0 || vsixFilePattern.indexOf("?") >= 0) {
                tl.debug("Pattern found in vsixFile parameter");
                matchingVsixFile = tl.findMatch(tl.getInput("cwd", false) || process.cwd(), vsixFilePattern);
            }
            else {
                tl.debug("No pattern found in vsixFile parameter");
                matchingVsixFile = [vsixFilePattern];
            }

            if (!matchingVsixFile || matchingVsixFile.length === 0) {
                tl.setResult(tl.TaskResult.Failed, `Found no vsix files matching: ${vsixFilePattern}.`);
                return false;
            }
            if (matchingVsixFile.length !== 1) {
                tl.setResult(tl.TaskResult.Failed, `Found multiple vsix files matching: ${vsixFilePattern}.`);
                return false;
            }

            const vsixFile = matchingVsixFile[0];
            tl.checkPath(vsixFile, "vsixPath");

            vsixOutput = tl.getVariable("System.DefaultWorkingDirectory");

            const publisher = tl.getInput("publisherId", false);

            const extensionId = tl.getInput("extensionId", false);
            const extensionTag = tl.getInput("extensionTag", false);

            const extensionName = tl.getInput("extensionName", false);
            const extensionVisibility = tl.getInput("extensionVisibility", false) || "";
            const extensionPricing = tl.getInput("extensionPricing", false);
            const extensionVersion = common.getExtensionVersion();
            const updateTasksId = tl.getBoolInput("updateTasksId", false);
            const updateTasksVersion = tl.getBoolInput("updateTasksVersion", false);

            if (publisher
                || extensionId
                || extensionTag
                || extensionName
                || (extensionPricing && extensionPricing !== "default")
                || (extensionVisibility && extensionVisibility !== "default")
                || extensionVersion
                || updateTasksId ) {

                tl.debug("Start editing of VSIX");
                const ve = new vsixeditor.VSIXEditor(vsixFile, vsixOutput);
                ve.startEdit();

                if (publisher) { ve.editPublisher(publisher); }
                if (extensionId) { ve.editId(extensionId); }
                if (extensionTag) { ve.editIdTag(extensionTag); }
                if (extensionName) { ve.editExtensionName(extensionName); }
                if (extensionVisibility) { ve.editExtensionVisibility(extensionVisibility); }
                if (extensionPricing) { ve.editExtensionPricing(extensionPricing); }
                if (extensionVersion) {
                    ve.editVersion(extensionVersion);
                    ve.editUpdateTasksVersion(updateTasksVersion);
                }
                if (updateTasksId) {
                    ve.editUpdateTasksId(updateTasksId);
                }

                const vsixGeneratedFile = await ve.endEdit();
                tfx.arg(["--vsix", vsixGeneratedFile]);
                vsixOutput = vsixGeneratedFile;
            }
            else {
                vsixOutput = vsixFile;
                tfx.arg(["--vsix", vsixOutput]);
            }
        } 

        // Share with
        const shareWith = tl.getDelimitedInput("shareWith", ",", false).map((value) => { return value.trim(); });
        const extensionVisibility = tl.getInput("extensionVisibility", false) || "";
        const connectTo = tl.getInput("connectTo", true);
        if (shareWith) {
//.........这里部分代码省略.........
开发者ID:Microsoft,项目名称:vsts-extension-build-release-tasks,代码行数:101,代码来源:PublishExtension.ts

示例7: run

export async function run(nuGetPath: string): Promise<void> {
    let packagingLocation: pkgLocationUtils.PackagingLocation;
    try {
        packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet);
    } catch (error) {
        tl.debug("Unable to get packaging URIs, using default collection URI");
        tl.debug(JSON.stringify(error));
        const collectionUrl = tl.getVariable("System.TeamFoundationCollectionUri");
        packagingLocation = {
            PackagingUris: [collectionUrl],
            DefaultPackagingUri: collectionUrl};
    }

    const buildIdentityDisplayName: string = null;
    const buildIdentityAccount: string = null;
    try {
        nutil.setConsoleCodePage();

        // Get list of files to pusblish
        const searchPatternInput = tl.getPathInput("searchPatternPush", true, false);

        const useLegacyFind: boolean = tl.getVariable("NuGet.UseLegacyFindFiles") === "true";
        let filesList: string[] = [];
        if (!useLegacyFind) {
            const findOptions: tl.FindOptions = {} as tl.FindOptions;
            const matchOptions: tl.MatchOptions = {} as tl.MatchOptions;
            const searchPatterns: string[] = nutil.getPatternsArrayFromInput(searchPatternInput);
            filesList = tl.findMatch(undefined, searchPatterns, findOptions, matchOptions);
        }
        else {
            filesList = nutil.resolveFilterSpec(searchPatternInput);
        }

        filesList.forEach((packageFile) => {
            if (!tl.stats(packageFile).isFile()) {
                throw new Error(tl.loc("Error_PushNotARegularFile", packageFile));
            }
        });

        if (filesList && filesList.length < 1)
        {
            tl.warning(tl.loc("Info_NoPackagesMatchedTheSearchPattern"));
            return;
        }

        // Get the info the type of feed
        let nugetFeedType = tl.getInput("nuGetFeedType") || "internal";
        // Make sure the feed type is an expected one
        const normalizedNuGetFeedType = ["internal", "external"]
            .find((x) => nugetFeedType.toUpperCase() === x.toUpperCase());
        if (!normalizedNuGetFeedType) {
            throw new Error(tl.loc("UnknownFeedType", nugetFeedType));
        }
        nugetFeedType = normalizedNuGetFeedType;

        let urlPrefixes = packagingLocation.PackagingUris;
        tl.debug(`discovered URL prefixes: ${urlPrefixes}`);

        // Note to readers: This variable will be going away once we have a fix for the location service for
        // customers behind proxies
        const testPrefixes = tl.getVariable("NuGetTasks.ExtraUrlPrefixesForTesting");
        if (testPrefixes) {
            urlPrefixes = urlPrefixes.concat(testPrefixes.split(";"));
            tl.debug(`all URL prefixes: ${urlPrefixes}`);
        }

        // Setting up auth info
        const accessToken = pkgLocationUtils.getSystemAccessToken();
        const quirks = await ngToolRunner.getNuGetQuirksAsync(nuGetPath);

        // Clauses ordered in this way to avoid short-circuit evaluation, so the debug info printed by the functions
        // is unconditionally displayed
        const useV1CredProvider: boolean = ngToolRunner.isCredentialProviderEnabled(quirks);
        const useV2CredProvider: boolean = ngToolRunner.isCredentialProviderV2Enabled(quirks);
        const credProviderPath: string = nutil.locateCredentialProvider(useV2CredProvider);
        const useCredConfig = ngToolRunner.isCredentialConfigEnabled(quirks)
                                && (!useV1CredProvider && !useV2CredProvider);

        const internalAuthInfo = new auth.InternalAuthInfo(
            urlPrefixes,
            accessToken,
            ((useV1CredProvider || useV2CredProvider) ? credProviderPath : null),
            useCredConfig);

        const environmentSettings: ngToolRunner.NuGetEnvironmentSettings = {
            credProviderFolder: useV2CredProvider === false ? credProviderPath : null,
            V2CredProviderPath: useV2CredProvider === true ? credProviderPath : null,
            extensionsDisabled: true,
        };

        let configFile = null;
        let apiKey: string;
        let credCleanup = () => { return; };

        let feedUri: string;
        const isInternalFeed: boolean = nugetFeedType === "internal";

        let authInfo: auth.NuGetExtendedAuthInfo;
        let nuGetConfigHelper: NuGetConfigHelper2;

//.........这里部分代码省略.........
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:101,代码来源:nugetpublisher.ts


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