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


TypeScript task.loc函數代碼示例

本文整理匯總了TypeScript中vsts-task-lib/task.loc函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript loc函數的具體用法?TypeScript loc怎麽用?TypeScript loc使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: findDockerFile

function findDockerFile(dockerfilepath : string) : string {

    if (dockerfilepath.indexOf('*') >= 0 || dockerfilepath.indexOf('?') >= 0) {
        tl.debug(tl.loc('ContainerPatternFound'));
        var buildFolder = tl.getVariable('System.DefaultWorkingDirectory');
        var allFiles = tl.find(buildFolder);
        var matchingResultsFiles = tl.match(allFiles, dockerfilepath, buildFolder, { matchBase: true });

        if (!matchingResultsFiles || matchingResultsFiles.length == 0) {
            throw new Error(tl.loc('ContainerDockerFileNotFound', dockerfilepath));
        }

        return matchingResultsFiles[0];
    }
    else
    {
        tl.debug(tl.loc('ContainerPatternNotFound'));
        return dockerfilepath;
    }
}
開發者ID:bleissem,項目名稱:vsts-tasks,代碼行數:20,代碼來源:containerbuild.ts

示例2: if

	httpObj.get('GET', restUrl, requestHeader, (error, response, body) => {
        if(error) {
            deferred.reject(error);
        }
        else if(response.statusCode === 200) {
            deferred.resolve(JSON.parse(body));
        }
        else {
        	deferred.reject(tl.loc("CouldNotFetchNetworkInterface", name, response.statusCode, response.statusMessage, body));
        }
    });
開發者ID:DarqueWarrior,項目名稱:vsts-tasks,代碼行數:11,代碼來源:nlbazureutility.ts

示例3: getVersionCompleteFileName

    private getVersionCompleteFileName(name: string): string {
        if (name && name.endsWith(".complete")) {
            var parts = name.split('.');
            var fileNameWithoutExtensionLength = name.length - (parts[parts.length - 1].length + 1);
            if (fileNameWithoutExtensionLength > 0) {
                return name.substr(0, fileNameWithoutExtensionLength);
            }
        }

        throw tl.loc("FileNameNotCorrectCompleteFileName", name);
    }
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:11,代碼來源:versioninstaller.ts

示例4: constructor

    constructor(packageType: string, installationPath: string) {
        try {
            tl.exist(installationPath) || tl.mkdirP(installationPath);
        }
        catch (ex) {
            throw tl.loc("UnableToAccessPath", installationPath, JSON.stringify(ex));
        }

        this.packageType = packageType;
        this.installationPath = installationPath;
    }
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:11,代碼來源:versioninstaller.ts

示例5: VersionInfo

 channelReleases.forEach((release) => {
     if (release && release[packageType] && release[packageType].version) {
         try {
             let versionInfo: VersionInfo = new VersionInfo(release[packageType], packageType);
             versionInfoList.push(versionInfo);
         }
         catch (err) {
             tl.debug(tl.loc("VersionInformationNotComplete", release[packageType].version, err));
         }
     }
 });
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:11,代碼來源:versionfetcher.ts

示例6: getDistributionBatchSize

function getDistributionBatchSize(dtaTestConfiguration: models.DtaTestConfigurations) {
    const distributeOption = tl.getInput('distributionBatchType');
    if (distributeOption && distributeOption === 'basedOnTestCases') {
        dtaTestConfiguration.batchingType = models.BatchingType.TestCaseBased;
        // flow if the batch type = based on agents/custom batching
        const distributeByAgentsOption = tl.getInput('batchingBasedOnAgentsOption');
        if (distributeByAgentsOption && distributeByAgentsOption === 'customBatchSize') {
            const batchSize = parseInt(tl.getInput('customBatchSizeValue'));
            if (!isNaN(batchSize) && batchSize > 0) {
                dtaTestConfiguration.numberOfTestCasesPerSlice = batchSize;
                console.log(tl.loc('numberOfTestCasesPerSlice', dtaTestConfiguration.numberOfTestCasesPerSlice));
            } else {
                throw new Error(tl.loc('invalidTestBatchSize', batchSize));
            }
        }
        // by default we set the distribution = number of agents
    } else if (distributeOption && distributeOption === 'basedOnExecutionTime') {
        dtaTestConfiguration.batchingType = models.BatchingType.TestExecutionTimeBased;
        // flow if the batch type = based on agents/custom batching
        const batchBasedOnExecutionTimeOption = tl.getInput('batchingBasedOnExecutionTimeOption');
        if (batchBasedOnExecutionTimeOption && batchBasedOnExecutionTimeOption === 'customTimeBatchSize') {
            const batchExecutionTimeInSec = parseInt(tl.getInput('customRunTimePerBatchValue'));
            if (isNaN(batchExecutionTimeInSec) || batchExecutionTimeInSec <= 0) {
                throw new Error(tl.loc('invalidRunTimePerBatch', batchExecutionTimeInSec));
            }

            dtaTestConfiguration.runningTimePerBatchInMs = 60 * 1000;
            if (batchExecutionTimeInSec >= 60) {
                dtaTestConfiguration.runningTimePerBatchInMs = batchExecutionTimeInSec * 1000;
                console.log(tl.loc('RunTimePerBatch', dtaTestConfiguration.runningTimePerBatchInMs));
            } else {
                tl.warning(tl.loc('minimumRunTimePerBatchWarning', 60));
            }
        } else if (batchBasedOnExecutionTimeOption && batchBasedOnExecutionTimeOption === 'autoBatchSize') {
            dtaTestConfiguration.runningTimePerBatchInMs = 0;
        }
    } else if (distributeOption && distributeOption === 'basedOnAssembly') {
        dtaTestConfiguration.batchingType = models.BatchingType.AssemblyBased;
    }
    return 0;
}
開發者ID:shubham90,項目名稱:vsts-tasks,代碼行數:41,代碼來源:taskinputparser.ts

示例7: detectMachineOS

    private detectMachineOS(): string[] {
        let osSuffix = [];

        if (tl.osType().match(/^Win/)) {
            let primary = "win-" + os.arch();
            osSuffix.push(primary);
            console.log(tl.loc("PrimaryPlatform", primary));
        }
        else {
            let scriptPath = path.join(utilities.getCurrentDir(), 'externals', 'get-os-distro.sh');
            utilities.setFileAttribute(scriptPath, "777");

            let scriptRunner: trm.ToolRunner = tl.tool(tl.which(scriptPath, true));
            let result: trm.IExecSyncResult = scriptRunner.execSync();

            if (result.code != 0) {
                throw tl.loc("getMachinePlatformFailed", result.error ? result.error.message : result.stderr);
            }

            let output: string = result.stdout;

            let index;
            if ((index = output.indexOf("Primary:")) >= 0) {
                let primary = output.substr(index + "Primary:".length).split(os.EOL)[0];
                osSuffix.push(primary);
                console.log(tl.loc("PrimaryPlatform", primary));
            }

            if ((index = output.indexOf("Legacy:")) >= 0) {
                let legacy = output.substr(index + "Legacy:".length).split(os.EOL)[0];
                osSuffix.push(legacy);
                console.log(tl.loc("LegacyPlatform", legacy));
            }

            if (osSuffix.length == 0) {
                throw tl.loc("CouldNotDetectPlatform");
            }
        }

        return osSuffix;
    }
開發者ID:grawcho,項目名稱:vso-agent-tasks,代碼行數:41,代碼來源:dotnetcoreinstaller.ts

示例8: addCodeCoverageData

    protected addCodeCoverageData(pomJson: any): Q.Promise<any[]> {
        let _this = this;
        if (!pomJson.project) {
            Q.reject(tl.loc("InvalidBuildFile"));
        }

        let sourceData = _this.getSourceFilter();
        let classData = _this.getClassData();
        let reportPluginData = ccc.jacocoAntReport(_this.reportDir, classData, sourceData);

        return Q.all([_this.addCodeCoveragePluginData(pomJson), _this.createReportFile(reportPluginData)]);
    }
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:12,代碼來源:jacoco.ant.ccenabler.ts

示例9: prependPathSafe

export function prependPathSafe(toolPath: string) {
    // TODO task-lib 2.4.0: `assertAgent` is not in mock-task
    // task.assertAgent('2.115.0');

    console.log(task.loc('PrependPath', toolPath));
    const newPath = toolPath + path.delimiter + process.env['PATH'];
    task.debug('new Path: ' + newPath);
    process.env['PATH'] = newPath;

    // instruct the agent to set this path on future tasks
    console.log('##vso[task.prependpath]' + toolPath);
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:12,代碼來源:toolutil.ts

示例10: run

async function run() {
    try {
        tl.setResourcePath(path.join(__dirname, 'task.json'));
        const keystoreFile: string = tl.getTaskVariable('KEYSTORE_FILE_PATH');
        if (keystoreFile && tl.exist(keystoreFile)) {
            fs.unlinkSync(keystoreFile);
            tl.debug('Deleted keystore file downloaded from the server: ' + keystoreFile);
        }
    } catch (err) {
        tl.warning(tl.loc('DeleteKeystoreFileFailed', err));
    }
}
開發者ID:grawcho,項目名稱:vso-agent-tasks,代碼行數:12,代碼來源:postandroidsigning.ts


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