本文整理汇总了TypeScript中azure-pipelines-task-lib/task.getPathInput函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getPathInput函数的具体用法?TypeScript getPathInput怎么用?TypeScript getPathInput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPathInput函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: run
export async function run() {
let templateFilePath: string = tl.getPathInput("templateFilePath", true);
tl.debug(`The template file path is ${templateFilePath}`);
if (!fs.existsSync(templateFilePath)) {
throw Error(tl.loc('TemplateFileInvalid', templateFilePath));
}
util.setTaskRootPath(path.dirname(templateFilePath));
util.setupIotedgedev();
let envList = {
[Constants.iotedgedevEnv.deploymentFileOutputFolder]: tl.getVariable(Constants.outputFileFolder),
};
// Pass task variable to sub process
let tlVariables = tl.getVariables();
for (let v of tlVariables) {
// The variables in VSTS build contains dot, need to convert to underscore.
let name = v.name.replace('.', '_').toUpperCase();
if (!envList[name]) {
envList[name] = v.value;
}
}
tl.debug(`Following variables will be passed to the iotedgedev command: ${JSON.stringify(envList)}`);
let outputStream: EchoStream = new EchoStream();
let execOptions: IExecOptions = {
cwd: tl.cwd(),
env: envList,
outStream: outputStream as stream.Writable,
} as IExecOptions;
let defaultPlatform = tl.getInput('defaultPlatform', true);
let command: string = `build`;
command += ` --file ${templateFilePath}`;
command += ` --platform ${defaultPlatform}`;
await tl.exec(`${Constants.iotedgedev}`, command, execOptions);
let outLog: string = outputStream.content;
let filterReg: RegExp = /Expanding '[^']*' to '([^']*)'/g;
let matches: RegExpMatchArray = filterReg.exec(outLog);
if(matches && matches[1]) {
tl.setVariable(Constants.outputVariableDeploymentPathKey, matches[1]);
tl.setVariable('_' + Constants.outputVariableDeploymentPathKey, matches[1]);
tl.debug(`Set ${Constants.outputVariableDeploymentPathKey} to ${matches[1]}`);
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:48,代码来源:buildimage.ts
示例2: 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
示例3: _logNugetStartupVariables
function _logNugetStartupVariables(nuGetPath: string, nugetVersion: string) {
try {
const nugetfeedtype = tl.getInput("nugetfeedtype");
let externalendpoint = null;
if (nugetfeedtype != null && nugetfeedtype === "external") {
const epId = tl.getInput("externalendpoint");
if (epId) {
externalendpoint = {
feedName: tl.getEndpointUrl(epId, false).replace(/\W/g, ""),
feedUri: tl.getEndpointUrl(epId, false),
};
}
}
let externalendpoints = tl.getDelimitedInput("externalendpoints", ",");
if (externalendpoints) {
externalendpoints = externalendpoints.reduce((ary, id) => {
const te = {
feedName: tl.getEndpointUrl(id, false).replace(/\W/g, ""),
feedUri: tl.getEndpointUrl(id, false),
};
ary.push(te);
return ary;
}, []);
}
const nugetTelem = {
"command": tl.getInput("command"),
"NUGET_EXE_TOOL_PATH_ENV_VAR": tl.getVariable(nuGetGetter.NUGET_EXE_TOOL_PATH_ENV_VAR),
"NUGET_EXE_CUSTOM_LOCATION": tl.getVariable(NUGET_EXE_CUSTOM_LOCATION),
"searchPatternPack": tl.getPathInput("searchPatternPack"),
"configurationToPack": tl.getInput("configurationToPack"),
"versioningScheme": tl.getInput("versioningScheme"),
"includeReferencedProjects": tl.getBoolInput("includeReferencedProjects"),
"versionEnvVar": tl.getInput("versioningScheme") === "byEnvVar" ?
tl.getVariable(tl.getInput("versionEnvVar")) : null,
"requestedMajorVersion": tl.getInput("requestedMajorVersion"),
"requestedMinorVersion": tl.getInput("requestedMinorVersion"),
"requestedPatchVersion": tl.getInput("requestedPatchVersion"),
"packTimezone": tl.getInput("packTimezone"),
"buildProperties": tl.getInput("buildProperties"),
"basePath": tl.getInput("basePath"),
"verbosityPack": tl.getInput("verbosityPack"),
"includeSymbols": tl.getBoolInput("includeSymbols"),
"NuGet.UseLegacyFindFiles": tl.getVariable("NuGet.UseLegacyFindFiles"),
"NuGetTasks.IsHostedTestEnvironment": tl.getVariable("NuGetTasks.IsHostedTestEnvironment"),
"System.TeamFoundationCollectionUri": tl.getVariable("System.TeamFoundationCollectionUri"),
"NuGet.OverwritePackagingCollectionUrl": tl.getVariable("NuGet.OverwritePackagingCollectionUrl"),
"externalendpoint": externalendpoint,
"externalendpoints": externalendpoints,
"allowpackageconflicts": tl.getInput("allowpackageconflicts"),
"includenugetorg": tl.getInput("includenugetorg"),
"nocache": tl.getInput("nocache"),
"disableparallelprocessing": tl.getInput("disableParallelProcessing"),
"nugetconfigpath": tl.getInput("nugetconfigpath"),
"nugetfeedtype": nugetfeedtype,
"searchpatternpush": tl.getInput("searchpatternpush"),
"selectorconfig": tl.getInput("selectorconfig"),
"solution": tl.getInput("solution"),
"verbositypush": tl.getInput("verbositypush"),
"verbosityrestore": tl.getInput("verbosityrestore"),
"nuGetPath": nuGetPath,
"nugetVersion": nugetVersion,
};
telemetry.emitTelemetry("Packaging", "NuGetCommand", nugetTelem);
} catch (err) {
tl.debug(`Unable to log NuGet task init telemetry. Err:( ${err} )`);
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:69,代码来源:nugetcommandmain.ts
示例4: 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
示例5: run
export async function run() {
let registryAuthenticationToken: RegistryCredential = getRegistryAuthenticationToken();
let bypassModules = tl.getInput('bypassModules');
if (bypassModules == null) bypassModules = "";
tl.debug(`Bypass Modules are: ${bypassModules}`);
let templateFilePath: string = tl.getPathInput("templateFilePath", true);
tl.debug(`The template file path is ${templateFilePath}`);
if (!fs.existsSync(templateFilePath)) {
throw Error(tl.loc('TemplateFileInvalid', templateFilePath));
}
util.setTaskRootPath(path.dirname(templateFilePath));
util.setupIotedgedev();
/*
* iotedgedev will use registry server url to match which credential to use in push process
* For example, a normal docker hub credential should have server: https://index.docker.io/v1/ I would like to push to michaeljqzq/repo:0.0.1
* But if I set CONTAINER_REGISTRY_SERVER=https://index.docker.io/v1/ in environment variable, it won't work.
* iotedgedev won't load this credential
* instead, the CONTAINER_REGISTRY_SERVER should be set to michaeljqzq
* However, "michaeljqzq" is not in the scope of a credential.
* So here is a work around to login in advanced call to `iotedgedev push` and then logout after everything done.
*/
tl.execSync(`docker`, `login -u "${registryAuthenticationToken.username}" -p "${registryAuthenticationToken.password}" ${registryAuthenticationToken.serverUrl}`, Constants.execSyncSilentOption)
let envList = {
[Constants.iotedgedevEnv.bypassModules]: bypassModules,
[Constants.iotedgedevEnv.registryServer]: registryAuthenticationToken.serverUrl,
[Constants.iotedgedevEnv.registryUsername]: registryAuthenticationToken.username,
[Constants.iotedgedevEnv.registryPassword]: registryAuthenticationToken.password,
};
// Pass task variable to sub process
let tlVariables = tl.getVariables();
for (let v of tlVariables) {
// The variables in VSTS build contains dot, need to convert to underscore.
let name = v.name.replace('.', '_').toUpperCase();
if (!envList[name]) {
envList[name] = v.value;
}
}
tl.debug(`Following variables will be passed to the iotedgedev command: ${JSON.stringify(envList)}`);
try {
let execOptions: IExecOptions = {
cwd: tl.cwd(),
env: envList,
} as IExecOptions;
let defaultPlatform = tl.getInput('defaultPlatform', true);
let command: string = `push --no-build`;
command += ` --file ${templateFilePath}`;
command += ` --platform ${defaultPlatform}`;
await tl.exec(`${Constants.iotedgedev}`, command, execOptions);
tl.execSync(`docker`, `logout`, Constants.execSyncSilentOption);
util.createOrAppendDockerCredentials(registryAuthenticationToken);
let dockerCredentials = util.readDockerCredentials();
tl.debug(`Number of docker cred passed: ${dockerCredentials.length}`);
let outputDeploymentJsonPath = tl.getVariable('_' + Constants.outputVariableDeploymentPathKey);
if (!fs.existsSync(outputDeploymentJsonPath)) {
tl.debug(`The generated deployment file can't be found in the path: ${outputDeploymentJsonPath}`);
}else {
console.log(tl.loc('DeploymentFilePath', outputDeploymentJsonPath));
let deploymentJson = JSON.parse(fs.readFileSync(outputDeploymentJsonPath, Constants.UTF8));
// Expand docker credentials
// Will replace the registryCredentials if the server match
if (dockerCredentials != undefined && util.getModulesContent(deploymentJson)['$edgeAgent']['properties.desired'].runtime.settings.registryCredentials != undefined) {
console.log(tl.loc('ExpandingRegistryCredentials'));
let credentials = util.getModulesContent(deploymentJson)['$edgeAgent']['properties.desired'].runtime.settings.registryCredentials;
for (let key of Object.keys(credentials)) {
if (credentials[key].username && (credentials[key].username.startsWith("$") || credentials[key].password.startsWith("$"))) {
tl.debug(`Going to replace the cred in deployment.json with address: ${credentials[key].address}`);
for (let dockerCredential of dockerCredentials) {
if (util.isDockerServerMatch(credentials[key].address, dockerCredential.address)) {
console.log(tl.loc('ReplaceCredential', dockerCredential.address));
credentials[key] = dockerCredential;
break;
}
}
}
}
}
fs.writeFileSync(outputDeploymentJsonPath, JSON.stringify(deploymentJson, null, 2));
}
} catch (e) {
tl.execSync(`docker`, `logout`, Constants.execSyncSilentOption);
throw e;
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:95,代码来源:pushimage.ts
示例6: main
async function main(): 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};
}
let buildIdentityDisplayName: string = null;
let buildIdentityAccount: string = null;
try {
tl.setResourcePath(path.join(__dirname, "task.json"));
nutil.setConsoleCodePage();
// read inputs
let searchPattern = tl.getPathInput("searchPattern", true, false);
let allowEmptyNupkgMatch = tl.getBoolInput("continueOnEmptyNupkgMatch");
let filesList = nutil.resolveFilterSpec(
searchPattern,
tl.getVariable("System.DefaultWorkingDirectory") || process.cwd(),
allowEmptyNupkgMatch);
filesList.forEach(packageFile => {
if (!tl.stats(packageFile).isFile()) {
throw new Error(tl.loc("NotARegularFile", packageFile));
}
});
let connectedServiceName = tl.getInput("connectedServiceName");
let internalFeedUri = tl.getInput("feedName");
let nuGetAdditionalArgs = tl.getInput("nuGetAdditionalArgs");
let verbosity = tl.getInput("verbosity");
let nuGetFeedType = tl.getInput("nuGetFeedType") || "external";
// make sure the feed type is an expected one
let normalizedNuGetFeedType
= ["internal", "external"].find(x => nuGetFeedType.toUpperCase() === x.toUpperCase());
if (!normalizedNuGetFeedType) {
throw new Error(tl.loc("UnknownFeedType", nuGetFeedType));
}
nuGetFeedType = normalizedNuGetFeedType;
// due to a bug where we accidentally allowed nuGetPath to be surrounded by quotes before,
// locateNuGetExe() will strip them and check for existence there.
let nuGetPath = tl.getPathInput("nuGetPath", false, false);
let nugetUxOption = tl.getInput("nuGetversion");
let userNuGetProvided = false;
if (nuGetPath !== null && tl.filePathSupplied("nuGetPath")) {
nuGetPath = nutil.stripLeadingAndTrailingQuotes(nuGetPath);
userNuGetProvided = true;
if (nugetUxOption !== "custom")
{
// For back compat, if a path has already been specified then use it.
// However, warn the user in the build of this behavior.
tl.warning(tl.loc("Warning_ConflictingNuGetPreference"));
}
}
else {
if (nugetUxOption === "custom")
{
throw new Error(tl.loc("NoNuGetSpecified"))
}
// Pull the pre-installed path for NuGet.
let nuGetPathSuffix: string;
let versionToUse: string;
if (nugetUxOption === "4.0.0.2283") {
nuGetPathSuffix = "NuGet/4.0.0/";
versionToUse = "4.0.0";
}
else if (nugetUxOption === "3.5.0.1829") {
nuGetPathSuffix = "NuGet/3.5.0/";
versionToUse = "3.5.0";
}
else if (nugetUxOption === "3.3.0") {
nuGetPathSuffix = "NuGet/3.3.0/";
versionToUse = "3.3.0";
}
else {
throw new Error(tl.loc("NGCommon_UnabletoDetectNuGetVersion"));
}
// save and reset the tool path env var, so this task doesn't act as a tool installer
const tempNuGetPath = tl.getVariable(ngToolGetter.NUGET_EXE_TOOL_PATH_ENV_VAR);
const cachedVersion = await ngToolGetter.cacheBundledNuGet(versionToUse, nuGetPathSuffix);
nuGetPath = await ngToolGetter.getNuGet(cachedVersion);
tl.setVariable(ngToolGetter.NUGET_EXE_TOOL_PATH_ENV_VAR, tempNuGetPath);
}
//find nuget location to use
let credProviderPath = nutil.locateCredentialProvider();
const quirks = await ngToolRunner.getNuGetQuirksAsync(nuGetPath);
// clauses ordered in this way to avoid short-circuit evaluation, so the debug info printed by the functions
//.........这里部分代码省略.........
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:101,代码来源:nugetpublisher.ts
示例7: switch
msbuildAdditionalArguments.push(`/p:OutputPath=${path}`);
}
const baseOutputPath = tl.getInput("MsBuildBaseOutputPath", false);
if (baseOutputPath && baseOutputPath !== "AsConfigured") {
let path: string;
switch (baseOutputPath) {
case "BinariesDirectory":
path = `"${tl.getVariable("Build.BinariesDirectory")}"`;
break;
case "StagingDirectory":
path = `"${tl.getVariable("Build.StagingDirectory")}"`;
break;
case "Custom":
path = tl.getPathInput("MsBuildCustomBaseOutputPath", true);
break;
}
msbuildAdditionalArguments.push(`/p:BaseOutputPath=${path}`);
}
const treatWarningsAsErrors = tl.getInput("MsBuildTreatWarningsAsErrors", false);
if (treatWarningsAsErrors && treatWarningsAsErrors !== "AsConfigured") {
msbuildAdditionalArguments.push(`/p:TreatWarningsAsErrors=${treatWarningsAsErrors}`);
}
const generateDocumentation = tl.getInput("GenerateDocumentation", false);
if (generateDocumentation && generateDocumentation !== "AsConfigured") {
msbuildAdditionalArguments.push(`/p:GenerateDocumentation=${generateDocumentation}`);
}
开发者ID:jessehouwing,项目名称:vsts-msbuild-helper-task,代码行数:30,代码来源:vsts-msbuild-helper.ts
示例8: runBuild
export async function runBuild(): Promise<void> {
const aipPath: string = taskLib.getPathInput('AipPath', true, false);
let aipBuild: string = taskLib.getInput('AipBuild');
let aipPackageName: string = taskLib.getInput('AipPackageName');
let aipOutputFolder: string = taskLib.getInput('AipOutputFolder');
if (aipOutputFolder == taskLib.getVariable('BUILD_SOURCESDIRECTORY')) {
taskLib.debug("Reset AipOutputFolder. OLD: $aipOutputFolder NEW:(empty).");
aipOutputFolder = ""
}
const aipExtraCommands: string[] = taskLib.getDelimitedInput('AipExtraCommands', '\r\n');
const aipResetDigSign: boolean = taskLib.getBoolInput('AipResetDigSign');
// Log input parameters
if (aipBuild == null) {
aipBuild = '';
}
taskLib.debug(taskLib.loc("AI_StartTaskLog"));
taskLib.debug("aipPath = " + aipPath);
taskLib.debug("aipBuild = " + aipBuild);
taskLib.debug("aipPackageName = " + aipPackageName);
taskLib.debug("aipOutputFolder = " + aipOutputFolder);
taskLib.debug("aipExtraCommands = " + aipExtraCommands);
taskLib.debug("aipResetDigSign = " + aipResetDigSign);
// Validate "aipPath" input parameter.
taskLib.checkPath(aipPath, aipPath);
// Validate advinst tool path
const advinstToolPath: string = await getAdvinstComTool();
if (null == advinstToolPath) {
throw new Error(taskLib.loc("AI_AdvinstNotFoundErr"));
}
// Compute the advinst commands
let advinstCommands: string[] = [];
if (aipPackageName) {
advinstCommands.push(`SetPackageName \"${aipPackageName}\" -buildname \"${aipBuild}\"`);
}
if (aipOutputFolder) {
advinstCommands.push(`SetOutputLocation -path \"${aipOutputFolder}\" -buildname \"${aipBuild}\"`);
}
if (aipResetDigSign) {
advinstCommands.push('ResetSig');
}
if (aipExtraCommands.length > 0) {
advinstCommands = advinstCommands.concat(aipExtraCommands);
}
advinstCommands.push(aipBuild ? `Build -buildslist \"${aipBuild}\"` : `Build`);
//Execute the commands
try {
var commandsFilePath = getCommandsFile(advinstCommands);
const advinstCmdLineArgs: string[] = ['/execute', `${aipPath}`, `${commandsFilePath}`];
let result = taskLib.execSync(advinstToolPath, advinstCmdLineArgs);
if (result.code != 0) {
throw new Error(taskLib.loc("AI_ExecFailedErr", result.stdout));
}
}
finally {
if (commandsFilePath) {
taskLib.rmRF(commandsFilePath);
}
}
}
开发者ID:Caphyon,项目名称:advinst-vsts-task,代码行数:71,代码来源:AdvinstBuilder.ts
注:本文中的azure-pipelines-task-lib/task.getPathInput函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论