diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..1ff0c42
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1bc915c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,156 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+
+[Dd]ebug/
+[Rr]elease/
+x64/
+build/
+[Bb]in/
+[Oo]bj/
+
+# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
+!packages/*/build/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.log
+*.scc
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+*.ncrunch*
+.*crunch*.local.xml
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.Publish.xml
+
+# NuGet Packages Directory
+## TODO: If you have NuGet Package Restore enabled, uncomment the next line
+#packages/
+
+# Windows Azure Build Output
+csx
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Others
+sql/
+*.Cache
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.[Pp]ublish.xml
+*.pfx
+*.publishsettings
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+App_Data/*.mdf
+App_Data/*.ldf
+
+
+#LightSwitch generated files
+GeneratedArtifacts/
+_Pvt_Extensions/
+ModelManifest.xml
+
+# =========================
+# Windows detritus
+# =========================
+
+# Windows image file caches
+Thumbs.db
+ehthumbs.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Mac desktop service store files
+.DS_Store
diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config
new file mode 100644
index 0000000..67f8ea0
--- /dev/null
+++ b/.nuget/NuGet.Config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe
new file mode 100644
index 0000000..8f61340
Binary files /dev/null and b/.nuget/NuGet.exe differ
diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets
new file mode 100644
index 0000000..83fe906
--- /dev/null
+++ b/.nuget/NuGet.targets
@@ -0,0 +1,136 @@
+
+
+
+ $(MSBuildProjectDirectory)\..\
+
+
+ false
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+ $([System.IO.Path]::Combine($(SolutionDir), ".nuget"))
+ $([System.IO.Path]::Combine($(ProjectDir), "packages.config"))
+
+
+
+
+ $(SolutionDir).nuget
+ packages.config
+
+
+
+
+ $(NuGetToolsPath)\NuGet.exe
+ @(PackageSource)
+
+ "$(NuGetExePath)"
+ mono --runtime=v4.0.30319 $(NuGetExePath)
+
+ $(TargetDir.Trim('\\'))
+
+ -RequireConsent
+ -NonInteractive
+
+ "$(SolutionDir) "
+ "$(SolutionDir)"
+
+
+ $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)
+ $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols
+
+
+
+ RestorePackages;
+ $(BuildDependsOn);
+
+
+
+
+ $(BuildDependsOn);
+ BuildPackage;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BuildServer/lib/builder.js b/BuildServer/lib/builder.js
index 6ffb88e..e471900 100644
--- a/BuildServer/lib/builder.js
+++ b/BuildServer/lib/builder.js
@@ -59,7 +59,11 @@ var build = function (options, callback) {
return done(err, "MBSMalformed");
}
- processor.processTask(task, function (err, result) {
+ processor.processTask(task, {
+ tmp: tmp,
+ exported: exported,
+ release: release
+ }, function (err, result) {
if (err) {
return done(err, result);
}
diff --git a/BuildServer/lib/task-processor.js b/BuildServer/lib/task-processor.js
index 9191279..831cf56 100644
--- a/BuildServer/lib/task-processor.js
+++ b/BuildServer/lib/task-processor.js
@@ -40,9 +40,10 @@ var TaskProcessor = function (task, outerProcessor, callback) {
self.onInfo = onInfo;
self.processTask = processTask;
self.done = done;
+ self.context = outerProcessor.context;
};
-exports.processTask = function (task, callback) {
+exports.processTask = function (task, context, callback) {
var errors = {},
warns = {},
infos = {},
@@ -66,7 +67,8 @@ exports.processTask = function (task, callback) {
processor = new TaskProcessor(task, {
onError: messageProcessor(errors),
onWarn: messageProcessor(warns),
- onInfo: messageProcessor(infos)
+ onInfo: messageProcessor(infos),
+ context: context
}, function (err) {
callback(err, {
errors: errors,
diff --git a/BuildServer/lib/tasks/dotnetbuild.js b/BuildServer/lib/tasks/dotnetbuild.js
new file mode 100644
index 0000000..b3b6bb6
--- /dev/null
+++ b/BuildServer/lib/tasks/dotnetbuild.js
@@ -0,0 +1,49 @@
+"use strict";
+
+var spawn = require('child_process').spawn;
+
+module.exports = function (params, processor) {
+ return {
+ process: function () {
+ var result = "",
+ error = "",
+ builder = spawn("../DotNetBuilder/bin/Debug/DotNetBuilder.exe");
+
+ wrapper.stdout.on('data', function (data) {
+ result += data;
+ });
+ wrapper.stderr.on('data', function (data) {
+ error += data;
+ });
+ wrapper.on('exit', function (code) {
+ if (code !== 0) {
+ error = "Return code is " + code + "\r\n" + error;
+ processor.onError(error);
+ return done();
+ }
+
+ var report = JSON.parse(result);
+ foreach (var i = 0; i < report.length; i++) {
+ switch(report[i].Type) {
+ case "info":
+ processor.onError(report[i].Body);
+ break;
+ case "warn":
+ processor.onError(report[i].Body);
+ break;
+ default:
+ processor.onError(report[i].Body);
+ break;
+ }
+ }
+ return done();
+ });
+
+ wrapper.stdin.write({
+ "SolutionPath": process.context.exported + "/" + params.solution,
+ "OutputPath": process.context.release + "/" + params.solution + "/"
+ });
+ wrapper.stdin.end();
+ }
+ };
+};
diff --git a/DotNetBuilder/CompileRequest.cs b/DotNetBuilder/CompileRequest.cs
new file mode 100644
index 0000000..ac97735
--- /dev/null
+++ b/DotNetBuilder/CompileRequest.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MicroBuildServer.DotNetBuilder
+{
+ class CompileRequest
+ {
+ public string SolutionPath { get; set; }
+
+ public string OutputPath { get; set; }
+ }
+}
diff --git a/DotNetBuilder/Compiler.cs b/DotNetBuilder/Compiler.cs
new file mode 100644
index 0000000..842e5b8
--- /dev/null
+++ b/DotNetBuilder/Compiler.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Build.Evaluation;
+using Microsoft.Build.Execution;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace MicroBuildServer.DotNetBuilder
+{
+ static class Compiler
+ {
+ private class CompilerLogger : Logger
+ {
+ public readonly IList> Messages = new List>();
+
+ private int indent = 0;
+
+ public override void Initialize(IEventSource eventSource)
+ {
+ if (eventSource == null)
+ {
+ throw new ArgumentNullException("eventSource");
+ }
+ eventSource.ProjectStarted += OnProjectStarted;
+ eventSource.ProjectFinished += OnProjectFinished;
+ eventSource.ErrorRaised += OnError;
+ eventSource.WarningRaised += OnWarning;
+ eventSource.MessageRaised += OnMessage;
+ }
+
+ private void OnProjectStarted(object sender, ProjectStartedEventArgs e)
+ {
+ Messages.Add(Tuple.Create("info", GetLine("Started {0}", e.ProjectFile)));
+ indent++;
+ }
+
+ private void OnProjectFinished(object sender, ProjectFinishedEventArgs e)
+ {
+ indent--;
+ Messages.Add(Tuple.Create("info", GetLine("Finished {0}", e.ProjectFile)));
+ }
+
+ private void OnError(object sender, BuildErrorEventArgs e)
+ {
+ Messages.Add(Tuple.Create("error", GetLine("{0} ({1}:{2},{3})", e.Message, e.File, e.LineNumber, e.ColumnNumber)));
+ }
+
+ private void OnWarning(object sender, BuildWarningEventArgs e)
+ {
+ Messages.Add(Tuple.Create("warn", GetLine("{0} ({1}:{2},{3})", e.Message, e.File, e.LineNumber, e.ColumnNumber)));
+ }
+
+ private void OnMessage(object sender, BuildMessageEventArgs e)
+ {
+ if (e.Importance != MessageImportance.High) return;
+ Messages.Add(Tuple.Create("info", GetLine("{0}: {1}", e.Importance, e.Message)));
+ }
+
+ private string GetLine(string format, params object[] args)
+ {
+ var result = new string('\t', indent) + string.Format(format, args);
+ Console.WriteLine(result);
+ return result;
+ }
+ }
+
+ public static Response Compile(CompileRequest request)
+ {
+ var logger = new CompilerLogger();
+ logger.Verbosity = LoggerVerbosity.Normal;
+
+ var pc = new ProjectCollection();
+ var globalProperty = new Dictionary();
+ globalProperty.Add("Configuration", "Release");
+ globalProperty.Add("Platform", "Any CPU");
+ globalProperty.Add("OutputPath", request.OutputPath);
+
+ var buildRequest = new BuildRequestData(request.SolutionPath, globalProperty, null, new string[] { "Build" }, null);
+
+ var parameters = new BuildParameters(pc);
+ parameters.Loggers = new ILogger[] { logger };
+ parameters.DetailedSummary = true;
+
+ 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
+ {
+ Messages = logger.Messages.Select(x => new Response.Message {Type = x.Item1, Body = x.Item2}).ToArray(),
+ };
+ }
+ }
+}
diff --git a/DotNetBuilder/MicroBuildServer.DotNetBuilder.csproj b/DotNetBuilder/MicroBuildServer.DotNetBuilder.csproj
new file mode 100644
index 0000000..1922560
--- /dev/null
+++ b/DotNetBuilder/MicroBuildServer.DotNetBuilder.csproj
@@ -0,0 +1,71 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {4C4701DD-780A-41D3-887B-E63722A5BF3F}
+ Exe
+ Properties
+ MicroBuildServer.DotNetBuilder
+ MicroBuildServer.DotNetBuilder
+ v4.0
+ 512
+ ..\
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+ ..\packages\Newtonsoft.Json.5.0.8\lib\net40\Newtonsoft.Json.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DotNetBuilder/Program.cs b/DotNetBuilder/Program.cs
new file mode 100644
index 0000000..73d2953
--- /dev/null
+++ b/DotNetBuilder/Program.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Newtonsoft.Json;
+
+namespace MicroBuildServer.DotNetBuilder
+{
+ class Program
+ {
+ private static Response Test(TestRequest request)
+ {
+ throw new NotImplementedException();
+ }
+
+ private static Response Process(string input, string[] args)
+ {
+ try
+ {
+ switch (args[0])
+ {
+ case "compile":
+ return Compiler.Compile(JsonConvert.DeserializeObject(input));
+ case "test":
+ return Test(JsonConvert.DeserializeObject(input));
+ default:
+ throw new ApplicationException("Unsupported type '" + args[0] + "'");
+ }
+ }
+ catch (Exception e)
+ {
+ return new Response { Messages = new[] { new Response.Message { Type = "error", Body = e.ToString() } } };
+ }
+ }
+
+ static void Main(string[] args)
+ {
+ var input = Console.In.ReadToEnd();
+ var result = Process(input, args);
+ Console.Write(JsonConvert.SerializeObject(result));
+ }
+ }
+}
diff --git a/DotNetBuilder/Properties/AssemblyInfo.cs b/DotNetBuilder/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..dd66975
--- /dev/null
+++ b/DotNetBuilder/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MicroBuildServer.DotNetBuilder")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MicroBuildServer.DotNetBuilder")]
+[assembly: AssemblyCopyright("Copyright © 2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("12ea6c47-e938-46b2-a4bf-8ba3c9f99109")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/DotNetBuilder/Response.cs b/DotNetBuilder/Response.cs
new file mode 100644
index 0000000..ef7f48b
--- /dev/null
+++ b/DotNetBuilder/Response.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MicroBuildServer.DotNetBuilder
+{
+ class Response
+ {
+ public class Message
+ {
+ public string Type { get; set; }
+ public string Body { get; set; }
+ }
+
+ public Message[] Messages { get; set; }
+ }
+}
diff --git a/DotNetBuilder/TestRequest.cs b/DotNetBuilder/TestRequest.cs
new file mode 100644
index 0000000..faa0527
--- /dev/null
+++ b/DotNetBuilder/TestRequest.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MicroBuildServer.DotNetBuilder
+{
+ class TestRequest
+ {
+ public string CodebasePath { get; set; }
+
+ public string TestLibraryName { get; set; }
+ }
+}
diff --git a/DotNetBuilder/packages.config b/DotNetBuilder/packages.config
new file mode 100644
index 0000000..b47d3a3
--- /dev/null
+++ b/DotNetBuilder/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/MicroBuildServer.sln b/MicroBuildServer.sln
new file mode 100644
index 0000000..c604b7b
--- /dev/null
+++ b/MicroBuildServer.sln
@@ -0,0 +1,27 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroBuildServer.DotNetBuilder", "DotNetBuilder\MicroBuildServer.DotNetBuilder.csproj", "{4C4701DD-780A-41D3-887B-E63722A5BF3F}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{8D215D35-3FD7-468E-A202-E849C43ED1A8}"
+ ProjectSection(SolutionItems) = preProject
+ .nuget\NuGet.Config = .nuget\NuGet.Config
+ .nuget\NuGet.exe = .nuget\NuGet.exe
+ .nuget\NuGet.targets = .nuget\NuGet.targets
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4C4701DD-780A-41D3-887B-E63722A5BF3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4C4701DD-780A-41D3-887B-E63722A5BF3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4C4701DD-780A-41D3-887B-E63722A5BF3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4C4701DD-780A-41D3-887B-E63722A5BF3F}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/packages/.gitignore b/packages/.gitignore
new file mode 100644
index 0000000..0323849
--- /dev/null
+++ b/packages/.gitignore
@@ -0,0 +1,3 @@
+*
+!repositories.config
+!.gitignore
diff --git a/packages/repositories.config b/packages/repositories.config
new file mode 100644
index 0000000..2330a3e
--- /dev/null
+++ b/packages/repositories.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file