Skip to content

Commit 4385190

Browse files
authored
Merge branch 'master' into master
2 parents bf7c84f + b0bb18e commit 4385190

148 files changed

Lines changed: 1863 additions & 2845 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Docs/articles/Installation/DevKit.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* (Free) source code of Devloppement Kit from [Cosmos on GitHub](https://github.com/CosmosOS/Cosmos)
55
* You must clone the repository using Git. For a detailed walkthrough, [see here](https://help.github.com/articles/fork-a-repo/).
66
* When following the tutorial, replace *OctoCat* with *CosmosOS* and *Spoon-Knife* with *Cosmos*.
7-
* (Free) [Visual Studio 2019 Community](https://visualstudio.microsoft.com/vs/)
7+
* (Free) [Visual Studio 2022 Community](https://visualstudio.microsoft.com/vs/)
88
* (Free) [InnoSetup QuickStart Kit](http://www.jrsoftware.org/isdl.php#qsp)
99
* This is required to build the setup kit which is used to build and install the Visual Studio integration libaries for Cosmos.
1010
* During install it will ask you about optional components to install. Be sure you check "Install Inno Setup Preprocessor".
@@ -20,11 +20,11 @@
2020

2121
### Installation on Windows
2222

23-
* Look in the downloaded sources and run **install-VS2019.bat** with admin privileges (UAC will ask for permission), needed for install in system directories.
23+
* Look in the downloaded sources and run **install-VS2022.bat** with admin privileges (UAC will ask for permission), needed for install in system directories.
2424
* When the installation is complete, Visual Studio will automatically open and you may begin programming with your new, modified copy of Cosmos.
2525

26-
## Arguments for the 'install-VS2019.bat' file
27-
The `install-VS2019.bat` accepts the following parameters :
26+
## Arguments for the 'install-VS2022.bat' file
27+
The `install-VS2022.bat` accepts the following parameters :
2828

2929
- `-USERKIT` Run installer for the User Kit only. By default installer build and install Dev Kit.
3030
- `-RESETHIVE` Reset Visual Studio Experimental Hive after installation.

Tests/Kernels/Cosmos.Compiler.Tests.Bcl.System/System/DoubleTest.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ public static void Execute()
223223
Assert.IsTrue(EqualityHelper.DoublesAreEqual(value, 2.3), "double TryParse returns correct result when it works");
224224

225225
#endregion
226+
227+
double doubleA = 3;
228+
double doubleB = 3;
229+
230+
Assert.IsTrue(doubleA % doubleB == 0, "Double: 3 % 3 should be equal to 0");
226231
}
227232
}
228233
}

Tests/Kernels/Cosmos.Compiler.Tests.Bcl/Kernel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ protected override void Run()
5252
// System.Text
5353
StringBuilderTest.Execute();
5454
EncodingTest.Execute();
55+
56+
GuidTest.Execute();
5557

5658
TestController.Completed();
5759
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using System;
2+
using System.Linq;
3+
using System.Threading.Tasks;
4+
using Cosmos.TestRunner;
5+
6+
namespace Cosmos.Compiler.Tests.Bcl.System
7+
{
8+
class GuidTest
9+
{
10+
11+
public static void Execute()
12+
{
13+
14+
//dont know how else to test this
15+
16+
Guid testGuid = Guid.NewGuid();
17+
Guid testGuid1 = Guid.NewGuid();
18+
19+
Assert.IsFalse((testGuid == Guid.Empty),"Guid was Empty");
20+
21+
Assert.IsFalse((testGuid == testGuid1), "Guid was not unique");
22+
23+
byte[] GuidRFC4122 = testGuid.ToByteArray();
24+
25+
Assert.IsTrue((GuidRFC4122.Length == 16), "invalid Length");
26+
27+
Assert.IsTrue((GuidRFC4122[6].ToString("X").StartsWith("4")), $"7th byte invalid (not 4 but '{GuidRFC4122[6].ToString("X")}')");
28+
29+
bool test9thbyte = false;
30+
31+
string byte8 = GuidRFC4122[8].ToString("X");
32+
if (byte8.StartsWith("8"))
33+
{
34+
test9thbyte = true;
35+
}
36+
else if (byte8.StartsWith("9"))
37+
{
38+
test9thbyte = true;
39+
}
40+
else if (byte8.StartsWith("A"))
41+
{
42+
test9thbyte = true;
43+
}
44+
else if (byte8.StartsWith("B"))
45+
{
46+
test9thbyte = true;
47+
}
48+
49+
Assert.IsTrue(test9thbyte, "9th byte invalid (not 8,9,A,B)");
50+
51+
}
52+
}
53+
}

Tests/Kernels/Cosmos.Kernel.Tests.Fat/System.IO/DirectoryTest.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ public static void Execute(Debugger mDebugger)
8787

8888
mDebugger.Send("");
8989

90+
mDebugger.Send("START TEST: Create Directory with a dot");
91+
var xDirectoryDot = Directory.CreateDirectory(@"0:\folder.system");
92+
Assert.IsTrue(xDirectoryDot != null, "Directory.CreateDirectory with dot failed: Directory is null");
93+
bool xDirExists = Directory.Exists(@"0:\folder.system");
94+
Assert.IsTrue(xDirExists, "Directory.CreateDirectory with dot failed: Directory doesn't exist after create call");
95+
mDebugger.Send("END TEST");
96+
97+
mDebugger.Send("");
98+
9099
mDebugger.Send("START TEST: Delete a directory:");
91100
Directory.CreateDirectory(@"0:\TestDir1");
92101
Assert.IsTrue(Directory.Exists(@"0:\TestDir1"), "TestDir1 wasn't created!");

Tests/Kernels/GraphicTest/Kernel.cs

Lines changed: 9 additions & 10 deletions
Large diffs are not rendered by default.

source/Cosmos.Build.Builder/ViewModels/MainWindowViewModel.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,12 @@ private async Task BuildAsync()
192192

193193
await buildTask.RunAsync(_logger).ConfigureAwait(false);
194194
}
195+
196+
Window.AllTasksCompleted = true;
197+
195198
if (CloseWhenCompleted)
196199
{
197-
Window.Close();
200+
Application.Current.Dispatcher.Invoke(() => Application.Current?.MainWindow?.Close());
198201
}
199202
}
200203
catch (Exception e)
@@ -207,7 +210,7 @@ private async Task BuildAsync()
207210

208211
if (CloseWhenCompleted)
209212
{
210-
System.Windows.Application.Current.Dispatcher.Invoke(() => System.Windows.Application.Current?.MainWindow?.Close());
213+
Application.Current.Dispatcher.Invoke(() => Application.Current?.MainWindow?.Close());
211214
}
212215
else
213216
{

source/Cosmos.Build.Builder/Views/MainWindow.xaml.cs

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,58 @@
11
using System;
2+
using System.ComponentModel;
23
using System.Windows;
34
using System.Windows.Controls;
5+
using Wpf.Ui.Common;
46
using Wpf.Ui.Controls;
7+
using Clipboard = System.Windows.Clipboard;
58

69
namespace Cosmos.Build.Builder.Views
710
{
811
public partial class MainWindow : UiWindow
912
{
1013
public bool AppShutdown = true;
14+
15+
public bool AllTasksCompleted;
16+
1117
public MainWindow()
1218
{
1319
InitializeComponent();
14-
Loaded += (sender, args) =>
15-
{
16-
Wpf.Ui.Appearance.Watcher.Watch(this, Wpf.Ui.Appearance.BackgroundType.Mica, true);
17-
};
20+
21+
Loaded += (_, _) => Wpf.Ui.Appearance.Watcher.Watch(this);
1822
}
1923

2024
private void SectionTextCopyHandler(object sender, System.Windows.Input.MouseButtonEventArgs e)
2125
{
2226
Clipboard.SetText(((TextBlock)sender).Text);
2327
}
28+
29+
protected override void OnClosing(CancelEventArgs e)
30+
{
31+
base.OnClosing(e);
32+
33+
if (!AllTasksCompleted)
34+
{
35+
e.Cancel = true;
36+
37+
Wpf.Ui.Controls.MessageBox messageBox = new()
38+
{
39+
Content = "You're about to close the builder, however tasks are still running. Do you wish to continue?",
40+
SizeToContent = SizeToContent.Width,
41+
ButtonLeftAppearance = ControlAppearance.Secondary,
42+
ButtonLeftName = "Yes",
43+
ButtonRightAppearance = ControlAppearance.Primary,
44+
ButtonRightName = "No"
45+
};
46+
messageBox.ButtonLeftClick += (_, _) =>
47+
{
48+
messageBox.Close();
49+
Application.Current.Dispatcher.Invoke(() => Application.Current?.MainWindow?.Close());
50+
};
51+
messageBox.ButtonRightClick += (_, _) => messageBox.Close();
52+
messageBox.ShowDialog();
53+
}
54+
}
55+
2456
protected override void OnClosed(EventArgs e)
2557
{
2658
base.OnClosed(e);

source/Cosmos.Build.Tasks/Nasm.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ protected override string GenerateCommandLineCommands()
101101
}
102102

103103
/* Apply the optimization level that the user chose */
104-
xBuilder.AppendSwitch("-O" + OptimizationLevel);
105-
104+
if(!String.IsNullOrWhiteSpace(OptimizationLevel) && !String.IsNullOrWhiteSpace(OptimizationLevel))
105+
xBuilder.AppendSwitch($"-O{OptimizationLevel}");
106106

107107
xBuilder.AppendFileNameIfNotNull(InputFile);
108108

source/Cosmos.Build.Tasks/build/Cosmos.Build.targets

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
<RemoveBootDebugOutput Condition="'$(RemoveBootDebugOutput)' == ''">ELF</RemoveBootDebugOutput>
7474

7575
<OptimizationLevel Condition="'$(OptimizationLevel)' == ''">1</OptimizationLevel>
76-
7776
</PropertyGroup>
7877

7978
<PropertyGroup>
@@ -231,7 +230,7 @@
231230
OutputFormat="$(BinFormat)"
232231
ToolPath="$(NasmToolPath)"
233232
ToolExe="$(NasmToolExe)"
234-
OptimizationLevel="$(OptimizationLevel)" />
233+
OptimizationLevel="$(OptimizationLevel)"/>
235234

236235
</Target>
237236

0 commit comments

Comments
 (0)