From a6b5d22d7420c0fb655026968832fe348dc72c77 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 4 Sep 2024 10:36:31 -0400 Subject: [PATCH 1/4] [CI] Move ExportChangeID out of the configure function. (#21170) We are tryihng to sort out all the scripts to make it re-usable in order to use them in cascading pipelines. --------- Co-authored-by: Rolf Bjarne Kvinge --- tools/devops/automation/scripts/VSTS.psm1 | 39 ++++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/tools/devops/automation/scripts/VSTS.psm1 b/tools/devops/automation/scripts/VSTS.psm1 index 0ebebd5a7887..f7c43f276c47 100644 --- a/tools/devops/automation/scripts/VSTS.psm1 +++ b/tools/devops/automation/scripts/VSTS.psm1 @@ -332,6 +332,35 @@ class BuildConfiguration { } } + <# + .SYNOPSIS + Retrieve the change id and export it as an enviroment variable. + #> + [string] ExportChangeId ([object] $configuration) { + # This is an interesting step, we do know we are dealing with a PR, but we need the PR id to + # be able to get the labels, the buildSourceBranch follows the pattern: refs/pull/{ChangeId}/merge + # we could use a regexp but then we would have two problems instead of one + $changeId = $null + if ($configuration.PARENT_BUILD_BUILD_SOURCEBRANCH) { + # use the source branch information from the configuration object + $changeId = $configuration.PARENT_BUILD_BUILD_SOURCEBRANCH.Replace("refs/pull/", "").Replace("/merge", "") + } else { + Write-Debug "Retrieving change id from the environment since it could not be found in the config." + # retrieve the change ide form the BUILD_SOURCEBRANCH enviroment variable. + $changeId = "$Env:BUILD_SOURCEBRANCH".Replace("refs/pull/", "").Replace("/merge", "") + } + + # we can always fail (regexp error or not env varaible) + if ($changeId) { + # add a var with the change id, which can be later consumed by some of the old scripts from + # jenkins + Write-Host "##vso[task.setvariable variable=pr_number;isOutput=true]$changeId" + } else { + Write-Debug "Not setting the change id because it could not be calculated." + } + return $changeId + } + [PSCustomObject] Import([string] $configFile) { if (-not (Test-Path -Path $configFile -PathType Leaf)) { throw [System.InvalidOperationException]::new("Configuration file $configFile is missing") @@ -468,15 +497,9 @@ class BuildConfiguration { if ($configuration.BuildReason -eq "PullRequest" -or (($configuration.BuildReason -eq "Manual") -and ($configuration.PARENT_BUILD_BUILD_SOURCEBRANCH -eq "merge")) ) { Write-Host "Configuring build from PR." - # This is an interesting step, we do know we are dealing with a PR, but we need the PR id to - # be able to get the labels, the buildSourceBranch follows the pattern: refs/pull/{ChangeId}/merge - # we could use a regexp but then we would have two problems instead of one - $changeId = $configuration.PARENT_BUILD_BUILD_SOURCEBRANCH.Replace("refs/pull/", "").Replace("/merge", "") - - # add a var with the change id, which can be later consumed by some of the old scripts from - # jenkins - Write-Host "##vso[task.setvariable variable=pr_number;isOutput=true]$changeId" + # retrieve the PR data to be able to fwd the labels from github + $changeId = $this.ExportChangeId($configuration) $prInfo = Get-GitHubPRInfo -ChangeId $changeId Write-Host $prInfo From a854ebe1b894ae073697439662fdd7909f52c64d Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 4 Sep 2024 18:16:19 +0200 Subject: [PATCH 2/4] [tests] Improve test Makefile when specifying runtime identifier on the command line. (#21169) Using RUNTIMEIDENTIFIER(S) in the Makefile interferes with the build, because they get passed on to msbuild, which sees them as properties (RuntimeIdentifier(s)). Thus use RID instead, and only pass on the value to the build if appropriate. --- tests/common/shared-dotnet.mk | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/tests/common/shared-dotnet.mk b/tests/common/shared-dotnet.mk index 7299716da60e..995084302733 100644 --- a/tests/common/shared-dotnet.mk +++ b/tests/common/shared-dotnet.mk @@ -72,33 +72,37 @@ ifeq ($(PLATFORM),) PLATFORM=$(shell basename "$(CURDIR)") endif -ifeq ($(RUNTIMEIDENTIFIERS),) +ifneq ($(RUNTIMEIDENTIFIERS)$(RUNTIMEIDENTIFIER),) +$(error "Don't set RUNTIMEIDENTIFIER or RUNTIMEIDENTIFIERS, set RID instead") +endif + +ifeq ($(RID),) ifeq ($(PLATFORM),iOS) -RUNTIMEIDENTIFIERS=ios-arm64 +RID=ios-arm64 else ifeq ($(PLATFORM),tvOS) -RUNTIMEIDENTIFIERS=tvos-arm64 +RID=tvos-arm64 else ifeq ($(PLATFORM),MacCatalyst) ifeq ($(CONFIG),Release) -RUNTIMEIDENTIFIERS=maccatalyst-x64;maccatalyst-arm64 +RID=maccatalyst-x64;maccatalyst-arm64 else ifneq ($(UNIVERSAL),) -RUNTIMEIDENTIFIERS=maccatalyst-x64;maccatalyst-arm64 +RID=maccatalyst-x64;maccatalyst-arm64 else ifeq ($(shell arch),arm64) -RUNTIMEIDENTIFIERS=maccatalyst-arm64 +RID=maccatalyst-arm64 else -RUNTIMEIDENTIFIERS=maccatalyst-x64 +RID=maccatalyst-x64 endif else ifeq ($(PLATFORM),macOS) ifeq ($(CONFIG),Release) -RUNTIMEIDENTIFIERS=osx-x64;osx-arm64 +RID=osx-x64;osx-arm64 else ifneq ($(UNIVERSAL),) -RUNTIMEIDENTIFIERS=osx-x64;osx-arm64 +RID=osx-x64;osx-arm64 else ifeq ($(shell arch),arm64) -RUNTIMEIDENTIFIERS=osx-arm64 +RID=osx-arm64 else -RUNTIMEIDENTIFIERS=osx-x64 +RID=osx-x64 endif else -RUNTIMEIDENTIFIERS=unknown-platform-$(PLATFORM) +RID=unknown-platform-$(PLATFORM) endif endif @@ -106,10 +110,12 @@ ifneq ($(UNIVERSAL),) UNIVERSAL_ARGUMENT=/p:UniversalBuild=true endif -ifeq ($(findstring ;,$(RUNTIMEIDENTIFIERS)),;) +ifeq ($(findstring ;,$(RID)),;) PATH_RID= +export RUNTIMEIDENTIFIERS=$(RID) else -PATH_RID=$(RUNTIMEIDENTIFIERS)/ +PATH_RID=$(RID)/ +export RUNTIMEIDENTIFIER=$(RID) endif From b2a5fd41994485fb6dd9a8085d35fa97736856cd Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 4 Sep 2024 23:14:07 +0200 Subject: [PATCH 3/4] [Network] Fix binding mistake in NWConnection. (#21174) The 'nw_connection_set_viability_changed_handler' P/Invoke was originally bound as 'SetBooleanChangeHandler', which isn't quite right. So now bind it as 'SetViabilityChangeHandler', obsolete the old version and remove it in XAMCORE_5_0. --- src/Network/NWConnection.cs | 13 +++++++++++++ tests/cecil-tests/Documentation.KnownFailures.txt | 1 - 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Network/NWConnection.cs b/src/Network/NWConnection.cs index ed153271bb9a..f68baf330bb2 100644 --- a/src/Network/NWConnection.cs +++ b/src/Network/NWConnection.cs @@ -9,6 +9,7 @@ #nullable enable using System; +using System.ComponentModel; using System.Runtime.InteropServices; using ObjCRuntime; using Foundation; @@ -157,8 +158,20 @@ static void TrampolineBooleanChangeHandler (IntPtr block, byte value) [DllImport (Constants.NetworkLibrary)] static extern unsafe void nw_connection_set_viability_changed_handler (IntPtr handle, void* callback); +#if !XAMCORE_5_0 + [Obsolete ("Use 'SetViabilityChangeHandler' instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] [BindingImpl (BindingImplOptions.Optimizable)] public unsafe void SetBooleanChangeHandler (Action callback) + { + SetViabilityChangeHandler (callback); + } +#endif // !XAMCORE_5_0 + + /// Set a handler that is called when data can be sent or received. + /// The callback to call when data can be sent or received. + [BindingImpl (BindingImplOptions.Optimizable)] + public unsafe void SetViabilityChangeHandler (Action callback) { if (callback is null) { nw_connection_set_viability_changed_handler (GetCheckedHandle (), null); diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index d865eab4c8bf..bb122cdc876a 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -42193,7 +42193,6 @@ M:Network.NWConnection.Send(System.Byte[],System.Int32,System.Int32,Network.NWCo M:Network.NWConnection.SendIdempotent(CoreFoundation.DispatchData,Network.NWContentContext,System.Boolean) M:Network.NWConnection.SendIdempotent(System.Byte[],Network.NWContentContext,System.Boolean) M:Network.NWConnection.SetBetterPathAvailableHandler(System.Action{System.Boolean}) -M:Network.NWConnection.SetBooleanChangeHandler(System.Action{System.Boolean}) M:Network.NWConnection.SetPathChangedHandler(System.Action{Network.NWPath}) M:Network.NWConnection.SetQueue(CoreFoundation.DispatchQueue) M:Network.NWConnection.SetStateChangeHandler(System.Action{Network.NWConnectionState,Network.NWError}) From f562519e3e251b2f69e6fc1a27155a8b4e76043b Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 5 Sep 2024 12:22:31 +0200 Subject: [PATCH 4/4] Disable legacy Xamarin. (#21173) It's no longer supported. --- Make.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Make.config b/Make.config index af3f313c2976..16db1b068da7 100644 --- a/Make.config +++ b/Make.config @@ -319,7 +319,7 @@ INCLUDE_TVOS=1 INCLUDE_MACCATALYST=1 INCLUDE_DEVICE=1 INCLUDE_DOTNET_WATCHOS= -INCLUDE_XAMARIN_LEGACY=1 +INCLUDE_XAMARIN_LEGACY= INCLUDE_HOTRESTART=1 ENABLE_DOTNET=1