mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
This commit is contained in:
parent
17d32631a1
commit
6ec3bbe2ad
5 changed files with 81 additions and 51 deletions
|
|
@ -7,24 +7,24 @@ using System.IO;
|
||||||
|
|
||||||
namespace Cosmos.Build.Builder {
|
namespace Cosmos.Build.Builder {
|
||||||
public class CosmosTask : Task {
|
public class CosmosTask : Task {
|
||||||
|
protected string mCosmosPath;
|
||||||
|
|
||||||
public void Run(string aCosmosPath) {
|
public CosmosTask(string aCosmosPath) {
|
||||||
string xOutputPath = aCosmosPath + @"\Build\VSIP";
|
mCosmosPath = aCosmosPath;
|
||||||
|
}
|
||||||
|
|
||||||
EchoOff();
|
protected override void DoRun() {
|
||||||
|
string xOutputPath = mCosmosPath + @"\Build\VSIP";
|
||||||
|
|
||||||
Echo("Compiling Cosmos");
|
Section("Compiling Cosmos");
|
||||||
|
StartConsole(Paths.Windows + @"\Microsoft.NET\Framework\v4.0.30319\msbuild.exe", mCosmosPath + @"\source\Cosmos.sln /maxcpucount /verbosity:normal /nologo /p:Configuration=Bootstrap /p:Platform=x86 /p:OutputPath=" + Quoted(xOutputPath));
|
||||||
CD(aCosmosPath + @"\source");
|
|
||||||
Start(Paths.Windows + @"\Microsoft.NET\Framework\v4.0.30319\msbuild.exe", @"Cosmos.sln /maxcpucount /verbosity:normal /nologo /p:Configuration=Bootstrap /p:Platform=x86 /p:OutputPath=" + Quoted(xOutputPath));
|
|
||||||
//%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild Cosmos.sln /maxcpucount /verbosity:normal /nologo /p:Configuration=Bootstrap /p:Platform=x86 /p:OutputPath="%THE_OUTPUT_PATH%"
|
|
||||||
|
|
||||||
CD(xOutputPath);
|
CD(xOutputPath);
|
||||||
|
|
||||||
Echo("Copying files");
|
Section("Copying files");
|
||||||
// Copy templates
|
// Copy templates
|
||||||
// .iss does some of this as well.. why some here? And why is VB disabled in .iss?
|
// .iss does some of this as well.. why some here? And why is VB disabled in .iss?
|
||||||
SrcPath = aCosmosPath + @"source2\VSIP\Cosmos.VS.Package\obj\x86\Debug";
|
SrcPath = mCosmosPath + @"source2\VSIP\Cosmos.VS.Package\obj\x86\Debug";
|
||||||
Copy("CosmosProject (C#).zip");
|
Copy("CosmosProject (C#).zip");
|
||||||
Copy("CosmosKernel (C#).zip");
|
Copy("CosmosKernel (C#).zip");
|
||||||
Copy("CosmosProject (F#).zip");
|
Copy("CosmosProject (F#).zip");
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
<Window x:Class="Cosmos.Build.Builder.MainWindow"
|
<Window x:Class="Cosmos.Build.Builder.MainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
|
Title="MainWindow" Height="389" Width="564" Loaded="Window_Loaded">
|
||||||
<Grid>
|
<DockPanel>
|
||||||
|
<WrapPanel DockPanel.Dock="Top">
|
||||||
</Grid>
|
<Button Name="butnCopy" Click="butnCopy_Click">Copy</Button>
|
||||||
|
</WrapPanel>
|
||||||
|
<ScrollViewer>
|
||||||
|
<TextBlock Name="tblkLog" Text="" TextWrapping="Wrap"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
</DockPanel>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,38 @@ namespace Cosmos.Build.Builder {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected StringBuilder mClipboard = new StringBuilder();
|
||||||
|
|
||||||
public void Build() {
|
public void Build() {
|
||||||
var xTask = new CosmosTask();
|
var xTask = new CosmosTask(@"D:\source\Cosmos");
|
||||||
xTask.Run(@"D:\source\Cosmos");
|
xTask.Log.LogLine += new Installer.Log.LogLineHandler(Log_LogLine);
|
||||||
|
xTask.Log.LogSection += new Installer.Log.LogSectionHandler(Log_LogSection);
|
||||||
|
xTask.Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Log_LogSection(string aLine) {
|
||||||
|
mClipboard.AppendLine(aLine);
|
||||||
|
|
||||||
|
var xRun = new Run(aLine);
|
||||||
|
xRun.Background = Brushes.Red;
|
||||||
|
tblkLog.Inlines.Add(xRun);
|
||||||
|
tblkLog.Inlines.Add(new LineBreak());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Log_LogLine(string aLine) {
|
||||||
|
mClipboard.AppendLine(aLine);
|
||||||
|
|
||||||
|
tblkLog.Inlines.Add(aLine);
|
||||||
|
tblkLog.Inlines.Add(new LineBreak());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e) {
|
private void Window_Loaded(object sender, RoutedEventArgs e) {
|
||||||
Build();
|
Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void butnCopy_Click(object sender, RoutedEventArgs e) {
|
||||||
|
Clipboard.SetText(mClipboard.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,30 +5,22 @@ using System.Text;
|
||||||
|
|
||||||
namespace Cosmos.Build.Installer {
|
namespace Cosmos.Build.Installer {
|
||||||
public class Log {
|
public class Log {
|
||||||
public Log() {
|
public void WriteLine(string aText) {
|
||||||
mEchoing = true;
|
if (LogLine != null) {
|
||||||
|
LogLine(aText);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool mEchoing;
|
public void NewSection(string aText) {
|
||||||
public bool Echoing {
|
if (LogSection != null) {
|
||||||
get { return mEchoing; }
|
LogSection(aText);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Echo() {
|
public delegate void LogLineHandler(string aLine);
|
||||||
Echo("");
|
public event LogLineHandler LogLine;
|
||||||
}
|
|
||||||
|
|
||||||
public void Echo(string aText) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EchoOn() {
|
|
||||||
mEchoing = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EchoOff() {
|
|
||||||
mEchoing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public delegate void LogSectionHandler(string aLine);
|
||||||
|
public event LogSectionHandler LogSection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,28 +6,43 @@ using System.IO;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Cosmos.Build.Installer {
|
namespace Cosmos.Build.Installer {
|
||||||
public class Task {
|
public abstract class Task {
|
||||||
public void Start(string aEXE, string aParams) {
|
protected abstract void DoRun();
|
||||||
Start(aEXE, aParams, true);
|
|
||||||
|
public void Run() {
|
||||||
|
DoRun();
|
||||||
}
|
}
|
||||||
public void Start(string aExe, string aParams, bool aWait) {
|
|
||||||
|
public void StartConsole(string aExe, string aParams) {
|
||||||
var xStart = new ProcessStartInfo();
|
var xStart = new ProcessStartInfo();
|
||||||
xStart.FileName = aExe;
|
xStart.FileName = aExe;
|
||||||
xStart.WorkingDirectory = CurrPath;
|
xStart.WorkingDirectory = CurrPath;
|
||||||
xStart.Arguments = aParams;
|
xStart.Arguments = aParams;
|
||||||
xStart.UseShellExecute = false;
|
xStart.UseShellExecute = false;
|
||||||
|
xStart.CreateNoWindow = true;
|
||||||
xStart.RedirectStandardOutput = true;
|
xStart.RedirectStandardOutput = true;
|
||||||
//xStart.RedirectStandardError = true;
|
|
||||||
using (var xProcess = Process.Start(xStart)) {
|
using (var xProcess = Process.Start(xStart)) {
|
||||||
using (var xReader = xProcess.StandardOutput) {
|
using (var xReader = xProcess.StandardOutput) {
|
||||||
string xRresult = xReader.ReadToEnd();
|
string xLine;
|
||||||
|
while (true) {
|
||||||
|
xLine = xReader.ReadLine();
|
||||||
|
if (xLine == null) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
Log.WriteLine(xLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xProcess.WaitForExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Log mLog = new Log();
|
private Log mLog = new Log();
|
||||||
public Log Log { get { return mLog; } }
|
public Log Log { get { return mLog; } }
|
||||||
|
|
||||||
|
public void Section(string aText) {
|
||||||
|
Log.NewSection(aText);
|
||||||
|
}
|
||||||
|
|
||||||
public string CurrPath {
|
public string CurrPath {
|
||||||
get { return Directory.GetCurrentDirectory(); }
|
get { return Directory.GetCurrentDirectory(); }
|
||||||
set { Directory.SetCurrentDirectory(value); }
|
set { Directory.SetCurrentDirectory(value); }
|
||||||
|
|
@ -56,20 +71,14 @@ namespace Cosmos.Build.Installer {
|
||||||
Copy(aSrcPathname, Path.GetFileName(aSrcPathname));
|
Copy(aSrcPathname, Path.GetFileName(aSrcPathname));
|
||||||
}
|
}
|
||||||
public void Copy(string aSrcPathname, string aDestPathname) {
|
public void Copy(string aSrcPathname, string aDestPathname) {
|
||||||
File.Copy(Path.Combine(SrcPath, aSrcPathname), Path.Combine(CurrPath, aDestPathname));
|
File.Copy(Path.Combine(SrcPath, aSrcPathname), Path.Combine(CurrPath, aDestPathname), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Echo() {
|
public void Echo() {
|
||||||
mLog.Echo("");
|
mLog.WriteLine("");
|
||||||
}
|
}
|
||||||
public void Echo(string aText) {
|
public void Echo(string aText) {
|
||||||
mLog.Echo(aText);
|
mLog.WriteLine(aText);
|
||||||
}
|
|
||||||
public void EchoOn() {
|
|
||||||
mLog.EchoOn();
|
|
||||||
}
|
|
||||||
public void EchoOff() {
|
|
||||||
mLog.EchoOff();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue