function updateExtensionManifestTaskIds()

in BuildTasks/Common/Common.ts [349:374]


function updateExtensionManifestTaskIds(manifest: any, originalTaskId: string, newTaskId: string): unknown {
    if (!manifest.contributions) {
        tl.debug(`No contributions found`);
        return manifest;
    }
    
    manifest.contributions
        .filter((c: any) => c.type !== "ms.vss-distributed-task.task" && c.properties && c.properties.supportsTasks)
        .forEach((c: any) => {
            const supportsTasks = [...c.properties.supportsTasks];
            const index = supportsTasks.indexOf(originalTaskId);
            if(index != -1) {
                
                tl.debug(`Extension manifest supportsTasks before: ${c.properties.supportsTasks}`);

                supportsTasks[index] = newTaskId;
                c.properties.supportsTasks = supportsTasks;
                
                tl.debug(`Extension manifest supportsTasks after: ${c.properties.supportsTasks}`);
            } else{
                tl.debug(`No supportTasks entry found in manifest contribution`);
            }
        });

    return manifest;
}