Refactored DotNetBuilder usage

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 11 years ago
parent f84e09daaa
commit d280fbafbf
  1. 50
      BuildServer/lib/tasks/dotnetbuild.js
  2. 47
      BuildServer/lib/tasks/dotnetbuilderwrapper.js

@ -1,50 +1,10 @@
"use strict"; "use strict";
var spawn = require('child_process').spawn; var dotNetBuilderWrapper = require('./dotnetbuilderwrapper');
module.exports = function (params, processor) { module.exports = function (params, processor) {
return { return dotNetBuilderWrapper({
process: function () { "SolutionPath": processor.context.exported + "/" + params.solution,
var result = "", "OutputPath": processor.context.release + "/" + params.solution + "/"
error = "", }, processor);
builder = spawn("../DotNetBuilder/bin/Debug/MicroBuildServer.DotNetBuilder.exe", ["compile"]);
builder.stdout.on('data', function (data) {
result += data;
});
builder.stderr.on('data', function (data) {
error += data;
});
builder.on('exit', function (code) {
if (code !== 0) {
error = "Return code is " + code + "\r\n" + error;
processor.onError(error);
return processor.done();
}
var report = JSON.parse(result);
var messages = report.Messages;
for (var i = 0; i < messages.length; i++) {
switch(messages[i].Type) {
case "info":
processor.onInfo(messages[i].Body);
break;
case "warn":
processor.onWarn(messages[i].Body);
break;
default:
processor.onError(messages[i].Body);
break;
}
}
return processor.done();
});
builder.stdin.write(JSON.stringify({
"SolutionPath": processor.context.exported + "/" + params.solution,
"OutputPath": processor.context.release + "/" + params.solution + "/"
}));
builder.stdin.end();
}
};
}; };

@ -0,0 +1,47 @@
"use strict";
var spawn = require('child_process').spawn;
module.exports = function (params, processor) {
return {
process: function () {
var result = "",
error = "",
builder = spawn("../DotNetBuilder/bin/Debug/MicroBuildServer.DotNetBuilder.exe", ["compile"]);
builder.stdout.on('data', function (data) {
result += data;
});
builder.stderr.on('data', function (data) {
error += data;
});
builder.on('exit', function (code) {
if (code !== 0) {
error = "Return code is " + code + "\r\n" + error;
processor.onError(error);
return processor.done();
}
var report = JSON.parse(result);
var messages = report.Messages;
for (var i = 0; i < messages.length; i++) {
switch(messages[i].Type) {
case "info":
processor.onInfo(messages[i].Body);
break;
case "warn":
processor.onWarn(messages[i].Body);
break;
default:
processor.onError(messages[i].Body);
break;
}
}
return processor.done();
});
builder.stdin.write(JSON.stringify(params));
builder.stdin.end();
}
};
};
Loading…
Cancel
Save