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

TypeScript task.findMatch函数代码示例

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

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



在下文中一共展示了findMatch函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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:grawcho,项目名称:vso-agent-tasks,代码行数:35,代码来源:androidsigning.ts


示例2: publishTestResults

function publishTestResults(publishJUnitResults, testResultsFiles: string) {
    if (publishJUnitResults == 'true') {
        //check for pattern in testResultsFiles
        let matchingTestResultsFiles;
        if (testResultsFiles.indexOf('*') >= 0 || testResultsFiles.indexOf('?') >= 0) {
            tl.debug('Pattern found in testResultsFiles parameter');
            const buildFolder = tl.getVariable('System.DefaultWorkingDirectory');
            matchingTestResultsFiles = tl.findMatch(buildFolder, testResultsFiles, null, { matchBase: true });
        }
        else {
            tl.debug('No pattern found in testResultsFiles parameter');
            matchingTestResultsFiles = [testResultsFiles];
        }

        if (!matchingTestResultsFiles || matchingTestResultsFiles.length === 0) {
            tl.warning('No test result files matching ' + testResultsFiles + ' were found, so publishing JUnit test results is being skipped.');
            return 0;
        }

        let tp = new tl.TestPublisher("JUnit");
        const testRunTitle = tl.getInput('testRunTitle');

        tp.publish(matchingTestResultsFiles, true, "", "", testRunTitle, true, TESTRUN_SYSTEM);
    }
}
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:25,代码来源:anttask.ts


示例3: getManifestFiles

export function getManifestFiles(manifestFilesPath: string): string[] {
    if (!manifestFilesPath || manifestFilesPath.trim().length == 0) {
        tl.debug("file input is not present");
        return null;
    }

    var files = tl.findMatch(tl.getVariable("System.DefaultWorkingDirectory") || process.cwd(), manifestFilesPath.trim());
    return files;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:9,代码来源:utilities.ts


示例4: getToolsInstallerConfiguration

function getToolsInstallerConfiguration(): models.ToolsInstallerConfiguration {
    const toolsInstallerConfiguration = {} as models.ToolsInstallerConfiguration;

    tl.debug("Path to VsTest from tools installer: " + tl.getVariable(constants.VsTestToolsInstaller.PathToVsTestToolVariable));
    toolsInstallerConfiguration.vsTestPackageLocation = tl.getVariable(constants.VsTestToolsInstaller.PathToVsTestToolVariable);

    // get path to vstest.console.exe
    var matches = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\vstest.console.exe");
    if (matches && matches.length !== 0) {
        toolsInstallerConfiguration.vsTestConsolePathFromPackageLocation = matches[0];
    } else {
        utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('toolsInstallerPathNotSet'), 1041, false);
        throw new Error(tl.loc('toolsInstallerPathNotSet'));
    }

    // get path to Microsoft.IntelliTrace.ProfilerProxy.dll (amd64)
    var amd64ProfilerProxy = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\amd64\\Microsoft.IntelliTrace.ProfilerProxy.dll");
    if (amd64ProfilerProxy && amd64ProfilerProxy.length !== 0) {
        toolsInstallerConfiguration.x64ProfilerProxyDLLLocation = amd64ProfilerProxy[0];
    } else {
        // Look in x64 also for Microsoft.IntelliTrace.ProfilerProxy.dll (x64)
        amd64ProfilerProxy = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\x64\\Microsoft.IntelliTrace.ProfilerProxy.dll");
        if (amd64ProfilerProxy && amd64ProfilerProxy.length !== 0) {
            toolsInstallerConfiguration.x64ProfilerProxyDLLLocation = amd64ProfilerProxy[0];
        } else {
            utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1043, false);
            tl.warning(tl.loc('testImpactAndCCWontWork'));
        }

        utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1042, false);
        tl.warning(tl.loc('testImpactAndCCWontWork'));
    }

    // get path to Microsoft.IntelliTrace.ProfilerProxy.dll (x86)
    var x86ProfilerProxy = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\x86\\Microsoft.IntelliTrace.ProfilerProxy.dll");
    if (x86ProfilerProxy && x86ProfilerProxy.length !== 0) {
        toolsInstallerConfiguration.x86ProfilerProxyDLLLocation = x86ProfilerProxy[0];
    } else {
        utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1044, false);
        tl.warning(tl.loc('testImpactAndCCWontWork'));
    }

    return toolsInstallerConfiguration;
}
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:44,代码来源:taskinputparser.ts


示例5: 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:bleissem,项目名称:vsts-tasks,代码行数:12,代码来源:utility.ts


示例6: 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:grawcho,项目名称:vso-agent-tasks,代码行数:15,代码来源:androidsigning.ts


示例7: run

async function run() {
    try {
        tl.debug("Starting Tokenizer task");

        // get the task vars
        var sourcePath = tl.getPathInput("sourcePath");
        if (!sourcePath || sourcePath.length === 0) {
            sourcePath = tl.getVariable("Build.SourcesDirectory");
        }
        // clear leading and trailing quotes for paths with spaces
        sourcePath = sourcePath.replace(/"/g, "");

        // remove trailing slash
        if (sourcePath.endsWith("\\") || sourcePath.endsWith("/")) {
            tl.debug("Trimming separator off sourcePath");
            sourcePath = sourcePath.substr(0, sourcePath.length - 1);
        }

        tl.checkPath(sourcePath, "sourcePath");

        let filePattern = tl.getInput("filePattern", true);
        let tokenizeType = tl.getInput("tokenizeType", true);
        let includes = tl.getInput("includes", false);
        let excludes = tl.getInput("excludes", false);
        if (!includes) {
            includes = '';
        }
        if (!excludes) {
            excludes = '';
        }

        tl.debug(`sourcePath: [${sourcePath}]`);
        tl.debug(`filePattern: [${filePattern}]`);
        tl.debug(`tokenizeType: [${tokenizeType}]`);
        tl.debug(`includes: [${includes}]`);
        tl.debug(`excludes: [${excludes}]`);

        // only one or the other can be specified
        if (includes && includes.length > 0 && excludes && excludes.length > 0) {
            throw `You cannot specify includes and excludes - please specify one or the other`;
        }

        if (!filePattern || filePattern.length === 0) {
            filePattern = "*.*";
        }
        tl.debug(`Using [${filePattern}] as filePattern`);

        // create a glob removing any spurious quotes
        if (os.platform() !== "win32") {
            // replace \ with /
            filePattern = filePattern.replace(/\\/g, "/");
        }

        // get the files
        let files = tl.findMatch(sourcePath, filePattern);
        if (!files || files.length === 0) {
            let msg = `Could not find files with glob [${filePattern}].`;
            if (os.platform() !== "win32") {
                tl.warning("No files found for pattern. Non-windows file systems are case sensitvive, so check the case of your path and file patterns.");
            }
            tl.setResult(tl.TaskResult.Failed, msg);
        }

        // comma-split the include and excludes
        let includeSet: Set<string>, excludeSet: Set<string>;
        if (includes && includes.length > 0) {
            includeSet = new Set(includes.split(','));
            tl.debug(`Includeset has ${includeSet.size} elements`);
        }
        if (excludes && excludes.length > 0) {
            excludeSet = new Set(excludes.split(','));
            tl.debug(`Excludeset has ${excludeSet.size} elements`);
        }

        for (var i = 0; i < files.length; i++) {
            let file = files[i];
            console.info(`Starting tokenization in [${file}]`);

            let contents = fs.readFileSync(file).toString();
            // remove BOM if present
            contents = contents.replace(String.fromCharCode(65279), '');
            let json = JSON.parse(contents);

            // find the include properties recursively
            replaceProps(json, '', includeSet, excludeSet);

            tl.debug("Writing new values to file...");
            // make the file writable
            sh.chmod(666, file);
            fs.writeFileSync(file, JSON.stringify(json, null, 2));
        }

    }
    catch (err) {
        let msg = err;
        if (err.message) {
            msg = err.message;
        }
        tl.setResult(tl.TaskResult.Failed, msg);
    }
//.........这里部分代码省略.........
开发者ID:xiangyan99,项目名称:cols-agent-tasks,代码行数:101,代码来源:tokenizer.ts


示例8: run

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

        //read inputs
        const project: string | null = tl.getPathInput('project', true);
        const target: string | null = tl.getInput('target');
        const outputDir: string | null = tl.getInput('outputDir');
        const configuration: string | null = tl.getInput('configuration');
        const createAppPackage: boolean | null = tl.getBoolInput('createAppPackage');
        const clean: boolean | null = tl.getBoolInput('clean');
        const msbuildArguments: string| null = tl.getInput('msbuildArguments');

        // find jdk to be used during the build
        const jdkSelection: string = tl.getInput('jdkSelection') || 'JDKVersion'; // fall back to JDKVersion for older version of tasks

        let specifiedJavaHome: string | null | undefined = null;
        let javaTelemetryData: { jdkVersion: string } | null = null;

        if (jdkSelection === 'JDKVersion') {
            tl.debug('Using JDK version to find JDK path');
            const jdkVersion: string | null = tl.getInput('jdkVersion');
            const jdkArchitecture: string | null = tl.getInput('jdkArchitecture');
            javaTelemetryData = { jdkVersion };

            if (jdkVersion !== 'default') {
                specifiedJavaHome = javacommons.findJavaHome(jdkVersion, jdkArchitecture);
            }
        } else {
            tl.debug('Using path from user input to find JDK');
            specifiedJavaHome = tl.getPathInput('jdkUserInputPath', true, true);
            javaTelemetryData = { jdkVersion: "custom" };
        }
        javacommons.publishJavaTelemetry('XamarinAndroid', javaTelemetryData);

        //find build tool path to use
        let buildToolPath: string | undefined;

        const buildLocationMethod: string = tl.getInput('msbuildLocationMethod') || 'version';

        const buildToolLocation: string | null = tl.getPathInput('msbuildLocation');
        if (buildToolLocation) {
            // msbuildLocation was specified, use it for back compat
            if (buildToolLocation.endsWith('xbuild') || buildToolLocation.endsWith('msbuild')) {
                buildToolPath = buildToolLocation;
            } else {
                // use xbuild for back compat if tool folder path is specified
                buildToolPath = path.join(buildToolLocation, 'xbuild');
            }
            tl.checkPath(buildToolPath, 'build tool');
        } else if (buildLocationMethod === 'version') {
            // msbuildLocation was not specified, look up by version
            const msbuildVersion: string = tl.getInput('msbuildVersion');
            buildToolPath = await msbuildHelpers.getMSBuildPath(msbuildVersion);
        }

        if (!buildToolPath) {
            throw tl.loc('MSB_BuildToolNotFound');
        }
        tl.debug('Build tool path = ' + buildToolPath);

        // Resolve files for the specified value or pattern
        const filesList: string[] = tl.findMatch('', project, { followSymbolicLinks: false, followSpecifiedSymbolicLink: false });

        // Fail if no matching .csproj files were found
        if (!filesList || filesList.length === 0) {
            throw tl.loc('NoMatchingProjects', project);
        }

        for (const file of filesList) {
            try {
                // run the build for each matching project
                const buildRunner: ToolRunner = tl.tool(buildToolPath);
                buildRunner.arg(file);
                buildRunner.argIf(clean, '/t:Clean');
                buildRunner.argIf(target, '/t:' + target);
                buildRunner.argIf(createAppPackage, '/t:PackageForAndroid');
                if (msbuildArguments) {
                    buildRunner.line(msbuildArguments);
                }
                buildRunner.argIf(outputDir, '/p:OutputPath=' + outputDir);
                buildRunner.argIf(configuration, '/p:Configuration=' + configuration);
                buildRunner.argIf(specifiedJavaHome, '/p:JavaSdkDirectory=' + specifiedJavaHome);

                await buildRunner.exec();
            } catch (err) {
                throw tl.loc('XamarinAndroidBuildFailed', err);
            }
            tl.setResult(tl.TaskResult.Succeeded, tl.loc('XamarinAndroidSucceeded'));
        }
    } catch (err) {
        tl.setResult(tl.TaskResult.Failed, err);
    }
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:94,代码来源:xamarinandroid.ts


示例9: isNullOrWhitespace

const publishRunAttachments = tl.getInput('publishRunAttachments');
let searchFolder = tl.getInput('searchFolder');

tl.debug('testRunner: ' + testRunner);
tl.debug('testResultsFiles: ' + testResultsFiles);
tl.debug('mergeResults: ' + mergeResults);
tl.debug('platform: ' + platform);
tl.debug('config: ' + config);
tl.debug('testRunTitle: ' + testRunTitle);
tl.debug('publishRunAttachments: ' + publishRunAttachments);

if (isNullOrWhitespace(searchFolder)) {
    searchFolder = tl.getVariable('System.DefaultWorkingDirectory');
}

let matchingTestResultsFiles: string[] = tl.findMatch(searchFolder, testResultsFiles);
if (!matchingTestResultsFiles || matchingTestResultsFiles.length === 0) {
    tl.warning('No test result files matching ' + testResultsFiles + ' were found.');
} else {
    let tp: tl.TestPublisher = new tl.TestPublisher(testRunner);
    tp.publish(matchingTestResultsFiles, mergeResults, platform, config, testRunTitle, publishRunAttachments);
}

tl.setResult(tl.TaskResult.Succeeded, '');

function isNullOrWhitespace(input: any) {
    if (typeof input === 'undefined' || input === null) {
        return true;
    }
    return input.replace(/\s/g, '').length < 1;
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:31,代码来源:publishtestresults.ts


示例10: 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 = auth.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:shubham90,项目名称:vsts-tasks,代码行数:101,代码来源:nugetpublisher.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript task.getBoolInput函数代码示例发布时间:2022-05-25
下一篇:
TypeScript task.find函数代码示例发布时间: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