Dirty hack to fix friendly assemblies references in InternalsVisible*.cs files

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 9 years ago
parent 2bb9c82332
commit 2e50e944b0
  1. 12
      BuildServer/lib/tasks/dotnetrewrite.js

@ -26,7 +26,8 @@ module.exports = function (params, processor) {
"built from " + processor.context.rev + "; " +
"repository: " + processor.context.owner + "/" + processor.context.reponame + "; " +
"branch: " + processor.context.branch,
processAssemblyInfo = function (content, cb) {
processAssemblyInfo = function (appendInformationalVersion) {
return function (content, cb) {
if (!params.skipCodeSigning && !settings.skipCodeSigning) {
content = content.replace(
/InternalsVisibleTo\s*\(\s*\"([\w.]+)\"\s*\)/g,
@ -35,11 +36,16 @@ module.exports = function (params, processor) {
}
);
}
if (appendInformationalVersion) {
content = addAssemblyAttribute(content, "[assembly: System.Reflection.AssemblyInformationalVersion(\"" + version + "\")]");
}
return cb(null, content);
};
};
glob("**/AssemblyInfo.cs", {cwd: processor.context.exported}, function (err, files) {
glob("**/{InternalsVisible,AssemblyInfo}*.cs", {cwd: processor.context.exported}, function (err, files) {
if (err) {
processor.onError(err);
return processor.done();
@ -56,7 +62,7 @@ module.exports = function (params, processor) {
return function (callback) {
return async.waterfall([
fs.readFile.bind(null, processor.context.exported + "/" + file, { encoding: "utf8" }),
processAssemblyInfo,
processAssemblyInfo(file.toLowerCase().indexOf("assemblyinfo.cs") >= 0),
fs.writeFile.bind(null, processor.context.exported + "/" + file)
], function (err) {
if (err) {

Loading…
Cancel
Save