Bugs fixed; improvements

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 11 years ago
parent 41399cd8ca
commit 15de513b32
  1. 6
      BuildServer/app.js
  2. 3
      BuildServer/lib/builder.js
  3. 2
      BuildServer/lib/task-processor.js
  4. 33
      BuildServer/lib/tasks/dotnetbuild.js
  5. 1
      BuildServer/routes/manual.js
  6. 2
      BuildServer/views/manual.jade
  7. 9
      BuildServer/views/status-image.jade
  8. 6
      DotNetBuilder/Compiler.cs

@ -20,9 +20,9 @@ var app = express();
app.set('port', process.env.PORT || 3000); app.set('port', process.env.PORT || 3000);
app.set('views', path.join(__dirname, 'views')); app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade'); app.set('view engine', 'jade');
app.set('gitpath', 'data/git'); app.set('gitpath', 'D:/data/mbs/git');
app.set('tmpcodepath', 'data/code'); app.set('tmpcodepath', 'D:/data/mbs/code');
app.set('releasepath', 'data/release'); app.set('releasepath', 'D:/data/mbs/release');
app.use(express.favicon()); app.use(express.favicon());
app.use(express.logger('dev')); app.use(express.logger('dev'));
app.use(express.json()); app.use(express.json());

@ -12,7 +12,7 @@ var build = function (options, callback) {
rev = options.rev, rev = options.rev,
branch = options.branch, branch = options.branch,
local = options.app.get('gitpath') + "/" + owner + "/" + reponame + ".git", local = options.app.get('gitpath') + "/" + owner + "/" + reponame + ".git",
tmp = options.app.get('tmpcodepath') + "/" + owner + "/" + reponame + "/" + branch + "/" + rev, tmp = options.app.get('tmpcodepath') + "/" + rev,
exported = tmp + "/code", exported = tmp + "/code",
release = options.app.get('releasepath') + "/" + owner + "/" + reponame + "/" + branch + "/" + rev; release = options.app.get('releasepath') + "/" + owner + "/" + reponame + "/" + branch + "/" + rev;
@ -40,6 +40,7 @@ var build = function (options, callback) {
}, function(err) { }, function(err) {
if (err) { if (err) {
console.log(err); console.log(err);
return done(err);
} }
console.log("Done loading from git"); console.log("Done loading from git");
fs.exists(exported + "/mbs.json", function (exists) { fs.exists(exported + "/mbs.json", function (exists) {

@ -14,7 +14,7 @@ var TaskProcessor = function (task, outerProcessor, callback) {
taskWorker.process(); taskWorker.process();
}, },
getOuterPrefix = function (prefix) { getOuterPrefix = function (prefix) {
return task.name + (prefix ? "/" + prefix : ""); return (task.name && prefix) ? (task.name + "/" + prefix) : (task.name || "") + (prefix || "");
}, },
onError = function (message, prefix) { onError = function (message, prefix) {
errors.push(message); errors.push(message);

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

@ -6,6 +6,7 @@ exports.get = function (req, res) {
exports.post = function (req, res) { exports.post = function (req, res) {
var options = req.body; var options = req.body;
options.url = "https://github.pos/" + options.owner + "/" + options.reponame;
options.app = req.app; options.app = req.app;
builder.build(options, function (err, result) { builder.build(options, function (err, result) {

@ -5,7 +5,7 @@ block content
form(method="POST") form(method="POST")
table table
tr //tr
td URL td URL
td: input(type="text", name="url", value="https://github.pos/igor-prokhorov/test-github-integration") td: input(type="text", name="url", value="https://github.pos/igor-prokhorov/test-github-integration")
tr tr

@ -1,13 +1,14 @@
doctype xml doctype xml
-var fills = {Warn: "yellow", OK: "green" } -var fills = {Warn: "yellow", OK: "lightgreen" }
-var colors = {Warn: "black", OK: "black" } -var colors = {Warn: "black", OK: "black" }
-var fill = fills[status] || "red" -var fill = fills[status] || "red"
-var color = colors[status] || "white" -var color = colors[status] || "white"
svg(xmlns="http://www.w3.org/2000/svg", xmlns:xlink="http://www.w3.org/1999/xlink", version="1.1", width="800px", height=(message?"100px":"80px")) svg(xmlns="http://www.w3.org/2000/svg", xmlns:xlink="http://www.w3.org/1999/xlink", version="1.1", width="800px", height=(message?"110px":"90px"))
a(xlink:href="/status/" + [owner, reponame, branchName, rev].join("/")) a(xlink:href="/status/" + [owner, reponame, branchName, rev].join("/"))
rect(width="100%", height="100%", fill=fill) rect(width="100%", height="100%", fill=fill)
text(x=20, y=50, font-size=36, font-weight="bold", fill=color) Build status: #{status} text(x=18, y=47, font-size=36, font-weight="bold", fill=color) Build status: #{status}
text(x=20, y=70, font-size=12, fill=color) Owner: #{owner}, reponame: #{reponame}, branch: #{branchName}, rev: #{rev}
if (message) if (message)
text(x=20, y=80, font-size=18, fill=color) #{message} text(x=20, y=95, font-size=18, fill=color) #{message}

@ -61,7 +61,7 @@ namespace MicroBuildServer.DotNetBuilder
private string GetLine(string format, params object[] args) private string GetLine(string format, params object[] args)
{ {
var result = new string('\t', indent) + string.Format(format, args); var result = new string('\t', indent) + string.Format(format, args);
Console.WriteLine(result); //Console.WriteLine(result);
return result; return result;
} }
} }
@ -85,10 +85,6 @@ namespace MicroBuildServer.DotNetBuilder
var buildResult = BuildManager.DefaultBuildManager.Build(parameters, buildRequest); var buildResult = BuildManager.DefaultBuildManager.Build(parameters, buildRequest);
Console.WriteLine("BuildResult: {0}", buildResult.OverallResult);
Console.WriteLine("Targets built: {0}", string.Join(", ", buildResult.ResultsByTarget.Keys));
Console.WriteLine("Build items: {0}", string.Join(", ", buildResult.ResultsByTarget["Build"].Items.Select(x => x.ItemSpec)));
return new Response return new Response
{ {
Messages = logger.Messages.Select(x => new Response.Message {Type = x.Item1, Body = x.Item2}).ToArray(), Messages = logger.Messages.Select(x => new Response.Message {Type = x.Item1, Body = x.Item2}).ToArray(),

Loading…
Cancel
Save