function lLinkObjChecksumPatch = mergeCompileFolder...
(wkrSharedUtils, mastSharedUtils, compileFolders)

% Copyright 2011-2019 The MathWorks, Inc.

lLinkObjChecksumPatch = cell(size(compileFolders));

for i=1:length(compileFolders)
compileFolder = compileFolders{i};

srcFolder = fullfile(wkrSharedUtils, compileFolder);
dstFolder = fullfile(mastSharedUtils, compileFolder);

checksumFile = coder.make.internal.CompileInfoFile.getInfoFileName; % compileInfo.mat
srcFile = fullfile(srcFolder, checksumFile);

if isfile(srcFile)
sourceCompileInfo = coder.make.internal.CompileInfoFile(srcFolder);
destinationCompileInfo = coder.make.internal.CompileInfoFile(dstFolder);

% Merge the source compileInfo into the destination compileInfo
[filesToCopyWithPath, lLinkObjChecksumPatch{i}] = ...
mergeCompileInfo(destinationCompileInfo, sourceCompileInfo);

% Copy the object files (with retry)
cmd = @(s, d) copyfile(s, d, 'f');
cellfun(@(x)coder.make.internal.robustOperation(cmd, x, dstFolder), filesToCopyWithPath);

end
end