diff --git a/Build.sln b/Build.sln index 29e1238aa..92296b156 100644 --- a/Build.sln +++ b/Build.sln @@ -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} diff --git a/IDE.sln b/IDE.sln index b68f11e87..ade63342f 100644 --- a/IDE.sln +++ b/IDE.sln @@ -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} diff --git a/Test.sln b/Test.sln index 3aa59cabe..b281d09c8 100644 --- a/Test.sln +++ b/Test.sln @@ -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} diff --git a/source/Cosmos.Build.MSBuild/.editorconfig b/source/Cosmos.Build.MSBuild/.editorconfig deleted file mode 100644 index 218e435eb..000000000 --- a/source/Cosmos.Build.MSBuild/.editorconfig +++ /dev/null @@ -1,7 +0,0 @@ -; 4-column space indentation - -[IL2CPU.cs] -indent_size = 2 - -[NAsm.cs] -indent_size = 2 diff --git a/source/Cosmos.Build.MSBuild/BaseToolTask.cs b/source/Cosmos.Build.MSBuild/BaseToolTask.cs deleted file mode 100644 index 2dc37a9a3..000000000 --- a/source/Cosmos.Build.MSBuild/BaseToolTask.cs +++ /dev/null @@ -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 - { - /// - /// Specifies if warning, error, info or message. - /// - public WriteType logType; - - /// - /// Description of the type (can be null). - /// - public string subcategory; - - /// - /// Message, Warning or Error code (can be null) - /// - public string code; - - /// - /// The help keyword for the host IDE (can be null). - /// - public string helpKeyword; - - /// - /// The path to the file causing the message (can be null). - /// - public string file; - - /// - /// The line in the file causing the message (set to zero if not available). - /// - public int lineNumber; - - /// - /// The column in the file causing the message (set to zero if not available). - /// - public int columnNumber; - - /// - /// The last line of a range of lines in the file causing the message (set to zero if not available). - /// - public int endLineNumber; - - /// - /// The last column of a range of columns in the file causing the message (set to zero if not available). - /// - public int endColumnNumber; - - /// - /// Importance of the message. (default is High) - /// - public MessageImportance importance; - - /// - /// The message string. - /// - public string message; - - /// - /// Optional arguments for formatting the message string. - /// - 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 errorReceived, Action 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 mErrors = new List(); - private List mOutput = new List(); - - 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; } - } -} diff --git a/source/Cosmos.Build.MSBuild/Cosmos.Build.MSBuild.csproj b/source/Cosmos.Build.MSBuild/Cosmos.Build.MSBuild.csproj deleted file mode 100644 index acc778e02..000000000 --- a/source/Cosmos.Build.MSBuild/Cosmos.Build.MSBuild.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net471 - win7-x86 - - - - - PreserveNewest - - - - - - - - - - - - - - - diff --git a/source/Cosmos.Build.MSBuild/Cosmos.targets b/source/Cosmos.Build.MSBuild/Cosmos.targets deleted file mode 100644 index f5688d318..000000000 --- a/source/Cosmos.Build.MSBuild/Cosmos.targets +++ /dev/null @@ -1,91 +0,0 @@ - - - - False - True - False - False - True - NULL - true - - - - $(AppData)\Cosmos User Kit - $(CosmosDir)\Build\Tools - $(CosmosDir)\Build\VSIP - $(BuildToolsDir)\Nasm\nasm.exe - AnyCPU - bin - $(VSIPDir)\Cosmos.Build.MSBuild.dll - $(CosmosDir)\Kernel - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/Cosmos.Build.MSBuild/ExtractMapFromElfFile.cs b/source/Cosmos.Build.MSBuild/ExtractMapFromElfFile.cs deleted file mode 100644 index 19a27dd9e..000000000 --- a/source/Cosmos.Build.MSBuild/ExtractMapFromElfFile.cs +++ /dev/null @@ -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 errorReceived, Action 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; - } - } -} diff --git a/source/Cosmos.Build.MSBuild/IL2CPU.cs b/source/Cosmos.Build.MSBuild/IL2CPU.cs deleted file mode 100644 index 8a1a86c95..000000000 --- a/source/Cosmos.Build.MSBuild/IL2CPU.cs +++ /dev/null @@ -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 args = new Dictionary - { - {"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 refs = - (from reference in References - where reference.MetadataNames.OfType().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; - } - } -} diff --git a/source/Cosmos.Build.MSBuild/Ld.cs b/source/Cosmos.Build.MSBuild/Ld.cs deleted file mode 100644 index 3b4dc27cc..000000000 --- a/source/Cosmos.Build.MSBuild/Ld.cs +++ /dev/null @@ -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); - } - } - } -} diff --git a/source/Cosmos.Build.MSBuild/MakeISO.cs b/source/Cosmos.Build.MSBuild/MakeISO.cs deleted file mode 100644 index 90a11121b..000000000 --- a/source/Cosmos.Build.MSBuild/MakeISO.cs +++ /dev/null @@ -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; - } - } -} diff --git a/source/Cosmos.Build.MSBuild/NAsm.cs b/source/Cosmos.Build.MSBuild/NAsm.cs deleted file mode 100644 index 546991e84..000000000 --- a/source/Cosmos.Build.MSBuild/NAsm.cs +++ /dev/null @@ -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(); - } - } - } -} diff --git a/source/Cosmos.Build.MSBuild/NAsmTask.cs b/source/Cosmos.Build.MSBuild/NAsmTask.cs deleted file mode 100644 index 14d5e9b1d..000000000 --- a/source/Cosmos.Build.MSBuild/NAsmTask.cs +++ /dev/null @@ -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 LogError; - public Action 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; - } - } -} diff --git a/source/Cosmos.Build.MSBuild/ReadNAsmMapToDebugInfo.cs b/source/Cosmos.Build.MSBuild/ReadNAsmMapToDebugInfo.cs deleted file mode 100644 index 0b34020d7..000000000 --- a/source/Cosmos.Build.MSBuild/ReadNAsmMapToDebugInfo.cs +++ /dev/null @@ -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