|
|
@ -29,39 +29,37 @@ module.exports = function (params, processor) { |
|
|
|
((date.getHours() * 100 + date.getMinutes()) * 100 + date.getSeconds()) + " (" + |
|
|
|
((date.getHours() * 100 + date.getMinutes()) * 100 + date.getSeconds()) + " (" + |
|
|
|
"built from " + processor.context.rev + "; " + |
|
|
|
"built from " + processor.context.rev + "; " + |
|
|
|
"repository: " + processor.context.owner + "/" + processor.context.reponame + "; " + |
|
|
|
"repository: " + processor.context.owner + "/" + processor.context.reponame + "; " + |
|
|
|
"branch: " + processor.context.branch + ")"; |
|
|
|
"branch: " + processor.context.branch + ")", |
|
|
|
|
|
|
|
processAssemblyInfo = function (content, cb) { |
|
|
|
|
|
|
|
content += "\r\n"; |
|
|
|
|
|
|
|
content = addAssemblyAttribute(content, "[assembly: AssemblyInformationalVersion(\"" + version + "\")]"); |
|
|
|
|
|
|
|
return cb(null, content); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
processCsproj = function (content, cb) { |
|
|
|
|
|
|
|
if (!params.skipCodeSigning && !settings.skipCodeSigning) { |
|
|
|
|
|
|
|
content = content.replace("</PropertyGroup>", "</PropertyGroup><PropertyGroup><SignAssembly>true</SignAssembly><AssemblyOriginatorKeyFile>" + settings.codeSigningKeyFile + "</AssemblyOriginatorKeyFile></PropertyGroup>"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return cb(null, content); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
glob("**/AssemblyInfo.cs", {cwd: processor.context.exported}, function (err, files) { |
|
|
|
glob("**/{AssemblyInfo.cs,*.csproj}", {cwd: processor.context.exported}, function (err, files) { |
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|
processor.onError(err); |
|
|
|
processor.onError(err); |
|
|
|
return processor.done(); |
|
|
|
return processor.done(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
processor.onInfo("Found " + files.length + " AssemblyInfo.cs files"); |
|
|
|
processor.onInfo("Found " + files.length + " AssemblyInfo.cs/csproj files"); |
|
|
|
|
|
|
|
|
|
|
|
if (!files || !files.length) { |
|
|
|
if (!files || !files.length) { |
|
|
|
processor.onWarn("No AssemblyInfo.cs found"); |
|
|
|
processor.onWarn("No AssemblyInfo.cs/csproj found"); |
|
|
|
return processor.done(); |
|
|
|
return processor.done(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return async.parallel(files.map(function (file) { |
|
|
|
return async.parallel(files.map(function (file) { |
|
|
|
return function (callback) { |
|
|
|
return function (callback) { |
|
|
|
return async.waterfall([ |
|
|
|
return async.waterfall([ |
|
|
|
fs.readFile.bind(null, processor.context.exported + "/" + file), |
|
|
|
fs.readFile.bind(null, processor.context.exported + "/" + file, { encoding: "utf8" }), |
|
|
|
function (content, cb) { |
|
|
|
(file.substr(-7).toLowerCase() == ".csproj") ? processCsproj : processAssemblyInfo, |
|
|
|
content += "\r\n"; |
|
|
|
|
|
|
|
if (!params.skipCodeSigning && !settings.skipCodeSigning) { |
|
|
|
|
|
|
|
content = content.replace( |
|
|
|
|
|
|
|
/InternalsVisibleTo\s*\(\s*\"([\w.]+)\"\s*\)/g, |
|
|
|
|
|
|
|
function (match, p1) { |
|
|
|
|
|
|
|
return "InternalsVisibleTo(\"" + p1 + ",PublicKey=" + settings.codeSigningPublicKey + "\")"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
content = addAssemblyAttribute(content, "[assembly: AssemblyKeyFileAttribute(\"" + settings.codeSigningKeyFile + "\")]\r\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
content = addAssemblyAttribute(content, "[assembly: AssemblyInformationalVersion(\"" + version + "\")]"); |
|
|
|
|
|
|
|
return cb(null, content); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
fs.writeFile.bind(null, processor.context.exported + "/" + file) |
|
|
|
fs.writeFile.bind(null, processor.context.exported + "/" + file) |
|
|
|
], function (err) { |
|
|
|
], function (err) { |
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|