Removed Cosmos.Build.MSBuild.

This commit is contained in:
José Pedro 2018-09-25 20:41:40 +01:00
parent 842e185328
commit 1175aa5594
No known key found for this signature in database
GPG key ID: B8247B9301707B83
15 changed files with 6 additions and 928 deletions

View file

@ -29,19 +29,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{CAF5EB
Cosmos.Common.ReadMe.html = Cosmos.Common.ReadMe.html
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Build.MSBuild", "source\Cosmos.Build.MSBuild\Cosmos.Build.MSBuild.csproj", "{BC6AE974-1F18-4A19-A956-5062E4D3FD53}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Debug.Common", "source\Cosmos.Debug.Common\Cosmos.Debug.Common.csproj", "{AB24E403-54F3-4F67-B5E0-119A7227AAC1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.VS.ProjectSystem", "source\Cosmos.VS.ProjectSystem\Cosmos.VS.ProjectSystem.csproj", "{12C1623C-1B28-46DF-A4B5-6B767A01ECF6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Debug.GDB", "source\Cosmos.Debug.GDB\Cosmos.Debug.GDB.csproj", "{3370FC04-B669-46A4-A4AA-A89540318F8D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Debug.GDB", "source\Cosmos.Debug.GDB\Cosmos.Debug.GDB.csproj", "{3370FC04-B669-46A4-A4AA-A89540318F8D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.VS.Windows", "source\Cosmos.VS.Windows\Cosmos.VS.Windows.csproj", "{47E8F3DC-FF3F-4CC7-8643-1807260B0B18}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Deploy.USB", "source\Cosmos.Deploy.USB\Cosmos.Deploy.USB.csproj", "{3D84CF8B-C6DF-4D78-8DE1-708582B43711}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Deploy.USB", "source\Cosmos.Deploy.USB\Cosmos.Deploy.USB.csproj", "{3D84CF8B-C6DF-4D78-8DE1-708582B43711}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Deploy.Pixie", "source\Cosmos.Deploy.Pixie\Cosmos.Deploy.Pixie.csproj", "{D4BA64B3-D7F6-4A3A-AF1D-74E41B49D865}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Deploy.Pixie", "source\Cosmos.Deploy.Pixie\Cosmos.Deploy.Pixie.csproj", "{D4BA64B3-D7F6-4A3A-AF1D-74E41B49D865}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2CPU", "..\IL2CPU\source\IL2CPU\IL2CPU.csproj", "{F3025446-D2C7-4FEA-AB03-C707F7B48B43}"
EndProject
@ -109,10 +107,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BC6AE974-1F18-4A19-A956-5062E4D3FD53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC6AE974-1F18-4A19-A956-5062E4D3FD53}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC6AE974-1F18-4A19-A956-5062E4D3FD53}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC6AE974-1F18-4A19-A956-5062E4D3FD53}.Release|Any CPU.Build.0 = Release|Any CPU
{AB24E403-54F3-4F67-B5E0-119A7227AAC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB24E403-54F3-4F67-B5E0-119A7227AAC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB24E403-54F3-4F67-B5E0-119A7227AAC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -259,7 +253,6 @@ Global
{22583FFE-B418-447E-ACE4-615950C5F373} = {4D3F3613-E112-4013-AB81-B8CCED78A555}
{056A94C1-6C75-4730-B62A-675779CD07FB} = {4D3F3613-E112-4013-AB81-B8CCED78A555}
{CAF5EB57-6CAD-446D-8FC7-4C03D4B996A6} = {4D3F3613-E112-4013-AB81-B8CCED78A555}
{BC6AE974-1F18-4A19-A956-5062E4D3FD53} = {D95021E1-A2C9-4829-819E-ED433AF13162}
{AB24E403-54F3-4F67-B5E0-119A7227AAC1} = {FF5BAFDE-AE9D-438D-935A-86B33EE0A758}
{12C1623C-1B28-46DF-A4B5-6B767A01ECF6} = {CD3F5E45-8B24-424F-ADF1-0211712F4CB7}
{3370FC04-B669-46A4-A4AA-A89540318F8D} = {FF5BAFDE-AE9D-438D-935A-86B33EE0A758}

17
IDE.sln
View file

@ -10,23 +10,21 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XSharp.Assembler", "..\XSha
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Build.Common", "source\Cosmos.Build.Common\Cosmos.Build.Common.csproj", "{F74A4B2B-02DA-455A-89FB-803A442B5B2C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Build.MSBuild", "source\Cosmos.Build.MSBuild\Cosmos.Build.MSBuild.csproj", "{DEA925C4-CE97-47ED-82F3-05587DC8A153}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Debug.Common", "source\Cosmos.Debug.Common\Cosmos.Debug.Common.csproj", "{A97A1EF7-AEEC-43F3-8CB0-5C7269DC7E85}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Debug.DebugConnectors", "source\Cosmos.Debug.DebugConnectors\Cosmos.Debug.DebugConnectors.csproj", "{BA661F30-9F3B-4356-B47B-D9C9375A473B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Core.DebugStub", "source\Cosmos.Core.DebugStub\Cosmos.Core.DebugStub.csproj", "{5049175E-F1EE-4D8F-8354-F547444B8F10}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Debug.GDB", "source\Cosmos.Debug.GDB\Cosmos.Debug.GDB.csproj", "{3370FC04-B669-46A4-A4AA-A89540318F8D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Debug.GDB", "source\Cosmos.Debug.GDB\Cosmos.Debug.GDB.csproj", "{3370FC04-B669-46A4-A4AA-A89540318F8D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Debug.Hosts", "source\Cosmos.Debug.Hosts\Cosmos.Debug.Hosts.csproj", "{C9826909-2E5E-4453-93FA-B6BE4503DF02}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2CPU.Debug.Symbols", "..\IL2CPU\source\IL2CPU.Debug.Symbols\IL2CPU.Debug.Symbols.csproj", "{ECC4319F-A844-45B8-BF63-2FD04F05E56A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Deploy.Pixie", "source\Cosmos.Deploy.Pixie\Cosmos.Deploy.Pixie.csproj", "{D4BA64B3-D7F6-4A3A-AF1D-74E41B49D865}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Deploy.Pixie", "source\Cosmos.Deploy.Pixie\Cosmos.Deploy.Pixie.csproj", "{D4BA64B3-D7F6-4A3A-AF1D-74E41B49D865}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Deploy.USB", "source\Cosmos.Deploy.USB\Cosmos.Deploy.USB.csproj", "{3D84CF8B-C6DF-4D78-8DE1-708582B43711}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Deploy.USB", "source\Cosmos.Deploy.USB\Cosmos.Deploy.USB.csproj", "{3D84CF8B-C6DF-4D78-8DE1-708582B43711}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Visual Studio", "Visual Studio", "{F0B09CE5-6AF5-453F-BEBE-E257108C65DC}"
EndProject
@ -76,14 +74,6 @@ Global
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Release|Any CPU.Build.0 = Release|Any CPU
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Release|x86.ActiveCfg = Release|Any CPU
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Release|x86.Build.0 = Release|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Debug|x86.ActiveCfg = Debug|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Debug|x86.Build.0 = Debug|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Release|Any CPU.Build.0 = Release|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Release|x86.ActiveCfg = Release|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Release|x86.Build.0 = Release|Any CPU
{A97A1EF7-AEEC-43F3-8CB0-5C7269DC7E85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A97A1EF7-AEEC-43F3-8CB0-5C7269DC7E85}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A97A1EF7-AEEC-43F3-8CB0-5C7269DC7E85}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -227,7 +217,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{0CDB3F6E-7971-426B-81F8-38B966A54C2B} = {AA3CAD10-7821-4B3A-85D3-13CB4F308CBF}
{F74A4B2B-02DA-455A-89FB-803A442B5B2C} = {AA3CAD10-7821-4B3A-85D3-13CB4F308CBF}
{DEA925C4-CE97-47ED-82F3-05587DC8A153} = {AA3CAD10-7821-4B3A-85D3-13CB4F308CBF}
{A97A1EF7-AEEC-43F3-8CB0-5C7269DC7E85} = {F7C6CA93-1D02-443C-9C8B-A1988DE0306B}
{BA661F30-9F3B-4356-B47B-D9C9375A473B} = {F7C6CA93-1D02-443C-9C8B-A1988DE0306B}
{5049175E-F1EE-4D8F-8354-F547444B8F10} = {F7C6CA93-1D02-443C-9C8B-A1988DE0306B}

View file

@ -16,8 +16,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XSharp.Assembler", "..\XSha
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Build.Common", "source\Cosmos.Build.Common\Cosmos.Build.Common.csproj", "{F74A4B2B-02DA-455A-89FB-803A442B5B2C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Build.MSBuild", "source\Cosmos.Build.MSBuild\Cosmos.Build.MSBuild.csproj", "{DEA925C4-CE97-47ED-82F3-05587DC8A153}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.IL2CPU", "..\IL2CPU\source\Cosmos.IL2CPU\Cosmos.IL2CPU.csproj", "{4F903492-CCA6-4FD9-A1B6-5E4CC0CE7767}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IL2CPU.API", "..\IL2CPU\source\IL2CPU.API\IL2CPU.API.csproj", "{34AEEB7C-FD5D-4B15-A830-B429681844BD}"
@ -196,14 +194,6 @@ Global
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Release|Any CPU.Build.0 = Release|Any CPU
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Release|x86.ActiveCfg = Release|Any CPU
{F74A4B2B-02DA-455A-89FB-803A442B5B2C}.Release|x86.Build.0 = Release|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Debug|x86.ActiveCfg = Debug|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Debug|x86.Build.0 = Debug|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Release|Any CPU.Build.0 = Release|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Release|x86.ActiveCfg = Release|Any CPU
{DEA925C4-CE97-47ED-82F3-05587DC8A153}.Release|x86.Build.0 = Release|Any CPU
{4F903492-CCA6-4FD9-A1B6-5E4CC0CE7767}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F903492-CCA6-4FD9-A1B6-5E4CC0CE7767}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F903492-CCA6-4FD9-A1B6-5E4CC0CE7767}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -676,7 +666,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{0CDB3F6E-7971-426B-81F8-38B966A54C2B} = {E9CD521E-C386-466D-B5F7-A5EB19A61625}
{F74A4B2B-02DA-455A-89FB-803A442B5B2C} = {DAEF99B5-22F0-4885-B45B-9B600B857E1C}
{DEA925C4-CE97-47ED-82F3-05587DC8A153} = {DAEF99B5-22F0-4885-B45B-9B600B857E1C}
{4F903492-CCA6-4FD9-A1B6-5E4CC0CE7767} = {C286932C-3F6D-47F0-BEEF-26843D1BB11B}
{34AEEB7C-FD5D-4B15-A830-B429681844BD} = {C286932C-3F6D-47F0-BEEF-26843D1BB11B}
{A97A1EF7-AEEC-43F3-8CB0-5C7269DC7E85} = {F7C6CA93-1D02-443C-9C8B-A1988DE0306B}

View file

@ -1,7 +0,0 @@
; 4-column space indentation
[IL2CPU.cs]
indent_size = 2
[NAsm.cs]
indent_size = 2

View file

@ -1,229 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Cosmos.Build.MSBuild
{
public enum WriteType
{
Warning,
Error,
Message, // only issued on console
Info
}
public class LogInfo
{
/// <summary>
/// Specifies if warning, error, info or message.
/// </summary>
public WriteType logType;
/// <summary>
/// Description of the type (can be null).
/// </summary>
public string subcategory;
/// <summary>
/// Message, Warning or Error code (can be null)
/// </summary>
public string code;
/// <summary>
/// The help keyword for the host IDE (can be null).
/// </summary>
public string helpKeyword;
/// <summary>
/// The path to the file causing the message (can be null).
/// </summary>
public string file;
/// <summary>
/// The line in the file causing the message (set to zero if not available).
/// </summary>
public int lineNumber;
/// <summary>
/// The column in the file causing the message (set to zero if not available).
/// </summary>
public int columnNumber;
/// <summary>
/// The last line of a range of lines in the file causing the message (set to zero if not available).
/// </summary>
public int endLineNumber;
/// <summary>
/// The last column of a range of columns in the file causing the message (set to zero if not available).
/// </summary>
public int endColumnNumber;
/// <summary>
/// Importance of the message. (default is High)
/// </summary>
public MessageImportance importance;
/// <summary>
/// The message string.
/// </summary>
public string message;
/// <summary>
/// Optional arguments for formatting the message string.
/// </summary>
public object[] messageArgs;//TODO check if null is allowed, if yes document it here
}
public abstract class BaseToolTask : Task
{
public static bool ExecuteTool(string workingDir, string filename, string arguments, string name, Action<string> errorReceived, Action<string> outputReceived)
{
var xProcessStartInfo = new ProcessStartInfo();
xProcessStartInfo.WorkingDirectory = workingDir;
xProcessStartInfo.FileName = filename;
xProcessStartInfo.Arguments = arguments;
xProcessStartInfo.UseShellExecute = false;
xProcessStartInfo.RedirectStandardOutput = true;
xProcessStartInfo.RedirectStandardError = true;
xProcessStartInfo.CreateNoWindow = true;
outputReceived(string.Format("Executing command line \"{0}\" {1}", filename, arguments));
outputReceived(string.Format("Working directory = '{0}'", workingDir));
using (var xProcess = new Process())
{
xProcess.ErrorDataReceived += delegate (object sender, DataReceivedEventArgs e)
{
if (e.Data != null)
{
errorReceived(e.Data);
}
};
xProcess.OutputDataReceived += delegate (object sender, DataReceivedEventArgs e)
{
if (e.Data != null)
{
outputReceived(e.Data);
}
};
xProcess.StartInfo = xProcessStartInfo;
xProcess.Start();
xProcess.BeginErrorReadLine();
xProcess.BeginOutputReadLine();
xProcess.WaitForExit(15 * 60 * 1000); // wait 15 minutes
if (!xProcess.HasExited)
{
xProcess.Kill();
errorReceived(String.Format("{0} timed out.", name));
return false;
}
else
{
if (xProcess.ExitCode != 0)
{
errorReceived(String.Format("Error occurred while invoking {0}.", name));
return false;
}
}
return true;
}
}
protected bool ExecuteTool(string workingDir, string filename, string arguments, string name)
{
var xResult = ExecuteTool(workingDir, filename, arguments, name, s => mErrors.Add(s), s => mOutput.Add(s));
LogInfo logContent;
for (int xIndex = 0; xIndex < mErrors.Count; xIndex++)
{
var xError = mErrors[xIndex];
if (ExtendLineError(xResult, xError, out logContent))
{
Logs(logContent);
}
}
for (int xIndex = 0; xIndex < mOutput.Count; xIndex++)
{
var xOutput = mOutput[xIndex];
if (ExtendLineOutput(xResult, xOutput, out logContent))
{
Logs(logContent);
}
}
return xResult;
}
private List<string> mErrors = new List<string>();
private List<string> mOutput = new List<string>();
public virtual bool ExtendLineError(bool hasErrored, string errorMessage, out LogInfo log)
{
log = new LogInfo();
log.logType = WriteType.Error;
log.message = errorMessage;
if (!hasErrored)
return false;
return true;
}
public virtual bool ExtendLineOutput(bool hasErrored, string errorMessage, out LogInfo log)
{
log = new LogInfo();
log.logType = WriteType.Info;
log.message = errorMessage;
return true;
}
public void Logs(LogInfo logInfo)// string message, string category, string filename, string lineNumber = 0, string columnNumber = 0)
{
switch (logInfo.logType)
{
case WriteType.Warning:
//Log.LogWarning(category, string.Empty, string.Empty, filename, lineNumber, columnNumber, lineNumber, columnNumber, message);
Log.LogWarning(logInfo.subcategory, logInfo.code, logInfo.helpKeyword, logInfo.file, logInfo.lineNumber, logInfo.columnNumber, logInfo.endLineNumber, logInfo.endColumnNumber, logInfo.message, logInfo.messageArgs);
break;
case WriteType.Message:
Log.LogMessage(logInfo.subcategory, logInfo.code, logInfo.helpKeyword, logInfo.file, logInfo.lineNumber, logInfo.columnNumber, logInfo.endLineNumber, logInfo.endColumnNumber, logInfo.message, logInfo.messageArgs);
break;
case WriteType.Info:
// changed IDEBuildLogger.cs for this behavior of add to ErrorList Messages
Log.LogMessage(logInfo.subcategory, logInfo.code, logInfo.helpKeyword, logInfo.file, logInfo.lineNumber, logInfo.columnNumber, logInfo.endLineNumber, logInfo.endColumnNumber, logInfo.importance, logInfo.message, logInfo.messageArgs);
break;
case WriteType.Error:
default:
if (UseConsoleForLog)
{
LogError(logInfo.message, logInfo.messageArgs);
}
else
{
Log.LogError(logInfo.subcategory, logInfo.code, logInfo.helpKeyword, logInfo.file, logInfo.lineNumber, logInfo.columnNumber, logInfo.endLineNumber, logInfo.endColumnNumber, logInfo.message ?? "", logInfo.messageArgs);
}
break;
}
}
protected void LogError(string message, params object[] args)
{
if (UseConsoleForLog)
{
if (message == null)
{
return;
}
Console.WriteLine("Error: " + String.Format(message, args));
}
else
{
Log.LogError(message, args);
}
}
public bool UseConsoleForLog { get; set; }
}
}

View file

@ -1,25 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net471</TargetFramework>
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<Content Include="Cosmos.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" Version="15.3.409" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="15.3.409" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.3.409" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cosmos.Build.Common\Cosmos.Build.Common.csproj" />
<ProjectReference Include="$(IL2CPURepoRoot)source\IL2CPU.Debug.Symbols\IL2CPU.Debug.Symbols.csproj" />
</ItemGroup>
</Project>

View file

@ -1,91 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CopyBuildOutputToOutputDirectory>False</CopyBuildOutputToOutputDirectory>
<DisableImplicitFrameworkReferences>True</DisableImplicitFrameworkReferences>
<ImplicitlyExpandDesignTimeFacades>False</ImplicitlyExpandDesignTimeFacades>
<ImplicitlyExpandNETStandardFacades>False</ImplicitlyExpandNETStandardFacades>
<DesignTimeBuild>True</DesignTimeBuild>
<ProjectAssetsFile>NULL</ProjectAssetsFile>
<NoStdLib>true</NoStdLib>
</PropertyGroup>
<PropertyGroup>
<CosmosDir Condition="$(CosmosDir) == ''">$(AppData)\Cosmos User Kit</CosmosDir>
<BuildToolsDir Condition="$(BuildToolsDir) == ''">$(CosmosDir)\Build\Tools</BuildToolsDir>
<VSIPDir Condition="$(VSIPDir) == ''">$(CosmosDir)\Build\VSIP</VSIPDir>
<NasmFile Condition="'$(NasmFile)' == ''">$(BuildToolsDir)\Nasm\nasm.exe</NasmFile>
<PlatformTarget Condition="'$(PlatformTarget)' == ''">AnyCPU</PlatformTarget>
<BinFormat Condition="$(BinFormat) == ''">bin</BinFormat>
<CosmosBuildTaskAssemblyFile Condition="'$(CosmosBuildTaskAssemblyFile)' == ''">$(VSIPDir)\Cosmos.Build.MSBuild.dll</CosmosBuildTaskAssemblyFile>
<AssemblySearchPaths>$(CosmosDir)\Kernel</AssemblySearchPaths>
<!--
<CosmosKernelAssembly>$(OutDir)$(TargetName)$(TargetExt)</CosmosKernelAssembly>
-->
</PropertyGroup>
<ItemGroup Condition="$(KernelPkg) == ''">
<Reference Include="Cosmos.Core_Asm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.Core_Plugs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.Debug.Kernel.Plugs.Asm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.System2_Plugs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Remove="System.Core" />
</ItemGroup>
<ItemGroup Condition="$(KernelPkg) == 'X86'">
<Reference Include="Cosmos.CPU.x86, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.CPU_Asm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.CPU_Plugs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.Debug.Kernel.Plugs.Asm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.Platform.PC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
<Reference Include="Cosmos.Plugs.TapRoot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983" />
</ItemGroup>
<UsingTask TaskName="TheRingMaster" AssemblyFile="$(CosmosBuildTaskAssemblyFile)"/>
<UsingTask TaskName="IL2CPU" AssemblyFile="$(CosmosBuildTaskAssemblyFile)"/>
<UsingTask TaskName="NAsm" AssemblyFile="$(CosmosBuildTaskAssemblyFile)"/>
<UsingTask TaskName="MakeISO" AssemblyFile="$(CosmosBuildTaskAssemblyFile)"/>
<UsingTask TaskName="Ld" AssemblyFile="$(CosmosBuildTaskAssemblyFile)"/>
<UsingTask TaskName="ReadNAsmMapToDebugInfo" AssemblyFile="$(CosmosBuildTaskAssemblyFile)"/>
<UsingTask TaskName="ExtractMapFromElfFile" AssemblyFile="$(CosmosBuildTaskAssemblyFile)"/>
<Target Name="CoreCompile">
<Error Text="The Release configuration isn't currently supported!" Condition="$(Configuration) == 'Release'" />
<Error Text="File %(Compile.Identity) is set to compile, but .Cosmos projects don't compile any source themselves!" Condition="$(Compile) != ''"/>
<CreateProperty Value="true" Condition="$(BinFormat) == 'elf'">
<Output PropertyName="IsELF" TaskParameter="Value"/>
</CreateProperty>
<CreateProperty Value="false" Condition="$(BinFormat) == 'bin'">
<Output PropertyName="IsELF" TaskParameter="Value"/>
</CreateProperty>
<!--
<CreateProperty Value="%(ReferencePath.Identity)" Condition="%(ReferencePath)">
<Output PropertyName="CosmosKernelAssembly" TaskParameter="Value"/>
</CreateProperty>
-->
<!--
<TheRingMaster AssemblyPath="$(CosmosKernelAssembly)" WorkingDir="$(TargetDir)" Condition="$(KernelPkg) == 'X86'" />
-->
<IL2CPU KernelPkg="$(KernelPkg)" DebugMode="$(DebugMode)" DebugEnabled="$(DebugEnabled)" StackCorruptionDetectionEnabled="$(StackCorruptionDetectionEnabled)" StackCorruptionDetectionLevel="$(StackCorruptionDetectionLevel)" TraceAssemblies="$(TraceAssemblies)" IgnoreDebugStubAttribute="$(IgnoreDebugStubAttribute)" DebugCom="1" References="@(ReferencePath)" AssemblySearchDirs="$(AssemblySearchPaths)" OutputFilename="$(TargetDir)$(MSBuildProjectName).asm" EnableLogging="true" EmitDebugSymbols="$(DebugSymbols)" CosmosBuildDir="$(CosmosDir)\Build" WorkingDir="$(TargetDir)"/>
<NAsm InputFile="$(TargetDir)$(MSBuildProjectName).asm" OutputFile="$(TargetDir)$(MSBuildProjectName).obj" IsELF="$(IsELF)" ExePath="$(NasmFile)"/>
<!-- ELF only -->
<!-- 16 MB 0x1000000 as per hpa (syslinux) is a good spot. For now just put some dummy values. 16 and 32 MB. Later size better. -->
<Ld CosmosBuildDir="$(CosmosDir)\Build" WorkingDir="$(TargetDir)" Arguments="-Ttext 0x2000000 -Tdata 0x1000000 -e Kernel_Start -o '$(TargetDir)$(MSBuildProjectName).bin' '$(TargetDir)$(MSBuildProjectName).obj'" Condition="$(IsELF) == 'true'"/>
<ExtractMapFromElfFile InputFile="$(TargetDir)$(MSBuildProjectName).bin" DebugInfoFile="$(TargetDir)$(MSBuildProjectName).cdb" WorkingDir="$(TargetDir)" CosmosBuildDir="$(CosmosDir)\Build" Condition="$(IsELF) == 'true'"/>
<CreateItem Include="$(TargetDir)$(MSBuildProjectName).bin" Condition="$(IsELF) == 'true'">
<Output TaskParameter="Include" ItemName="TempFilesToCopy"/>
</CreateItem>
<!--End of ELF only-->
<!--binary only-->
<ReadNAsmMapToDebugInfo InputBaseDir="$(TargetDir)" DebugInfoFile="$(TargetDir)$(MSBuildProjectName).cdb" Condition="$(IsELF) == 'false'"/>
<Move SourceFiles="$(TargetDir)$(MSBuildProjectName).obj" DestinationFiles="$(TargetDir)$(MSBuildProjectName).bin" Condition="$(IsELF) == 'false'"/>
<!--end of binary only-->
<!-- We dont build ISO in MSBuild any more because not all targets need it and it takes time. But we do delete it, so we dont have out of date outputs. -->
<!-- <MakeISO InputFile="$(TargetDir)$(MSBuildProjectName).bin" OutputFile="$(TargetDir)$(MSBuildProjectName).iso" CosmosBuildDir="$(CosmosDir)\Build" /> -->
<Delete Files="$(TargetDir)$(MSBuildProjectName).iso"/>
</Target>
<Target Name="CreateManifestResourceNames" />
</Project>

View file

@ -1,67 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
using IL2CPU.Debug.Symbols;
namespace Cosmos.Build.MSBuild {
public class ExtractMapFromElfFile : BaseToolTask {
[Required]
public string InputFile { get; set; }
[Required]
public string DebugInfoFile { get; set; }
[Required]
public string WorkingDir { get; set; }
[Required]
public string CosmosBuildDir { get; set; }
public override bool Execute()
{
var sw = Stopwatch.StartNew();
try
{
// Important! A given address can have more than one label.
// Do NOT filter by duplicate addresses as this causes serious lookup problems.
string xFile = RunObjDump(CosmosBuildDir, WorkingDir, InputFile, s => LogError(s), s => Log.LogMessage(s));
ObjDump.ExtractMapSymbolsForElfFile(DebugInfoFile, xFile);
return true;
}
catch (Exception E)
{
LogError("An error occurred: {0}", E.ToString());
return false;
}
finally
{
sw.Stop();
Log.LogMessage(MessageImportance.High, "Extracting Map file took {0}", sw.Elapsed);
}
}
public static string RunObjDump(string cosmosBuildDir, string workingDir, string inputFile, Action<string> errorReceived, Action<string> outputReceived) {
var xMapFile = Path.ChangeExtension(inputFile, "map");
File.Delete(xMapFile);
if (File.Exists(xMapFile)) {
throw new Exception("Could not delete " + xMapFile);
}
var xTempBatFile = Path.Combine(workingDir, "ExtractElfMap.bat");
File.WriteAllText(xTempBatFile, "@ECHO OFF\r\n\"" + Path.Combine(cosmosBuildDir, @"tools\cygwin\objdump.exe") + "\" --wide --syms \"" + inputFile + "\" > \"" + Path.GetFileName(xMapFile) + "\"");
var xResult = ExecuteTool(workingDir, xTempBatFile, "", "objdump", errorReceived, outputReceived);
if (!xResult) {
throw new Exception("Error extracting map from " + inputFile);
}
File.Delete(xTempBatFile);
return xMapFile;
}
}
}

View file

@ -1,125 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.Build.Framework;
namespace Cosmos.Build.MSBuild
{
public class IL2CPU : BaseToolTask
{
public string KernelPkg { get; set; }
[Required]
public string CosmosBuildDir { get; set; }
[Required]
public string WorkingDir { get; set; }
[Required]
public string DebugMode { get; set; }
public bool DebugEnabled { get; set; }
public bool StackCorruptionDetectionEnabled { get; set; }
public string StackCorruptionDetectionLevel { get; set; }
public string TraceAssemblies { get; set; }
public bool IgnoreDebugStubAttribute { get; set; }
public byte DebugCom { get; set; }
[Required]
public ITaskItem[] References { get; set; }
[Required]
public string OutputFilename { get; set; }
public bool EnableLogging { get; set; }
public bool EmitDebugSymbols { get; set; }
public string AssemblySearchDirs { get; set; }
protected void LogMessage(string aMsg)
{
Log.LogMessage(aMsg);
}
protected void LogInformation(string aMsg)
{
Log.LogMessage(MessageImportance.High, aMsg);
}
protected void LogWarning(string aMsg)
{
Log.LogWarning(aMsg);
}
protected void LogError(string aMsg)
{
Log.LogError(aMsg);
}
protected void LogException(Exception e)
{
Log.LogErrorFromException(e, true);
}
public override bool Execute()
{
var xSW = Stopwatch.StartNew();
try
{
Dictionary<string, string> args = new Dictionary<string, string>
{
{"KernelPkg", Convert.ToString(KernelPkg)},
{"DebugEnabled", Convert.ToString(DebugEnabled)},
{"StackCorruptionDetectionEnabled", Convert.ToString(StackCorruptionDetectionEnabled)},
{"StackCorruptionDetectionLevel", Convert.ToString(StackCorruptionDetectionLevel)},
{"DebugMode", Convert.ToString(DebugMode)},
{"TraceAssemblies", Convert.ToString(TraceAssemblies)},
{"DebugCom", Convert.ToString(DebugCom)},
{"OutputFilename", Convert.ToString(OutputFilename)},
{"EnableLogging", Convert.ToString(EnableLogging)},
{"EmitDebugSymbols", Convert.ToString(EmitDebugSymbols)},
{"IgnoreDebugStubAttribute", Convert.ToString(IgnoreDebugStubAttribute)}
};
List<string> refs =
(from reference in References
where reference.MetadataNames.OfType<string>().Contains("FullPath")
select reference.GetMetadata("FullPath")
into xFile
select Convert.ToString(xFile)).ToList();
string Arguments = args.Aggregate("", (current, arg) => current + "\"" + arg.Key + ":" + arg.Value + "\" ");
Arguments = refs.Aggregate(Arguments, (current, Ref) => current + "\"References:" + Ref + "\" ");
Arguments = AssemblySearchDirs.Split(';').Aggregate(Arguments, (current, Dir) => current + "\"AssemblySearchDirs:" + Dir + "\" ");
Log.LogMessage(MessageImportance.High, $"Invoking il2cpu.exe {Arguments}");
return ExecuteTool(WorkingDir, Path.Combine(CosmosBuildDir, @"IL2CPU\IL2CPU.exe"), Arguments, "IL2CPU");
}
finally
{
xSW.Stop();
Log.LogMessage(MessageImportance.High, $"IL2CPU invoked with DebugMode='{DebugMode}', DebugEnabled='{DebugEnabled}',StackCorruptionDetectionLevel='{StackCorruptionDetectionLevel ?? "{NULL}"}', TraceAssemblies='{TraceAssemblies ?? "{NULL}"}', IgnoreDebugStub='{IgnoreDebugStubAttribute}'");
Log.LogMessage(MessageImportance.High, "IL2CPU task took {0}", xSW.Elapsed);
}
}
public override bool ExtendLineError(bool hasErrored, string errorMessage, out LogInfo log)
{
log = new LogInfo
{
logType = WriteType.Error,
message = errorMessage
};
return true;
}
}
}

View file

@ -1,47 +0,0 @@
using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
namespace Cosmos.Build.MSBuild
{
public class Ld: BaseToolTask
{
[Required]
public string CosmosBuildDir
{
get;
set;
}
[Required]
public string WorkingDir
{
get;
set;
}
[Required]
public string Arguments
{
get;
set;
}
public override bool Execute()
{
var xSW = Stopwatch.StartNew();
try
{
return base.ExecuteTool(WorkingDir,
Path.Combine(CosmosBuildDir, @"tools\cygwin\ld.exe"),
Arguments.Replace('\\', '/'),
"ld");
}
finally
{
xSW.Stop();
Log.LogMessage(MessageImportance.High, "Ld task took {0}", xSW.Elapsed);
}
}
}
}

View file

@ -1,33 +0,0 @@
using Microsoft.Build.Framework;
using Cosmos.Build.Common;
namespace Cosmos.Build.MSBuild {
public class MakeISO : BaseToolTask {
#region Properties
[Required]
public string InputFile {
get;
set;
}
[Required]
public string OutputFile {
get;
set;
}
[Required]
public string CosmosBuildDir {
get;
set;
}
#endregion
public override bool Execute() {
IsoMaker.Generate(InputFile, OutputFile);
return true;
}
}
}

View file

@ -1,87 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
namespace Cosmos.Build.MSBuild {
public class NAsm : BaseToolTask {
#region Property
[Required]
public string InputFile {
get;
set;
}
[Required]
public string OutputFile {
get;
set;
}
public bool IsELF {
get;
set;
}
[Required]
public string ExePath {
get;
set;
}
#endregion
private bool DoExecute()
{
var xNasmTask = new NAsmTask();
xNasmTask.InputFile = InputFile;
xNasmTask.OutputFile = OutputFile;
xNasmTask.IsELF = IsELF;
xNasmTask.ExePath = ExePath;
xNasmTask.LogMessage = s => Log.LogMessage(s);
xNasmTask.LogError = s => Log.LogError(s);
return xNasmTask.Execute();
}
public override bool Execute()
{
var xSW = Stopwatch.StartNew();
try
{
return DoExecute();
}
finally
{
xSW.Stop();
Log.LogMessage(MessageImportance.High, "NAsm task took {0}", xSW.Elapsed);
}
}
public override bool ExtendLineError(bool hasErrored, string errorMessage, out LogInfo log) {
log = new LogInfo();
try {
if (errorMessage.StartsWith(InputFile)) {
int IndexFile = errorMessage.LastIndexOf('\\', InputFile.Length);
log.file = errorMessage.Substring(IndexFile + 1, InputFile.Length - IndexFile - 1);
string[] split = errorMessage.Substring(InputFile.Length).Split(':');
if (split.Length > 3 && split[2].Contains("warning"))
log.logType = WriteType.Warning;
else
log.logType = WriteType.Error;
log.lineNumber = int.Parse(split[1]);
log.message = (split.Length == 4 ? split[3].TrimStart(' ') : string.Empty) + " Code: " + GetLine(InputFile, log.lineNumber).Trim();
}
} catch (Exception) {
}
return true;
}
private static string GetLine(string fileName, int line) {
using (var sr = new StreamReader(File.OpenRead(fileName))) {
for (int i = 1; i < line; i++)
sr.ReadLine();
return sr.ReadLine();
}
}
}
}

View file

@ -1,44 +0,0 @@
using System;
using System.IO;
namespace Cosmos.Build.MSBuild
{
public class NAsmTask
{
public string InputFile;
public string OutputFile;
public string ExePath;
public bool IsELF;
public Action<string> LogError;
public Action<string> LogMessage;
public bool Execute()
{
if (File.Exists(OutputFile))
{
File.Delete(OutputFile);
}
if (!File.Exists(InputFile))
{
LogError("Input file \"" + InputFile + "\" does not exist!");
return false;
}
else if (!File.Exists(ExePath))
{
LogError("Exe file not found! (File = \"" + ExePath + "\")");
return false;
}
var xFormat = IsELF ? "elf" : "bin";
var xResult = BaseToolTask.ExecuteTool(Path.GetDirectoryName(OutputFile), ExePath,
String.Format("-g -f {0} -o \"{1}\" -D{3}_COMPILATION -O0 \"{2}\"", xFormat, Path.Combine(Directory.GetCurrentDirectory(), OutputFile), Path.Combine(Directory.GetCurrentDirectory(), InputFile), xFormat.ToUpper()),
"NAsm", LogError, LogMessage);
if (xResult)
{
LogMessage(String.Format("{0} -> {1}", InputFile, OutputFile));
}
return true;
}
}
}

View file

@ -1,102 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using Microsoft.Build.Framework;
using IL2CPU.Debug.Symbols;
namespace Cosmos.Build.MSBuild
{
public class ReadNAsmMapToDebugInfo : BaseToolTask
{
[Required]
public string InputBaseDir { get; set; }
[Required]
public string DebugInfoFile { get; set; }
public override bool Execute()
{
var xSW = new Stopwatch();
xSW.Start();
try
{
var xSourceInfos = ParseMapFile(InputBaseDir);
if (xSourceInfos.Count == 0)
{
Log.LogError("No SourceInfos found!");
return false;
}
using (var xDebugInfo = new DebugInfo(DebugInfoFile))
{
xDebugInfo.AddLabels(xSourceInfos);
xDebugInfo.CreateIndexes();
}
return true;
}
catch (Exception ex)
{
Log.LogErrorFromException(ex, true, true, null);
return false;
}
finally
{
xSW.Stop();
Log.LogMessage(MessageImportance.High, "ReadNAsmMapToDebugInfo took {0}", xSW.Elapsed);
}
}
private static List<Label> ParseMapFile(string inputBaseDir)
{
var xSourceStrings = File.ReadAllLines(Path.Combine(inputBaseDir, "main.map"));
var xSource = new List<Label>();
uint xIndex = 0;
DebugInfo.SetRange(DebugInfo.NAsmMapExtractionRange);
for (xIndex = 0; xIndex < xSourceStrings.Length; xIndex++)
{
if (xSourceStrings[xIndex].StartsWith("Real "))
{
// further check it:
//Virtual Name"))
if (!xSourceStrings[xIndex].Substring(4).TrimStart().StartsWith("Virtual ")
|| !xSourceStrings[xIndex].EndsWith(" Name"))
{
continue;
}
xIndex++;
break;
}
}
for (; xIndex < xSourceStrings.Length; xIndex++)
{
string xLine = xSourceStrings[xIndex];
var xLineParts = xLine.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
if (xLineParts.Length == 3)
{
uint xAddress = UInt32.Parse(xLineParts[0], NumberStyles.HexNumber);
long xId;
if (xLineParts[2].StartsWith("GUID_"))
{
xId = long.Parse(xLineParts[2].Substring(5));
}
else
{
xId = DebugInfo.CreateId();
}
xSource.Add(new Label()
{
ID = xId,
Name = xLineParts[2],
Address = xAddress
});
}
}
return xSource;
}
}
}

View file

@ -1,36 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
using Cosmos.Build.Common;
namespace Cosmos.Build.MSBuild
{
public class TheRingMaster : BaseToolTask
{
[Required]
public string KernelAssemblyPath { get; set; }
[Required]
public string WorkingDir { get; set; }
public override bool Execute()
{
var xSW = Stopwatch.StartNew();
try
{
Log.LogMessage(MessageImportance.High, $"Invoking TheRingMaster.exe {KernelAssemblyPath}");
return ExecuteTool(WorkingDir, Path.Combine(CosmosPaths.Build, "TheRingMaster", "TheRingMaster.exe"), KernelAssemblyPath, "The Ring Master");
}
finally
{
xSW.Stop();
Log.LogMessage(MessageImportance.High, $"TheRingMaster invoked with KernelAssemblyPath = '{KernelAssemblyPath}'");
Log.LogMessage(MessageImportance.High, "TheRingMaster task took {0}", xSW.Elapsed);
}
}
}
}