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


TypeScript task.warning函数代码示例

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


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

示例1: getDistributedTestConfigurations

export function getDistributedTestConfigurations(): models.DtaTestConfigurations {
    tl.setResourcePath(path.join(__dirname, 'task.json'));
    const dtaConfiguration = {} as models.DtaTestConfigurations;
    initTestConfigurations(dtaConfiguration);

    if (dtaConfiguration.vsTestLocationMethod === utils.Constants.vsTestVersionString && dtaConfiguration.vsTestVersion === '12.0') {
        throw (tl.loc('vs2013NotSupportedInDta'));
    }

    if (dtaConfiguration.tiaConfig.tiaEnabled) {
        tl.warning(tl.loc('tiaNotSupportedInDta'));
        dtaConfiguration.tiaConfig.tiaEnabled = false;
    }
    if (dtaConfiguration.runTestsInIsolation) {
        tl.warning(tl.loc('runTestInIsolationNotSupported'));
    }
    if (dtaConfiguration.otherConsoleOptions) {
        tl.warning(tl.loc('otherConsoleOptionsNotSupported'));
    }

    dtaConfiguration.numberOfAgentsInPhase = 0;
    const totalJobsInPhase = parseInt(tl.getVariable('SYSTEM_TOTALJOBSINPHASE'));
    if (!isNaN(totalJobsInPhase)) {
        dtaConfiguration.numberOfAgentsInPhase = totalJobsInPhase;
    }

    dtaConfiguration.onDemandTestRunId = tl.getInput('tcmTestRun');

    dtaConfiguration.dtaEnvironment = initDtaEnvironment();

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

示例2: getDistributedTestConfigurations

export function getDistributedTestConfigurations() {
    const dtaConfiguration = {} as models.DtaTestConfigurations;
    initTestConfigurations(dtaConfiguration);

    if (dtaConfiguration.vsTestLocationMethod === utils.Constants.vsTestVersionString && dtaConfiguration.vsTestVersion === '12.0') {
        throw (tl.loc('vs2013NotSupportedInDta'));
    }

    if (dtaConfiguration.tiaConfig.tiaEnabled) {
        tl.warning(tl.loc('tiaNotSupportedInDta'));
        dtaConfiguration.tiaConfig.tiaEnabled = false;
    }
    if (dtaConfiguration.runTestsInIsolation) {
        tl.warning(tl.loc('runTestInIsolationNotSupported'));
    }
    if (dtaConfiguration.otherConsoleOptions) {
        tl.warning(tl.loc('otherConsoleOptionsNotSupported'));
    }

    dtaConfiguration.numberOfAgentsInPhase = 0;
    const totalJobsInPhase = parseInt(tl.getVariable('SYSTEM_TOTALJOBSINPHASE'));
    if (!isNaN(totalJobsInPhase)) {
        dtaConfiguration.numberOfAgentsInPhase = totalJobsInPhase;
    }
    tl._writeLine(tl.loc('dtaNumberOfAgents', dtaConfiguration.numberOfAgentsInPhase));

    dtaConfiguration.dtaEnvironment = initDtaEnvironment();
    return dtaConfiguration;
}
开发者ID:colindembovsky,项目名称:vsts-tasks,代码行数:29,代码来源:taskinputparser.ts

示例3: getSourceTags

export function getSourceTags(): string[] {
    var tags: string[];

    var sourceProvider = tl.getVariable("Build.Repository.Provider");
    if (!sourceProvider) {
        tl.warning("Cannot retrieve source tags because Build.Repository.Provider is not set.");
        return [];
    }
    if (sourceProvider === "TfsVersionControl") {
        // TFVC has no concept of source tags
        return [];
    }

    var sourceVersion = tl.getVariable("Build.SourceVersion");
    if (!sourceVersion) {
        tl.warning("Cannot retrieve source tags because Build.SourceVersion is not set.");
        return [];
    }

    switch (sourceProvider) {
        case "TfsGit":
        case "GitHub":
        case "Git":
            tags = gitUtils.tagsAt(sourceVersion);
            break;
        case "Subversion":
            // TODO: support subversion tags
            tl.warning("Retrieving Subversion tags is not currently supported.");
            break;
    }

    return tags || [];
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:33,代码来源:sourceutils.ts

示例4: shouldUseVstsNuGetPush

function shouldUseVstsNuGetPush(isInternalFeed: boolean, conflictsAllowed: boolean, nugetExePath: string): boolean {
    if (tl.osType() !== "Windows_NT"){
        tl.debug("Running on a non-windows platform so NuGet.exe will be used.");
        if(conflictsAllowed){
            tl.warning(tl.loc("Warning_SkipConflictsNotSupportedUnixAgents"));
        }
        return false;
    }

    if (!isInternalFeed)
    {
        tl.debug("Pushing to an external feed so NuGet.exe will be used.");
        return false;
    }

    if (commandHelper.isOnPremisesTfs())
    {
        tl.debug("Pushing to an onPrem environment, only NuGet.exe is supported.");
        if(conflictsAllowed){
            tl.warning(tl.loc("Warning_AllowDuplicatesOnlyAvailableHosted"));
        }
        return false;
    }

    const nugetOverrideFlag = tl.getVariable("NuGet.ForceNuGetForPush");
    if (nugetOverrideFlag === "true") {
        tl.debug("NuGet.exe is force enabled for publish.");
        if(conflictsAllowed)
        {
            tl.warning(tl.loc("Warning_ForceNuGetCannotSkipConflicts"));
        }
        return false;
    }

    if (nugetOverrideFlag === "false") {
        tl.debug("NuGet.exe is force disabled for publish.");
        return true;
    }

    const vstsNuGetPushOverrideFlag = tl.getVariable("NuGet.ForceVstsNuGetPushForPush");
    if (vstsNuGetPushOverrideFlag === "true") {
        tl.debug("VstsNuGetPush.exe is force enabled for publish.");
        return true;
    }

    if (vstsNuGetPushOverrideFlag === "false") {
        tl.debug("VstsNuGetPush.exe is force disabled for publish.");
        if(conflictsAllowed)
        {
            tl.warning(tl.loc("Warning_ForceNuGetCannotSkipConflicts"));
        }
        return false;
    }

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

示例5: getVsTestRunnerDetails

export function getVsTestRunnerDetails(testConfig: models.TestConfigurations) {
    const vstestexeLocation = locateVSTestConsole(testConfig);
    const vstestLocationEscaped = vstestexeLocation.replace(/\\/g, '\\\\');
    const wmicTool = tl.tool('wmic');
    const wmicArgs = ['datafile', 'where', 'name=\''.concat(vstestLocationEscaped, '\''), 'get', 'Version', '/Value'];
    wmicTool.arg(wmicArgs);
    let output = wmicTool.execSync({ silent: true } as tr.IExecSyncOptions).stdout;

    if (utils.Helper.isNullOrWhitespace(output)) {
        tl.error(tl.loc('ErrorReadingVstestVersion'));
        throw new Error(tl.loc('ErrorReadingVstestVersion'));
    }
    output = output.trim();
    tl.debug('VSTest Version information: ' + output);
    const verSplitArray = output.split('=');
    if (verSplitArray.length !== 2) {
        tl.error(tl.loc('ErrorReadingVstestVersion'));
        throw new Error(tl.loc('ErrorReadingVstestVersion'));
    }

    const versionArray = verSplitArray[1].split('.');
    if (versionArray.length !== 4) {
        tl.warning(tl.loc('UnexpectedVersionString', output));
        throw new Error(tl.loc('UnexpectedVersionString', output));
    }

    const majorVersion = parseInt(versionArray[0]);
    const minorVersion = parseInt(versionArray[1]);
    const patchNumber = parseInt(versionArray[2]);

    ci.publishEvent({ testplatform: `${majorVersion}.${minorVersion}.${patchNumber}` });

    if (isNaN(majorVersion) || isNaN(minorVersion) || isNaN(patchNumber)) {
        tl.warning(tl.loc('UnexpectedVersionNumber', verSplitArray[1]));
        throw new Error(tl.loc('UnexpectedVersionNumber', verSplitArray[1]));
    }

    switch (majorVersion) {
        case 14:
            testConfig.vsTestVersionDetails = new version.Dev14VSTestVersion(vstestexeLocation, minorVersion, patchNumber);
            break;
        case 15:
            testConfig.vsTestVersionDetails = new version.Dev15VSTestVersion(vstestexeLocation, minorVersion, patchNumber);
            break;
        default:
            testConfig.vsTestVersionDetails = new version.VSTestVersion(vstestexeLocation, majorVersion, minorVersion, patchNumber);
            break;
    }
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:49,代码来源:versionfinder.ts

示例6: downloadAndInstall

    private async downloadAndInstall(downloadUrls: string[]) {
        let downloaded = false;
        let downloadPath = "";
        for (const url of downloadUrls) {
            try {
                downloadPath = await toolLib.downloadTool(url);
                downloaded = true;
                break;
            } catch (error) {
                tl.warning(tl.loc("CouldNotDownload", url, JSON.stringify(error)));
            }
        }

        if (!downloaded) {
            throw tl.loc("FailedToDownloadPackage");
        }

        // extract
        console.log(tl.loc("ExtractingPackage", downloadPath));
        let extPath: string = tl.osType().match(/^Win/) ? await toolLib.extractZip(downloadPath) : await toolLib.extractTar(downloadPath);

        // cache tool
        console.log(tl.loc("CachingTool"));
        let cachedDir = await toolLib.cacheDir(extPath, this.cachedToolName, this.version);
        console.log(tl.loc("SuccessfullyInstalled", this.packageType, this.version));
        return cachedDir;
    }
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:27,代码来源:dotnetcoreinstaller.ts

示例7: getKubectlVersion

export async function getKubectlVersion(versionSpec: string, checkLatest: boolean) : Promise<string> {
    
    if(checkLatest) {
        return await kubectlutility.getStableKubectlVersion();
    }
    else if (versionSpec) {
        if(versionSpec === "1.7") {
            // Backward compat handle
            tl.warning(tl.loc("UsingLatestStableVersion"));
            return kubectlutility.getStableKubectlVersion();
        } 
        else if ("v".concat(versionSpec) === kubectlutility.stableKubectlVersion) {
            tl.debug(util.format("Using default versionSpec:%s.", versionSpec));
            return kubectlutility.stableKubectlVersion;
        }
        else {
            // Do not check for validity of the version here,
            // We'll return proper error message when the download fails
            if(!versionSpec.startsWith("v")) {
                return "v".concat(versionSpec);
            }
            else{
                return versionSpec;
            }
        } 
     }
 
     return kubectlutility.stableKubectlVersion;
 }
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:29,代码来源:utilities.ts

示例8: enableCodeCoverage

    // -----------------------------------------------------
    // Enable code coverage for Jacoco Gradle Builds
    // - enableCodeCoverage: CodeCoverageProperties  - ccProps
    // -----------------------------------------------------    
    public enableCodeCoverage(ccProps: { [name: string]: string }): Q.Promise<boolean> {
        let _this = this;

        tl.debug("Input parameters: " + JSON.stringify(ccProps));

        _this.buildFile = ccProps["buildfile"];
        let classFilter = ccProps["classfilter"];
        let isMultiModule = ccProps["ismultimodule"] && ccProps["ismultimodule"] === "true";
        let classFileDirs = ccProps["classfilesdirectories"];
        let reportDir = ccProps["reportdirectory"];
        let codeCoveragePluginData = null;

        let filter = _this.extractFilters(classFilter);
        let jacocoExclude = _this.applyFilterPattern(filter.excludeFilter);
        let jacocoInclude = _this.applyFilterPattern(filter.includeFilter);

        if (isMultiModule) {
            codeCoveragePluginData = ccc.jacocoGradleMultiModuleEnable(jacocoExclude.join(","), jacocoInclude.join(","), classFileDirs, reportDir);
        } else {
            codeCoveragePluginData = ccc.jacocoGradleSingleModuleEnable(jacocoExclude.join(","), jacocoInclude.join(","), classFileDirs, reportDir);
        }

        try {
            tl.debug("Code Coverage data will be appeneded to build file: " + this.buildFile);
            util.appendTextToFileSync(this.buildFile, codeCoveragePluginData);
            tl.debug("Appended code coverage data");
        } catch (error) {
            tl.warning(tl.loc("FailedToAppendCC", error));
            return Q.reject<boolean>(tl.loc("FailedToAppendCC", error));
        }
        return Q.resolve<boolean>(true);
    }
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:36,代码来源:jacoco.gradle.ccenabler.ts

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

示例10: run

export async function run(nuGetPath: string): Promise<void> {
    nutil.setConsoleCodePage();

    let buildIdentityDisplayName: string = null;
    let buildIdentityAccount: string = null;

    let args: string = tl.getInput("arguments", false);

    const version = await peParser.getFileVersionInfoAsync(nuGetPath);
    if(version.productVersion.a < 3 || (version.productVersion.a <= 3 && version.productVersion.b < 5))
    {
        tl.setResult(tl.TaskResult.Failed, tl.loc("Info_NuGetSupportedAfter3_5", version.strings.ProductVersion));
        return;
    }

    try {
        let credProviderPath = nutil.locateCredentialProvider();

        // Clauses ordered in this way to avoid short-circuit evaluation, so the debug info printed by the functions
        // is unconditionally displayed
        const quirks = await ngToolRunner.getNuGetQuirksAsync(nuGetPath);
        const useCredProvider = ngToolRunner.isCredentialProviderEnabled(quirks) && credProviderPath;
        // useCredConfig not placed here: This task will only support NuGet versions >= 3.5.0 which support credProvider both hosted and OnPrem

        let accessToken = auth.getSystemAccessToken();
        let serviceUri = tl.getEndpointUrl("SYSTEMVSSCONNECTION", false);
        let urlPrefixes = await locationHelpers.assumeNuGetUriPrefixes(serviceUri);
        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
        let testPrefixes = tl.getVariable("NuGetTasks.ExtraUrlPrefixesForTesting");
        if (testPrefixes) {
            urlPrefixes = urlPrefixes.concat(testPrefixes.split(";"));
            tl.debug(`All URL prefixes: ${urlPrefixes}`);
        }
        let authInfo = new auth.NuGetExtendedAuthInfo(new auth.InternalAuthInfo(urlPrefixes, accessToken, useCredProvider, false), []);
        let environmentSettings: ngToolRunner.NuGetEnvironmentSettings = {
            credProviderFolder: useCredProvider ? path.dirname(credProviderPath) : null,
            extensionsDisabled: true
        };

        let executionOptions = new NuGetExecutionOptions(
            nuGetPath,
            environmentSettings,
            args,
            authInfo);

        runNuGet(executionOptions);
    } catch (err) {
        tl.error(err);

        if (buildIdentityDisplayName || buildIdentityAccount) {
            tl.warning(tl.loc("BuildIdentityPermissionsHint", buildIdentityDisplayName, buildIdentityAccount));
        }

        tl.setResult(tl.TaskResult.Failed, "");
    }
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:59,代码来源:nugetcustom.ts


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