-
Notifications
You must be signed in to change notification settings - Fork 702
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3718 from gui-cs/v2_develop
Merge v2_develop in to v2_release
- Loading branch information
Showing
250 changed files
with
22,827 additions
and
13,283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ on: | |
- '**.md' | ||
|
||
jobs: | ||
build_and_test: | ||
build_and_test_debug: | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
|
@@ -23,7 +23,7 @@ jobs: | |
timeout-minutes: 10 | ||
steps: | ||
|
||
# Build | ||
# Build (Debug) | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
@@ -76,6 +76,24 @@ jobs: | |
logs/ | ||
UnitTests/TestResults/ | ||
|
||
build_release: | ||
# Ensure that RELEASE builds are not broken | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.x | ||
dotnet-quality: 'ga' | ||
|
||
- name: Build Release | ||
run: dotnet build --configuration Release | ||
|
||
|
||
# Note: this step is currently not writing to the gist for some reason | ||
# - name: Create Test Coverage Badge | ||
# uses: simon-k/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<PublishAot>true</PublishAot> | ||
<InvariantGlobalization>false</InvariantGlobalization> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" /> | ||
<TrimmerRootAssembly Include="Terminal.Gui" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||
<PackageReference Include="Terminal.Gui" Version="[2.0.0-v2-develop.2189,3)" /> | ||
<TrimmerRootAssembly Include="Terminal.Gui" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
// This is a test application for a native Aot file. | ||
|
||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Globalization; | ||
using Terminal.Gui; | ||
|
||
namespace NativeAot; | ||
|
||
public static class Program | ||
{ | ||
[RequiresUnreferencedCode ("Calls Terminal.Gui.Application.Init(ConsoleDriver, String)")] | ||
[RequiresDynamicCode ("Calls Terminal.Gui.Application.Init(ConsoleDriver, String)")] | ||
private static void Main (string [] args) | ||
{ | ||
Application.Init (); | ||
|
||
#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 | ||
|
||
if (Equals(Thread.CurrentThread.CurrentUICulture, CultureInfo.InvariantCulture) && Application.SupportedCultures!.Count == 0) | ||
{ | ||
// Only happens if the project has <InvariantGlobalization>true</InvariantGlobalization> | ||
Debug.Assert (Application.SupportedCultures.Count == 0); | ||
} | ||
else | ||
{ | ||
Debug.Assert (Application.SupportedCultures!.Count > 0); | ||
Debug.Assert (Equals (CultureInfo.CurrentCulture, Thread.CurrentThread.CurrentUICulture)); | ||
} | ||
|
||
#endregion | ||
|
||
ExampleWindow app = new (); | ||
Application.Run (app); | ||
|
||
// Dispose the app object before shutdown | ||
app.Dispose (); | ||
|
||
// Before the application exits, reset Terminal.Gui for clean shutdown | ||
Application.Shutdown (); | ||
|
||
// To see this output on the screen it must be done after shutdown, | ||
// which restores the previous screen. | ||
Console.WriteLine ($@"Username: {ExampleWindow.UserName}"); | ||
} | ||
} | ||
|
||
// Defines a top-level window with border and title | ||
public class ExampleWindow : Window | ||
{ | ||
public static string? UserName; | ||
|
||
public ExampleWindow () | ||
{ | ||
Title = $"Example App ({Application.QuitKey} to quit)"; | ||
|
||
// Create input components and labels | ||
var usernameLabel = new Label { Text = "Username:" }; | ||
|
||
var userNameText = new TextField | ||
{ | ||
// Position text field adjacent to the label | ||
X = Pos.Right (usernameLabel) + 1, | ||
|
||
// Fill remaining horizontal space | ||
Width = Dim.Fill () | ||
}; | ||
|
||
var passwordLabel = new Label | ||
{ | ||
Text = "Password:", X = Pos.Left (usernameLabel), Y = Pos.Bottom (usernameLabel) + 1 | ||
}; | ||
|
||
var passwordText = new TextField | ||
{ | ||
Secret = true, | ||
|
||
// align with the text box above | ||
X = Pos.Left (userNameText), | ||
Y = Pos.Top (passwordLabel), | ||
Width = Dim.Fill () | ||
}; | ||
|
||
// Create login button | ||
var btnLogin = new Button | ||
{ | ||
Text = "Login", | ||
Y = Pos.Bottom (passwordLabel) + 1, | ||
|
||
// center the login button horizontally | ||
X = Pos.Center (), | ||
IsDefault = true | ||
}; | ||
|
||
// When login button is clicked display a message popup | ||
btnLogin.Accept += (s, e) => | ||
{ | ||
if (userNameText.Text == "admin" && passwordText.Text == "password") | ||
{ | ||
MessageBox.Query ("Logging In", "Login Successful", "Ok"); | ||
UserName = userNameText.Text; | ||
Application.RequestStop (); | ||
} | ||
else | ||
{ | ||
MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok"); | ||
} | ||
}; | ||
|
||
// Add the views to the Window | ||
Add (usernameLabel, userNameText, passwordLabel, passwordText, btnLogin); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Debug.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project> | ||
<PropertyGroup> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Any CPU</Platform> | ||
<PublishDir>bin\Debug\net8.0\publish\win-x64\</PublishDir> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<_TargetId>Folder</_TargetId> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
<SelfContained>true</SelfContained> | ||
<PublishSingleFile>false</PublishSingleFile> | ||
<PublishReadyToRun>false</PublishReadyToRun> | ||
</PropertyGroup> | ||
</Project> |
18 changes: 18 additions & 0 deletions
18
NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Release.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project> | ||
<PropertyGroup> | ||
<Configuration>Release</Configuration> | ||
<Platform>Any CPU</Platform> | ||
<PublishDir>bin\Release\net8.0\publish\win-x64\</PublishDir> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<_TargetId>Folder</_TargetId> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
<SelfContained>true</SelfContained> | ||
<PublishSingleFile>false</PublishSingleFile> | ||
<PublishReadyToRun>false</PublishReadyToRun> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"profiles": { | ||
"NativeAot": { | ||
"commandName": "Project" | ||
}, | ||
"WSL : UICatalog": { | ||
"commandName": "Executable", | ||
"executablePath": "wsl", | ||
"commandLineArgs": "dotnet NativeAot.dll", | ||
"distributionName": "" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
dotnet clean | ||
dotnet build | ||
dotnet publish -c Debug -r linux-x64 --self-contained |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
dotnet clean | ||
dotnet build | ||
dotnet publish -c Release -r linux-x64 --self-contained |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
dotnet clean | ||
dotnet build | ||
dotnet publish -c Debug -r osx-x64 --self-contained |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
dotnet clean | ||
dotnet build | ||
dotnet publish -c Release -r osx-x64 --self-contained |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Terminal.Gui C# SelfContained | ||
|
||
This project aims to test the `Terminal.Gui` library to create a simple `native AOT` `self-container` GUI application in C#, ensuring that all its features are available. | ||
|
||
With `Debug` the `.csproj` is used and with `Release` the latest `nuget package` is used, either in `Solution Configurations` or in `Profile Publish` or in the `Publish_linux-x64` or in the `Publish_osx-x64` files. | ||
Unlike self-contained single-file publishing, native AOT publishing must be generated on the same platform as the target execution version. Therefore, if the target execution is Linux, then the publishing must be generated on a Linux operating system. Attempting to generate on Windows for the Linux target will throw an exception. | ||
|
||
To publish the `native AOT` file in `Debug` or `Release` mode, it is not necessary to select it in the `Solution Configurations`, just choose the `Debug` or `Release` configuration in the `Publish Profile` or the `*.sh` files. | ||
|
||
When executing the file directly from the `native AOT` file and needing to debug it, it will be necessary to attach it to the debugger, just like any other standalone application and selecting `Native Code`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.