From 60cd2092eebd6e299421db40dfc1f37012014ef6 Mon Sep 17 00:00:00 2001 From: Eric Sciple Date: Thu, 17 Nov 2016 12:00:23 -0500 Subject: [PATCH] Update agg layout process to handle task name change --- make-util.js | 26 ++++++++++++++++++-------- make.js | 9 --------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/make-util.js b/make-util.js index b653a1f36cb9..5f536f560a04 100644 --- a/make-util.js +++ b/make-util.js @@ -694,7 +694,7 @@ var linkNonAggregatedLayoutContent = function (sourceRoot, destRoot, metadataOnl }); } -var linkAggregatedLayoutContent = function (sourceRoot, destRoot, release, commit) { +var linkAggregatedLayoutContent = function (sourceRoot, destRoot, release, commit, taskDestMap) { assert(sourceRoot, 'sourceRoot'); assert(destRoot, 'destRoot'); assert(commit, 'commit'); @@ -702,7 +702,7 @@ var linkAggregatedLayoutContent = function (sourceRoot, destRoot, release, commi console.log(`> Linking ${path.basename(sourceRoot)}`); mkdir('-p', destRoot); - // process each file/folder within the source root + // process each file/folder within the non-aggregated layout fs.readdirSync(sourceRoot).forEach(function (itemName) { // skip files var taskSourcePath = path.join(sourceRoot, itemName); @@ -720,7 +720,13 @@ var linkAggregatedLayoutContent = function (sourceRoot, destRoot, release, commi } // determine the dest folder based on the major version - var taskDestPath = path.join(destRoot, itemName + `__v${sourceTask.version.Major}`); + assert(sourceTask.id, 'sourceTask.id'); + var taskDestKey = sourceTask.id + '@' + sourceTask.version.Major; + var taskDestPath = taskDestMap[taskDestKey]; + if (!taskDestPath) { + taskDestPath = path.join(destRoot, itemName + `__v${sourceTask.version.Major}`); + taskDestMap[taskDestKey] = taskDestPath; + } if (test('-e', taskDestPath)) { // validate that a newer minor+patch does not exist in an older release @@ -792,9 +798,9 @@ var getRefs = function () { // get the ref info for HEAD var info ={ head: { - branch: branch, - commit: commit, - release: release + branch: branch, // e.g. refs/heads/releases/m108 + commit: commit, // leading 8 chars only + release: release // e.g. 108 or undefined if not a release branch }, releases: { } }; @@ -885,9 +891,13 @@ var createAggregatedZip = function (packagePath) { mkdir('-p', aggregatedLayoutPath); fs.writeFileSync(path.join(aggregatedLayoutPath, 'layout-version.txt'), '2'); + // track task GUID + major version -> destination path + // task directory names can change between different release branches + var taskDestMap = { }; + // link the tasks from the non-aggregated layout into the aggregated layout var nonAggregatedLayoutPath = path.join(packagePath, 'non-aggregated-layout'); - linkAggregatedLayoutContent(nonAggregatedLayoutPath, aggregatedLayoutPath, /*release:*/'', /*commit:*/refs.head.commit); + linkAggregatedLayoutContent(nonAggregatedLayoutPath, aggregatedLayoutPath, /*release:*/'', /*commit:*/refs.head.commit, taskDestMap); // link the tasks from previous releases into the aggregated layout Object.keys(refs.releases) @@ -901,7 +911,7 @@ var createAggregatedZip = function (packagePath) { var commit = refs.releases[release].commit; var releaseLayout = getNonAggregatedLayout(packagePath, release, commit); - linkAggregatedLayoutContent(releaseLayout, aggregatedLayoutPath, /*release:*/release, /*commit:*/commit); + linkAggregatedLayoutContent(releaseLayout, aggregatedLayoutPath, /*release:*/release, /*commit:*/commit, taskDestMap); }); // validate task uniqueness within the layout based on task GUID + major version diff --git a/make.js b/make.js index a9575adc39bc..4022e241bd32 100644 --- a/make.js +++ b/make.js @@ -346,15 +346,6 @@ target.testLegacy = function() { } target.package = function() { - // validate powershell 5 - ensureTool('powershell.exe', - '-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$PSVersionTable.PSVersion.Major"', - function (output) { - if (!Number.parseInt(output) >= 5) { - fail('expected version 5 or higher'); - } - }); - // clean rm('-Rf', packagePath);