Skip to content

Commit 9b87f52

Browse files
authored
Merge pull request #3718 from gui-cs/v2_develop
Merge v2_develop in to v2_release
2 parents 9825cb6 + f2e5310 commit 9b87f52

File tree

250 files changed

+22827
-13283
lines changed

Some content is hidden

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

250 files changed

+22827
-13283
lines changed

.github/workflows/dotnet-core.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- '**.md'
1212

1313
jobs:
14-
build_and_test:
14+
build_and_test_debug:
1515

1616
runs-on: ${{ matrix.os }}
1717
strategy:
@@ -23,7 +23,7 @@ jobs:
2323
timeout-minutes: 10
2424
steps:
2525

26-
# Build
26+
# Build (Debug)
2727

2828
- name: Checkout code
2929
uses: actions/checkout@v4
@@ -76,6 +76,24 @@ jobs:
7676
logs/
7777
UnitTests/TestResults/
7878
79+
80+
build_release:
81+
# Ensure that RELEASE builds are not broken
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v4
86+
87+
- name: Setup .NET Core
88+
uses: actions/setup-dotnet@v4
89+
with:
90+
dotnet-version: 8.x
91+
dotnet-quality: 'ga'
92+
93+
- name: Build Release
94+
run: dotnet build --configuration Release
95+
96+
7997
# Note: this step is currently not writing to the gist for some reason
8098
# - name: Create Test Coverage Badge
8199
# uses: simon-k/dotnet-code-coverage-badge@v1.0.0

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
run: |
4545
dotnet-gitversion /updateprojectfiles
4646
dotnet build --no-incremental --nologo --force --configuration Release
47+
dotnet test --configuration Release
4748
4849
- name: Pack
4950
run: dotnet pack -c Release --include-symbols -p:Version='${{ steps.gitversion.outputs.SemVer }}'

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ remote:
9090

9191
Follow the template instructions found on Github.
9292

93-
## Terminal.Gui Coding Style
93+
## Tenets for [gui-cs](www.github.com/gui-cs) Code Style (Unless you have better ones)
94+
95+
* **Six-Year-Old Reading Level** - Our code style is biased towards code readability and away from terseness. This is *Systems Software* and needs to stand the test of time. Code should be structured and use variable names that make it readable by a 6-year-old, and comments in code are encouraged.
96+
* **Consistency, Consistency, Consistency** - We adopt and document our standards for code style and then enforce them ruthlessly. For example, we require code reviews to pay attention to code style, not just functionality.
97+
* **Don't be Weird** - Like all developers we have opinions, but our opinions on code style are tempered by existing standards. We are biased towards code style that used by Microsoft and other leading dotnet developers. For example, we choose 4 spaces for indentation instead of 8.
98+
* **Set and Forget** - We embrace and encourage the use of technology that makes it easy for contributors to apply best-practice code-style, such as ReSharper. As we do so we are mindful that tools can cause hidden issues and merge hell.
99+
* **Documentation is the Spec** - We care deeply about providing delightful developer documentation and are sticklers for grammar and clarity. If the code and the docs conflict, we are biased to believe what we wrote in the API documentation. This drives a virtuous cycle of clear thinking.
94100

95101
**Terminal.Gui** uses a derivative of the [Microsoft C# Coding Conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions), with any deviations from those (somewhat older) conventions codified in the .editorconfig for the solution, as well as even more specific definitions in team-shared dotsettings files, used by ReSharper and Rider.\
96102
Before you commit code, please run the formatting rules on **only the code file(s) you have modified**, in one of the following ways, in order of most preferred to least preferred:

NativeAot/NativeAot.csproj

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
<PublishAot>true</PublishAot>
9+
<InvariantGlobalization>false</InvariantGlobalization>
10+
</PropertyGroup>
11+
12+
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
13+
<ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
14+
<TrimmerRootAssembly Include="Terminal.Gui" />
15+
</ItemGroup>
16+
17+
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
18+
<PackageReference Include="Terminal.Gui" Version="[2.0.0-v2-develop.2189,3)" />
19+
<TrimmerRootAssembly Include="Terminal.Gui" />
20+
</ItemGroup>
21+
22+
</Project>

NativeAot/Program.cs

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// This is a test application for a native Aot file.
2+
3+
using System.Diagnostics;
4+
using System.Diagnostics.CodeAnalysis;
5+
using System.Globalization;
6+
using Terminal.Gui;
7+
8+
namespace NativeAot;
9+
10+
public static class Program
11+
{
12+
[RequiresUnreferencedCode ("Calls Terminal.Gui.Application.Init(ConsoleDriver, String)")]
13+
[RequiresDynamicCode ("Calls Terminal.Gui.Application.Init(ConsoleDriver, String)")]
14+
private static void Main (string [] args)
15+
{
16+
Application.Init ();
17+
18+
#region The code in this region is not intended for use in a native Aot self-contained. It's just here to make sure there is no functionality break with localization in Terminal.Gui using self-contained
19+
20+
if (Equals(Thread.CurrentThread.CurrentUICulture, CultureInfo.InvariantCulture) && Application.SupportedCultures!.Count == 0)
21+
{
22+
// Only happens if the project has <InvariantGlobalization>true</InvariantGlobalization>
23+
Debug.Assert (Application.SupportedCultures.Count == 0);
24+
}
25+
else
26+
{
27+
Debug.Assert (Application.SupportedCultures!.Count > 0);
28+
Debug.Assert (Equals (CultureInfo.CurrentCulture, Thread.CurrentThread.CurrentUICulture));
29+
}
30+
31+
#endregion
32+
33+
ExampleWindow app = new ();
34+
Application.Run (app);
35+
36+
// Dispose the app object before shutdown
37+
app.Dispose ();
38+
39+
// Before the application exits, reset Terminal.Gui for clean shutdown
40+
Application.Shutdown ();
41+
42+
// To see this output on the screen it must be done after shutdown,
43+
// which restores the previous screen.
44+
Console.WriteLine ($@"Username: {ExampleWindow.UserName}");
45+
}
46+
}
47+
48+
// Defines a top-level window with border and title
49+
public class ExampleWindow : Window
50+
{
51+
public static string? UserName;
52+
53+
public ExampleWindow ()
54+
{
55+
Title = $"Example App ({Application.QuitKey} to quit)";
56+
57+
// Create input components and labels
58+
var usernameLabel = new Label { Text = "Username:" };
59+
60+
var userNameText = new TextField
61+
{
62+
// Position text field adjacent to the label
63+
X = Pos.Right (usernameLabel) + 1,
64+
65+
// Fill remaining horizontal space
66+
Width = Dim.Fill ()
67+
};
68+
69+
var passwordLabel = new Label
70+
{
71+
Text = "Password:", X = Pos.Left (usernameLabel), Y = Pos.Bottom (usernameLabel) + 1
72+
};
73+
74+
var passwordText = new TextField
75+
{
76+
Secret = true,
77+
78+
// align with the text box above
79+
X = Pos.Left (userNameText),
80+
Y = Pos.Top (passwordLabel),
81+
Width = Dim.Fill ()
82+
};
83+
84+
// Create login button
85+
var btnLogin = new Button
86+
{
87+
Text = "Login",
88+
Y = Pos.Bottom (passwordLabel) + 1,
89+
90+
// center the login button horizontally
91+
X = Pos.Center (),
92+
IsDefault = true
93+
};
94+
95+
// When login button is clicked display a message popup
96+
btnLogin.Accept += (s, e) =>
97+
{
98+
if (userNameText.Text == "admin" && passwordText.Text == "password")
99+
{
100+
MessageBox.Query ("Logging In", "Login Successful", "Ok");
101+
UserName = userNameText.Text;
102+
Application.RequestStop ();
103+
}
104+
else
105+
{
106+
MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok");
107+
}
108+
};
109+
110+
// Add the views to the Window
111+
Add (usernameLabel, userNameText, passwordLabel, passwordText, btnLogin);
112+
}
113+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project>
6+
<PropertyGroup>
7+
<Configuration>Debug</Configuration>
8+
<Platform>Any CPU</Platform>
9+
<PublishDir>bin\Debug\net8.0\publish\win-x64\</PublishDir>
10+
<PublishProtocol>FileSystem</PublishProtocol>
11+
<_TargetId>Folder</_TargetId>
12+
<TargetFramework>net8.0</TargetFramework>
13+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
14+
<SelfContained>true</SelfContained>
15+
<PublishSingleFile>false</PublishSingleFile>
16+
<PublishReadyToRun>false</PublishReadyToRun>
17+
</PropertyGroup>
18+
</Project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project>
6+
<PropertyGroup>
7+
<Configuration>Release</Configuration>
8+
<Platform>Any CPU</Platform>
9+
<PublishDir>bin\Release\net8.0\publish\win-x64\</PublishDir>
10+
<PublishProtocol>FileSystem</PublishProtocol>
11+
<_TargetId>Folder</_TargetId>
12+
<TargetFramework>net8.0</TargetFramework>
13+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
14+
<SelfContained>true</SelfContained>
15+
<PublishSingleFile>false</PublishSingleFile>
16+
<PublishReadyToRun>false</PublishReadyToRun>
17+
</PropertyGroup>
18+
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"profiles": {
3+
"NativeAot": {
4+
"commandName": "Project"
5+
},
6+
"WSL : UICatalog": {
7+
"commandName": "Executable",
8+
"executablePath": "wsl",
9+
"commandLineArgs": "dotnet NativeAot.dll",
10+
"distributionName": ""
11+
}
12+
}
13+
}

NativeAot/Publish_linux-x64_Debug.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
dotnet clean
4+
dotnet build
5+
dotnet publish -c Debug -r linux-x64 --self-contained
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
dotnet clean
4+
dotnet build
5+
dotnet publish -c Release -r linux-x64 --self-contained

0 commit comments

Comments
 (0)