Migrated to .NET 6.0

- Switched to file-scoped namespaces
- Enabled Implicit Usings and Nullable

Kernal was migrated too but is unusable, at the moment. Stick with developing or testing from the terminal emulator.
This commit is contained in:
Tony Bark 2021-11-22 17:48:50 -05:00
parent 4f0863f429
commit bdbd8572ea
19 changed files with 233 additions and 264 deletions

View file

@ -13,7 +13,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
dotnet: ["3.1.x", "5.0.x"]
dotnet: ["6.0.x"]
os: [windows-latest, ubuntu-latest, macOS-latest]
steps:

View file

@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tomas.Kernel", "Tomas.Kernel\Tomas.Kernel.csproj", "{AF6338C3-342A-4A12-A25C-2D53C5568DA8}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tomas.Kernel", "Tomas.Kernel\Tomas.Kernel.csproj", "{AF6338C3-342A-4A12-A25C-2D53C5568DA8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tomas.Common", "Tomas.Common\Tomas.Common.csproj", "{C50F3A6F-CFF4-4725-A1A5-21C5A2BC3321}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tomas.Common", "Tomas.Common\Tomas.Common.csproj", "{C50F3A6F-CFF4-4725-A1A5-21C5A2BC3321}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{59C9B3FC-B1EE-4C23-9BD9-D33074BF1334}"
ProjectSection(SolutionItems) = preProject

View file

@ -1,7 +1,7 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
namespace Tomas.Common
{
namespace Tomas.Common;
public struct ComConsts
{
/// <summary>
@ -9,7 +9,6 @@ namespace Tomas.Common
/// </summary>
public const string NAME = "TOMAS";
public static string Version = $"{ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch}";
public static string VersionGit = $"{Version}-{ThisAssembly.Git.Commit}";
}
public const string Version = $"{ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch}";
public const string VersionGit = $"{Version}-{ThisAssembly.Git.Commit}";
}

View file

@ -1,8 +1,7 @@
using System;
using Tomas.Interface;
namespace Tomas.Common.Programs
{
namespace Tomas.Common.Programs;
public class Clear : IProgram
{
public bool Run(IShell shell)
@ -11,4 +10,3 @@ namespace Tomas.Common.Programs
return true;
}
}
}

View file

@ -1,8 +1,7 @@
using System;
using Tomas.Interface;
namespace Tomas.Common.Programs
{
namespace Tomas.Common.Programs;
public class Commands : IProgram
{
public bool Run(IShell shell)
@ -14,4 +13,3 @@ namespace Tomas.Common.Programs
return true;
}
}
}

View file

@ -1,11 +1,10 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using Tomas.Interface;
namespace Tomas.Common.Programs
{
namespace Tomas.Common.Programs;
public class FenSay : IProgram
{
@ -39,4 +38,3 @@ namespace Tomas.Common.Programs
return true;
}
}
}

View file

@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
@ -9,7 +11,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="GitInfo" Version="2.1.2">
<PackageReference Include="GitInfo" Version="2.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View file

@ -1,7 +1,7 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
namespace Tomas.Interface
{
namespace Tomas.Interface;
public interface IProgram
{
/// <summary>
@ -12,4 +12,3 @@ namespace Tomas.Interface
/// <returns>Exit back to shell.</returns>
bool Run(IShell shell);
}
}

View file

@ -1,14 +1,10 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
namespace Tomas.Interface;
using System.Collections.Generic;
namespace Tomas.Interface
{
public interface IShell
{
string ReadLine { get; }
Dictionary<string, IProgram> Programs { get; }
}
}

View file

@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

View file

@ -1,12 +1,10 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using Tomas.Common;
using Sys = Cosmos.System;
namespace Tomas.Kernel
{
namespace Tomas.Kernel;
public class Kernel : Sys.Kernel
{
protected override void BeforeRun()
@ -63,4 +61,3 @@ namespace Tomas.Kernel
Console.WriteLine($"{ComConsts.NAME} is shutting down.");
}
}
}

View file

@ -1,12 +1,10 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using Tomas.Common;
using Tomas.Interface;
namespace Tomas.Kernel.Programs
{
namespace Tomas.Kernel.Programs;
public class About : IProgram
{
public bool Run(IShell shell)
@ -20,4 +18,3 @@ namespace Tomas.Kernel.Programs
return true;
}
}
}

View file

@ -1,14 +1,12 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using Tomas.Common.Programs;
using Tomas.Interface;
using Tomas.Kernel.Programs;
using Sys = Cosmos.System;
namespace Tomas.Kernel
{
namespace Tomas.Kernel;
public class Shell : IShell
{
const char SYMBOL = '$';
@ -31,4 +29,3 @@ namespace Tomas.Kernel
}
}
}
}

View file

@ -1,12 +1,10 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using Cosmos.System.FileSystem;
using Cosmos.System.FileSystem.VFS;
namespace Tomas.Kernel
{
namespace Tomas.Kernel;
class TomFS
{
public const string ROOT_DIR = "0:\\";
@ -48,4 +46,3 @@ namespace Tomas.Kernel
}
}
}
}

View file

@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RuntimeIdentifier>cosmos</RuntimeIdentifier>
<SelfContained>True</SelfContained>
<BinFormat>ELF</BinFormat>

View file

@ -1,13 +1,7 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using Tomas.Terminal;
namespace Tomas.Terminal
{
class Program
{
static void Main()
{
while (true)
{
var shell = new Shell();
@ -23,6 +17,7 @@ namespace Tomas.Terminal
try
{
var start = program.Run(shell);
switch (start)
{
case true:
@ -37,6 +32,3 @@ namespace Tomas.Terminal
Console.WriteLine(err.Message);
}
}
}
}
}

View file

@ -4,15 +4,13 @@ using System;
using Tomas.Common;
using Tomas.Interface;
namespace Tomas.Terminal.Programs
{
namespace Tomas.Terminal.Programs;
public class About : IProgram
{
public bool Run(IShell shell)
{
Console.WriteLine($"{ComConsts.NAME} Terminal Emulator v{ComConsts.VersionGit}{Environment.NewLine}"
+ "TOMAS (Tony's Managed Operating System) is a operating system written in C# using the COSMOS framework.");
Console.WriteLine($"{ComConsts.NAME} (Tony's Managed Operating System) Terminal Emulator v{ComConsts.VersionGit}{Environment.NewLine}");
return true;
}
}
}

View file

@ -1,18 +1,16 @@
// I license this project under the GPL 3.0 license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using Tomas.Common.Programs;
using Tomas.Interface;
using Tomas.Terminal.Programs;
namespace Tomas.Terminal
{
namespace Tomas.Terminal;
public class Shell : IShell
{
const char SYMBOL = '$';
public Dictionary<string, IProgram> Programs => new Dictionary<string, IProgram>()
public Dictionary<string, IProgram> Programs => new()
{
{ "about", new About() },
{ "fensay", new FenSay() },
@ -26,8 +24,7 @@ namespace Tomas.Terminal
{
Console.Write(SYMBOL);
var readl = Console.ReadLine();
return readl;
}
return readl!;
}
}
}

View file

@ -2,9 +2,9 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>8</LangVersion>
<Nullable>warnings</Nullable>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>