mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop
This commit is contained in:
12
.github/workflows/publish.yml
vendored
12
.github/workflows/publish.yml
vendored
@@ -18,17 +18,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0 # fetch-depth is needed for GitVersion
|
fetch-depth: 0 # fetch-depth is needed for GitVersion
|
||||||
|
|
||||||
- name: Install GitVersion
|
- name: Install GitVersion
|
||||||
uses: gittools/actions/gitversion/setup@v3
|
uses: gittools/actions/gitversion/setup@v3.1.11
|
||||||
with:
|
with:
|
||||||
versionSpec: '5.x'
|
versionSpec: '6.0.x'
|
||||||
includePrerelease: true
|
|
||||||
|
|
||||||
- name: Determine Version
|
- name: Determine Version
|
||||||
uses: gittools/actions/gitversion/execute@v3
|
uses: gittools/actions/gitversion/execute@v3.1.11
|
||||||
with:
|
with:
|
||||||
useConfigFile: true
|
useConfigFile: true
|
||||||
#additionalArguments: /b develop
|
updateAssemblyInfo: true
|
||||||
id: gitversion # step id used as reference for output values
|
id: gitversion # step id used as reference for output values
|
||||||
|
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
@@ -42,7 +41,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Release
|
- name: Build Release
|
||||||
run: |
|
run: |
|
||||||
dotnet-gitversion /updateprojectfiles
|
|
||||||
dotnet build Terminal.Gui/Terminal.Gui.csproj --no-incremental --nologo --force --configuration Release
|
dotnet build Terminal.Gui/Terminal.Gui.csproj --no-incremental --nologo --force --configuration Release
|
||||||
dotnet test Terminal.Gui/Terminal.Gui.csproj --configuration Release
|
dotnet test Terminal.Gui/Terminal.Gui.csproj --configuration Release
|
||||||
|
|
||||||
|
|||||||
164
GitVersion.yml
164
GitVersion.yml
@@ -1,101 +1,89 @@
|
|||||||
workflow: GitFlow/v1
|
# This file configures GitVersion 6.x to work with Terminal.Gui's GitFlow branching strategy.
|
||||||
tag-prefix: '[vV]'
|
#
|
||||||
branches:
|
# Terminal.Gui uses the GitFlow branching strategy.
|
||||||
develop:
|
# https://gitversion.net/docs/learn/branching-strategies/gitflow/
|
||||||
mode: ContinuousDeployment
|
#
|
||||||
label: develop
|
# - We have two main branches: `v2_release` and `v2_develop`.
|
||||||
regex: v2_develop
|
# - `v2_release` is the main branch for V2 releases and matches the latest NuGet release package (e.g., 2.0.0);
|
||||||
tracks-release-branches: true
|
# prior to release, it uses pre-release labels (e.g., 2.0.0-prealpha.1).
|
||||||
is-source-branch-for: ['main']
|
# - `v2_develop` is the development branch for V2 and always carries a pre-release label (e.g., 2.1.0-develop.1).
|
||||||
source-branches: []
|
# - Development happens on feature branches off `v2_develop`.
|
||||||
|
# - For releases, we merge feature branches into `v2_develop`, then `v2_develop` into `v2_release`.
|
||||||
|
# - The ./.github/workflows/publish.yml builds and publishes on pushes to `v2_develop` and `v2_release`.
|
||||||
|
#
|
||||||
|
# Branches:
|
||||||
|
# - v1_release: Main branch for V1 (historical)
|
||||||
|
# - v1_develop: Develop branch for V1 (historical)
|
||||||
|
# - v2_release: Main branch for V2
|
||||||
|
# - v2_develop: Develop branch for V2
|
||||||
|
#
|
||||||
|
# Package Naming:
|
||||||
|
# - from v2_develop: 2.1.0-develop.1 (minor version increments)
|
||||||
|
# - from v2_release (pre-release): 2.0.0-prealpha.1 or 2.0.0-beta.1
|
||||||
|
# - from v2_release (release): 2.0.0 (patch version increments)
|
||||||
|
#
|
||||||
|
mode: ContinuousDelivery # GitVersion 6.x uses Mainline mode for GitFlow, focusing on main branch releases
|
||||||
|
|
||||||
|
# We prefix our tags with 'v' or 'V' (e.g., v1.0.0)
|
||||||
|
tag-prefix: '[vV]'
|
||||||
|
|
||||||
|
branches:
|
||||||
|
|
||||||
|
# V2 Release Branch
|
||||||
main:
|
main:
|
||||||
mode: ContinuousDeployment
|
# Matches the v2_release branch
|
||||||
|
regex: ^v2_release$
|
||||||
|
# Uses 'prealpha' as pre-release label before official release
|
||||||
label: prealpha
|
label: prealpha
|
||||||
regex: v2_release
|
# Increments patch version (x.y.z+1) on commits
|
||||||
is-release-branch: true
|
increment: Patch
|
||||||
|
# Specifies v2_develop as the source branch
|
||||||
source-branches: ['develop']
|
source-branches: ['develop']
|
||||||
|
|
||||||
v1_develop:
|
# V2 Development Branch
|
||||||
mode: ContinuousDeployment
|
develop:
|
||||||
label: v1_develop
|
# Matches the v2_develop branch
|
||||||
regex: v1_develop
|
regex: v2_develop
|
||||||
source-branches:
|
# Adds 'develop' as pre-release label (e.g., 2.1.0-develop.1)
|
||||||
- v1_release
|
label: develop
|
||||||
pre-release-weight: 100
|
# Increments minor version (x.y+1.z) on commits
|
||||||
|
increment: Minor
|
||||||
|
# No source branches specified as this is the root of development
|
||||||
|
source-branches: []
|
||||||
|
# Indicates this branch feeds into release branches
|
||||||
|
tracks-release-branches: true
|
||||||
|
|
||||||
v1_release:
|
# # V1 Branches - Included for historical reference
|
||||||
mode: ContinuousDeployment
|
# v1_develop:
|
||||||
regex: v1_release
|
# regex: v1_develop
|
||||||
is-release-branch: true
|
# label: v1_develop
|
||||||
source-branches: ['v1_develop']
|
# increment: Minor
|
||||||
|
# source-branches: ['v1_release']
|
||||||
|
# # Lower weight keeps V1 pre-releases sorted below V2
|
||||||
|
# pre-release-weight: 100
|
||||||
|
|
||||||
|
# v1_release:
|
||||||
|
# regex: v1_release
|
||||||
|
# # Empty label for stable releases
|
||||||
|
# label: ''
|
||||||
|
# increment: Patch
|
||||||
|
# source-branches: ['v1_develop']
|
||||||
|
|
||||||
|
# Pull Request Branches
|
||||||
|
# Configures versioning for PRs (e.g., 2.0.0-pr.feature-123.1)
|
||||||
pull-request:
|
pull-request:
|
||||||
mode: ContinuousDeployment
|
# Matches typical PR branch names
|
||||||
label: PullRequest.{BranchName}
|
|
||||||
increment: Inherit
|
|
||||||
label-number-pattern: '[/-](?<number>\d+)'
|
|
||||||
regex: ^(pull|pull\-requests|pr)[/-]
|
regex: ^(pull|pull\-requests|pr)[/-]
|
||||||
|
# Uses 'pr' prefix with branch name in the label (e.g., pr.feature-123)
|
||||||
|
label: pr.{BranchName}
|
||||||
|
# Inherits increment strategy from source branch
|
||||||
|
increment: Inherit
|
||||||
source-branches:
|
source-branches:
|
||||||
- develop
|
- develop
|
||||||
- main
|
- main
|
||||||
- feature
|
# High weight ensures PR versions sort after regular pre-releases
|
||||||
- support
|
|
||||||
- hotfix
|
|
||||||
pre-release-weight: 30000
|
pre-release-weight: 30000
|
||||||
|
|
||||||
|
# Ignore specific commits if needed (currently empty)
|
||||||
ignore:
|
ignore:
|
||||||
sha: []
|
sha: []
|
||||||
|
|
||||||
|
|
||||||
# next-version: 2.0.0
|
|
||||||
# mode: ContinuousDeployment
|
|
||||||
# tag-prefix: '[vV]'
|
|
||||||
# continuous-delivery-fallback-tag: 'pre'
|
|
||||||
# branches:
|
|
||||||
# # v1_develop:
|
|
||||||
# # mode: ContinuousDeployment
|
|
||||||
# # label: pre
|
|
||||||
# # regex: ^v1_develop?[/-]
|
|
||||||
# # is-release-branch: false
|
|
||||||
# # source-branches:
|
|
||||||
# # - v1
|
|
||||||
# # v1:
|
|
||||||
# # label: rc
|
|
||||||
# # increment: Patch
|
|
||||||
# # regex: ^v2?[/-]
|
|
||||||
# # is-release-branch: false
|
|
||||||
# # source-branches: []
|
|
||||||
# # is-mainline: true
|
|
||||||
|
|
||||||
# v2_develop:
|
|
||||||
# mode: ContinuousDeployment
|
|
||||||
# label: pre
|
|
||||||
# regex: ^v2_develop?[/-]
|
|
||||||
# is-release-branch: true
|
|
||||||
# tracks-release-branches: true
|
|
||||||
# is-source-branch-for: ['v2']
|
|
||||||
# source-branches: []
|
|
||||||
# v2:
|
|
||||||
# mode: ContinuousDeployment
|
|
||||||
# is-release-branch: false
|
|
||||||
# label: alpha
|
|
||||||
# increment: Patch
|
|
||||||
# regex: ^v2?[/-]
|
|
||||||
# source-branches: ['v2_develop']
|
|
||||||
|
|
||||||
# # feature:
|
|
||||||
# # label: useBranchName
|
|
||||||
# # regex: ^features?[/-]
|
|
||||||
# # source-branches:
|
|
||||||
# # - v1
|
|
||||||
# # - v1_develop
|
|
||||||
# # - v2
|
|
||||||
# # - v2_develop
|
|
||||||
|
|
||||||
# pull-request:
|
|
||||||
# label: PullRequest.{BranchName}
|
|
||||||
# increment: Inherit
|
|
||||||
# ignore:
|
|
||||||
# sha: []
|
|
||||||
# merge-message-formats: {}
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
$apiKey = "key" # Replace with your actual API key
|
$apiKey = "" # Replace with your actual API key
|
||||||
# Unlist all packages matching "2.0.0-v2-develop.*"
|
# Unlist all packages matching "2.0.0-v2-develop.*"
|
||||||
# PowerShell script to unlist NuGet packages using dotnet CLI
|
# PowerShell script to unlist NuGet packages using dotnet CLI
|
||||||
$packageId = "terminal.gui" # Ensure this is the correct package name (case-sensitive)
|
$packageId = "terminal.gui" # Ensure this is the correct package name (case-sensitive)
|
||||||
$packagePattern = "^2\.0\.0-v2-develop\..*$" # Regex pattern for filtering versions
|
$packagePattern = "^2\.0\.0-develop\..*$" # Regex pattern for filtering versions
|
||||||
$nugetSource = "https://api.nuget.org/v3/index.json"
|
$nugetSource = "https://api.nuget.org/v3/index.json"
|
||||||
|
|
||||||
# Fetch package versions from NuGet API
|
# Fetch package versions from NuGet API
|
||||||
|
|||||||
@@ -194,6 +194,23 @@ public class ApplicationV2 : ApplicationImpl
|
|||||||
{
|
{
|
||||||
Logging.Logger.LogInformation ($"RequestStop '{top}'");
|
Logging.Logger.LogInformation ($"RequestStop '{top}'");
|
||||||
|
|
||||||
|
top ??= Application.Top;
|
||||||
|
|
||||||
|
if (top == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ev = new ToplevelClosingEventArgs (top);
|
||||||
|
top.OnClosing (ev);
|
||||||
|
|
||||||
|
if (ev.Cancel)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
top.Running = false;
|
||||||
|
|
||||||
// TODO: This definition of stop seems sketchy
|
// TODO: This definition of stop seems sketchy
|
||||||
Application.TopLevels.TryPop (out _);
|
Application.TopLevels.TryPop (out _);
|
||||||
|
|
||||||
@@ -205,6 +222,9 @@ public class ApplicationV2 : ApplicationImpl
|
|||||||
{
|
{
|
||||||
Application.Top = null;
|
Application.Top = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify that it is closed
|
||||||
|
top.OnClosed (top);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|||||||
@@ -374,6 +374,10 @@ public static class MessageBox
|
|||||||
{
|
{
|
||||||
Clicked = (int)btn.Data!;
|
Clicked = (int)btn.Data!;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Clicked = defaultButton;
|
||||||
|
}
|
||||||
|
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
Application.RequestStop ();
|
Application.RequestStop ();
|
||||||
|
|||||||
@@ -221,6 +221,53 @@ public class ApplicationV2Tests
|
|||||||
|
|
||||||
ApplicationImpl.ChangeInstance (orig);
|
ApplicationImpl.ChangeInstance (orig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Test_V2_ClosingRaised ()
|
||||||
|
{
|
||||||
|
var orig = ApplicationImpl.Instance;
|
||||||
|
|
||||||
|
var v2 = NewApplicationV2 ();
|
||||||
|
ApplicationImpl.ChangeInstance (v2);
|
||||||
|
|
||||||
|
v2.Init ();
|
||||||
|
|
||||||
|
int closing=0;
|
||||||
|
int closed = 0;
|
||||||
|
var t=new Toplevel ();
|
||||||
|
t.Closing
|
||||||
|
+= (_, a) =>
|
||||||
|
{
|
||||||
|
// Cancel the first time
|
||||||
|
if (closing==0)
|
||||||
|
{
|
||||||
|
a.Cancel = true;
|
||||||
|
}
|
||||||
|
closing++;
|
||||||
|
Assert.Same(t,a.RequestingTop);
|
||||||
|
};
|
||||||
|
|
||||||
|
t.Closed
|
||||||
|
+= (_, a) =>
|
||||||
|
{
|
||||||
|
closed++;
|
||||||
|
Assert.Same (t, a.Toplevel);
|
||||||
|
};
|
||||||
|
|
||||||
|
v2.AddIdle (IdleExit);
|
||||||
|
|
||||||
|
// Blocks until the timeout call is hit
|
||||||
|
|
||||||
|
v2.Run (t);
|
||||||
|
|
||||||
|
Assert.Null (Application.Top);
|
||||||
|
v2.Shutdown ();
|
||||||
|
|
||||||
|
ApplicationImpl.ChangeInstance (orig);
|
||||||
|
|
||||||
|
Assert.Equal (2,closing);
|
||||||
|
Assert.Equal (1, closed);
|
||||||
|
}
|
||||||
private bool IdleExit ()
|
private bool IdleExit ()
|
||||||
{
|
{
|
||||||
if (Application.Top != null)
|
if (Application.Top != null)
|
||||||
|
|||||||
@@ -504,5 +504,25 @@ public class MessageBoxTests
|
|||||||
Application.Run (top);
|
Application.Run (top);
|
||||||
top.Dispose ();
|
top.Dispose ();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[SetupFakeDriver]
|
||||||
|
[MemberData (nameof (AcceptingKeys))]
|
||||||
|
public void Button_IsDefault_True_Return_His_Index_On_Accepting (Key key)
|
||||||
|
{
|
||||||
|
Application.Init ();
|
||||||
|
|
||||||
|
Application.Iteration += (_, _) => Assert.True (Application.RaiseKeyDownEvent (key));
|
||||||
|
int res = MessageBox.Query ("hey", "IsDefault", "Yes", "No");
|
||||||
|
|
||||||
|
Assert.Equal (0, res);
|
||||||
|
|
||||||
|
Application.Shutdown ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<object []> AcceptingKeys ()
|
||||||
|
{
|
||||||
|
yield return [Key.Enter];
|
||||||
|
yield return [Key.Space];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user