in BuildTasks/Common/Common.ts [39:169]
export function validateAndSetTfxManifestArguments(tfx: ToolRunner): (() => void) {
const rootFolder = tl.getInput("rootFolder", false);
tfx.argIf(rootFolder, ["--root", rootFolder]);
const globsManifest = tl.getDelimitedInput("patternManifest", "\n", false);
tfx.argIf(globsManifest.length, ["--manifest-globs"]);
tfx.argIf(globsManifest.length, globsManifest);
// Overrides manifest file
const publisher = tl.getInput("publisherId", false);
const localizationRoot = tl.getInput("localizationRoot", false);
tfx.argIf(localizationRoot, ["--loc-root", localizationRoot]);
let extensionId = tl.getInput("extensionId", false);
const extensionTag = tl.getInput("extensionTag", false);
if (extensionId && extensionTag) {
extensionId += extensionTag;
tl.debug(`Overriding extension id to: ${extensionId}`);
}
// for backwards compat check both "method" and "fileType"
switch (tl.getInput("method", false) || tl.getInput("fileType", false)) {
// for backwards compat trigger on both "manifest" and "id"
case "manifest":
case "id":
default: {
tfx.argIf(publisher, ["--publisher", publisher]);
tfx.argIf(extensionId, ["--extension-id", extensionId]);
break;
}
case "vsix": {
const 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(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}.`);
throw "failed";
}
if (matchingVsixFile.length !== 1) {
tl.setResult(tl.TaskResult.Failed, `Found multiple vsix files matching: ${vsixFilePattern}.`);
throw "failed";
}
tfx.arg(["--vsix", matchingVsixFile[0]]);
break;
}
}
let jsonOverrides: any;
const extensionName = tl.getInput("extensionName", false);
if (extensionName) {
tl.debug(`Overriding extension name to: ${extensionName}`);
jsonOverrides = (jsonOverrides || {});
jsonOverrides.name = extensionName;
}
const extensionVisibility = tl.getInput("extensionVisibility", false);
if (extensionVisibility && extensionVisibility !== "default") {
tl.debug(`Overriding extension visibility to: ${extensionVisibility}`);
jsonOverrides = (jsonOverrides || {});
const isPublic = extensionVisibility.indexOf("public") >= 0;
const isPreview = extensionVisibility.indexOf("preview") >= 0;
jsonOverrides.public = isPublic;
if (isPreview) {
jsonOverrides.galleryFlags = jsonOverrides.galleryFlags || [];
jsonOverrides.galleryFlags.push("Preview");
}
}
const extensionPricing = tl.getInput("extensionPricing", false);
if (extensionPricing && extensionPricing !== "default") {
tl.debug(`Overriding extension pricing to: ${extensionPricing}`);
jsonOverrides = (jsonOverrides || {});
const isPaid = extensionPricing.indexOf("paid") >= 0;
if (isPaid) {
jsonOverrides.galleryFlags = jsonOverrides.galleryFlags || [];
jsonOverrides.galleryFlags.push("Paid");
}
}
const extensionVersion = getExtensionVersion();
if (extensionVersion) {
tl.debug(`Overriding extension version to: ${extensionVersion}`);
jsonOverrides = (jsonOverrides || {});
jsonOverrides.version = extensionVersion;
}
const noWaitValidation = tl.getBoolInput("noWaitValidation", false);
if (noWaitValidation) {
tl.debug(`Not waiting for validation.`);
tfx.arg("--no-wait-validation");
}
const bypassLocalValidation = tl.getBoolInput("bypassLocalValidation", false);
if (bypassLocalValidation) {
tl.debug(`Bypassing local validation.`);
tfx.arg("--bypass-validation");
}
let overrideFilePath: string;
if (jsonOverrides) {
// Generate a temp file
overrideFilePath = writeBuildTempFile("PackageTask", JSON.stringify(jsonOverrides));
tl.debug(`Generated a JSON temp file to override manifest values Path: ${overrideFilePath}`);
tfx.arg(["--overrides-file", overrideFilePath]);
}
const args = tl.getInput("arguments", false);
if (args) {
tl.debug(`Adding additional arguments: ${args}.`);
tfx.line(args);
}
return () => deleteBuildTempFile(overrideFilePath);
}