Merge main into net7.0. (#16233)
This commit is contained in:
Коммит
d8b991e0e6
|
@ -40,20 +40,7 @@ jobs:
|
|||
run: |
|
||||
set -exo pipefail
|
||||
|
||||
SRC_DIR=$(pwd)
|
||||
cd ..
|
||||
dotnet format "$SRC_DIR/tools/xibuild/xibuild.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/tests/cecil-tests/cecil-tests.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Messaging/Xamarin.Messaging.Build/Xamarin.Messaging.Build.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.Localization.MSBuild/Xamarin.Localization.MSBuild.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Tasks.Windows.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/tools/dotnet-linker/dotnet-linker.csproj"
|
||||
# dotnet format "$SRC_DIR/[...]"
|
||||
# add more projects here...
|
||||
cd "$SRC_DIR"
|
||||
./tools/autoformat.sh
|
||||
|
||||
mkdir -p autoformat
|
||||
echo ${{ github.event.number }} > ./autoformat/PR
|
||||
|
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: 'Download artifacts'
|
||||
uses: actions/github-script@v3.1.0
|
||||
uses: actions/github-script@v6.3.1
|
||||
with:
|
||||
script: |
|
||||
var artifacts = await github.actions.listWorkflowRunArtifacts({
|
||||
|
@ -65,7 +65,7 @@ jobs:
|
|||
|
||||
- name: 'Yell at user'
|
||||
if: steps.unzip_artifacts.outputs.autoformatted == 'true'
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v6.3.1
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
|
|
|
@ -26,7 +26,7 @@ jobs:
|
|||
cat changelog2.txt >> $GITHUB_ENV
|
||||
|
||||
- name: 'Add changelog'
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v6.3.1
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#pragma warning disable 0661
|
||||
// In both of these cases, the NSObject Equals/GetHashCode implementation works fine, so we can ignore these warnings.
|
||||
|
||||
using AudioToolbox;
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
using System;
|
||||
|
@ -34,5 +35,30 @@ namespace AVFoundation {
|
|||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
[Export ("StreamDescription")]
|
||||
#if NET
|
||||
[SupportedOSPlatform ("ios8.0")]
|
||||
[SupportedOSPlatform ("macos10.10")]
|
||||
[SupportedOSPlatform ("tvos")]
|
||||
[SupportedOSPlatform ("maccatalyst8.0")]
|
||||
#endif
|
||||
public virtual AudioStreamBasicDescription StreamDescription {
|
||||
#if NET
|
||||
[SupportedOSPlatform ("ios8.0")]
|
||||
[SupportedOSPlatform ("macos10.10")]
|
||||
[SupportedOSPlatform ("tvos")]
|
||||
[SupportedOSPlatform ("maccatalyst8.0")]
|
||||
#endif
|
||||
get {
|
||||
var ptr = _StreamDescription;
|
||||
if (ptr == IntPtr.Zero)
|
||||
return default (AudioStreamBasicDescription);
|
||||
unsafe {
|
||||
AudioStreamBasicDescription *p = (AudioStreamBasicDescription *) ptr;
|
||||
return *p;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ObjCRuntime;
|
||||
|
@ -112,22 +113,42 @@ namespace Network {
|
|||
return nw_path_is_equal (GetCheckedHandle (), other.Handle);
|
||||
}
|
||||
|
||||
delegate void nw_path_enumerate_interfaces_block_t (IntPtr block, IntPtr iface);
|
||||
// Returning 'byte' since 'bool' isn't blittable
|
||||
delegate byte nw_path_enumerate_interfaces_block_t (IntPtr block, IntPtr iface);
|
||||
static nw_path_enumerate_interfaces_block_t static_Enumerator = TrampolineEnumerator;
|
||||
|
||||
[MonoPInvokeCallback (typeof (nw_path_enumerate_interfaces_block_t))]
|
||||
static void TrampolineEnumerator (IntPtr block, IntPtr iface)
|
||||
static byte TrampolineEnumerator (IntPtr block, IntPtr iface)
|
||||
{
|
||||
var del = BlockLiteral.GetTarget<Action<NWInterface>> (block);
|
||||
var del = BlockLiteral.GetTarget<Func<NWInterface, bool>> (block);
|
||||
if (del is not null)
|
||||
del (new NWInterface (iface, owns: false));
|
||||
return del (new NWInterface (iface, owns: false)) ? (byte) 1 : (byte) 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
[DllImport (Constants.NetworkLibrary)]
|
||||
static extern void nw_path_enumerate_interfaces (IntPtr handle, ref BlockLiteral callback);
|
||||
|
||||
[BindingImpl (BindingImplOptions.Optimizable)]
|
||||
|
||||
#if !XAMCORE_5_0
|
||||
[Obsolete ("Use the overload that takes a 'Func<NWInterface, bool>' instead.")]
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
public void EnumerateInterfaces (Action<NWInterface> callback)
|
||||
{
|
||||
if (callback is null)
|
||||
return;
|
||||
|
||||
Func<NWInterface, bool> func = (v) =>
|
||||
{
|
||||
callback (v);
|
||||
return true;
|
||||
};
|
||||
EnumerateInterfaces (func);
|
||||
}
|
||||
#endif // !XAMCORE_5_0
|
||||
|
||||
[BindingImpl (BindingImplOptions.Optimizable)]
|
||||
public void EnumerateInterfaces (Func<NWInterface, bool> callback)
|
||||
{
|
||||
if (callback is null)
|
||||
return;
|
||||
|
@ -181,19 +202,45 @@ namespace Network {
|
|||
[DllImport (Constants.NetworkLibrary)]
|
||||
static extern void nw_path_enumerate_gateways (IntPtr path, ref BlockLiteral enumerate_block);
|
||||
|
||||
delegate void nw_path_enumerate_gateways_t (IntPtr block, IntPtr endpoint);
|
||||
// Returning 'byte' since 'bool' isn't blittable
|
||||
delegate byte nw_path_enumerate_gateways_t (IntPtr block, IntPtr endpoint);
|
||||
static nw_path_enumerate_gateways_t static_EnumerateGatewaysHandler = TrampolineGatewaysHandler;
|
||||
|
||||
[MonoPInvokeCallback (typeof (nw_path_enumerate_gateways_t))]
|
||||
static void TrampolineGatewaysHandler (IntPtr block, IntPtr endpoint)
|
||||
static byte TrampolineGatewaysHandler (IntPtr block, IntPtr endpoint)
|
||||
{
|
||||
var del = BlockLiteral.GetTarget<Action<NWEndpoint>> (block);
|
||||
var del = BlockLiteral.GetTarget<Func<NWEndpoint, bool>> (block);
|
||||
if (del is not null) {
|
||||
var nwEndpoint = new NWEndpoint (endpoint, owns: false);
|
||||
del (nwEndpoint);
|
||||
return del (nwEndpoint) ? (byte) 1 : (byte) 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !XAMCORE_5_0
|
||||
#if NET
|
||||
[SupportedOSPlatform ("tvos13.0")]
|
||||
[SupportedOSPlatform ("macos10.15")]
|
||||
[SupportedOSPlatform ("ios13.0")]
|
||||
[SupportedOSPlatform ("maccatalyst")]
|
||||
#else
|
||||
[TV (13,0)]
|
||||
[Mac (10,15)]
|
||||
[iOS (13,0)]
|
||||
#endif
|
||||
[Obsolete ("Use the overload that takes a 'Func<NWEndpoint, bool>' instead.")]
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
public void EnumerateGateways (Action<NWEndpoint> callback)
|
||||
{
|
||||
Func<NWEndpoint,bool> func = (v) =>
|
||||
{
|
||||
callback (v);
|
||||
return true;
|
||||
};
|
||||
EnumerateGateways (func);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET
|
||||
[SupportedOSPlatform ("tvos13.0")]
|
||||
[SupportedOSPlatform ("macos10.15")]
|
||||
|
@ -205,13 +252,13 @@ namespace Network {
|
|||
[iOS (13,0)]
|
||||
#endif
|
||||
[BindingImpl (BindingImplOptions.Optimizable)]
|
||||
public void EnumerateGateways (Action<NWEndpoint> callback)
|
||||
public void EnumerateGateways (Func<NWEndpoint, bool> callback)
|
||||
{
|
||||
if (callback is null)
|
||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (callback));
|
||||
|
||||
BlockLiteral block_handler = new BlockLiteral ();
|
||||
block_handler.SetupBlockUnsafe (static_Enumerator, callback);
|
||||
block_handler.SetupBlockUnsafe (static_EnumerateGatewaysHandler, callback);
|
||||
|
||||
try {
|
||||
nw_path_enumerate_gateways (GetCheckedHandle (), ref block_handler);
|
||||
|
|
|
@ -1274,8 +1274,9 @@ namespace AVFoundation {
|
|||
[Export ("interleaved")]
|
||||
bool Interleaved { [Bind ("isInterleaved")] get; }
|
||||
|
||||
[Internal]
|
||||
[Export ("streamDescription")]
|
||||
AudioStreamBasicDescription StreamDescription { get; }
|
||||
IntPtr _StreamDescription { get; }
|
||||
|
||||
[Export ("channelLayout"), NullAllowed]
|
||||
AVAudioChannelLayout ChannelLayout { get; }
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Cecil.Tests {
|
|||
}
|
||||
|
||||
// TODO: Events?
|
||||
Assert.That (found, Is.Empty, "Obsolete API");
|
||||
Assert.That (found, Is.Empty, "Obsolete API: add '[EditorBrowsable (EditorBrowsableState.Never)]' for newly obsoleted API to pass this test.");
|
||||
}
|
||||
|
||||
bool FilterMember (ICustomAttributeProvider provider)
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// Whitney Schmidt (whschm@microsoft.com)
|
||||
// Copyright 2020 Microsoft Corp.
|
||||
|
||||
using System;
|
||||
|
||||
using AudioToolbox;
|
||||
using Foundation;
|
||||
using AVFoundation;
|
||||
using NUnit.Framework;
|
||||
|
@ -59,5 +62,20 @@ namespace MonoTouchFixtures.AVFoundation {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void StreamDescription ()
|
||||
{
|
||||
var format = new AVAudioFormat (AVAudioCommonFormat.PCMFloat32, 44100.0, 2, true);
|
||||
var desc = format.StreamDescription;
|
||||
Assert.AreEqual (AudioFormatType.LinearPCM, desc.Format, "Format");
|
||||
Assert.AreEqual (AudioFormatFlags.LinearPCMIsFloat | AudioFormatFlags.LinearPCMIsPacked, desc.FormatFlags, "FormatFlags");
|
||||
Assert.AreEqual (8, desc.BytesPerPacket, "BytesPerPacket");
|
||||
Assert.AreEqual (1, desc.FramesPerPacket, "FramesPerPacket");
|
||||
Assert.AreEqual (8, desc.BytesPerFrame, "BytesPerFrame");
|
||||
Assert.AreEqual (2, desc.ChannelsPerFrame, "ChannelsPerFrame");
|
||||
Assert.AreEqual (32, desc.BitsPerChannel, "BitsPerChannel");
|
||||
Assert.AreEqual (0, desc.Reserved, "Reserved");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,19 +162,43 @@ namespace MonoTouchFixtures.Network {
|
|||
{
|
||||
TestRuntime.AssertXcodeVersion (11, 0);
|
||||
|
||||
Assert.Throws<ArgumentNullException> (() => { path.EnumerateGateways (null); });
|
||||
Assert.Throws<ArgumentNullException> (() => { path.EnumerateGateways ((Func<NWEndpoint, bool>) null); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EnumerateGatewayTest ()
|
||||
{
|
||||
TestRuntime.AssertXcodeVersion (11, 0);
|
||||
var e = new AutoResetEvent (false);
|
||||
path.EnumerateGateways ((endPoint) => {
|
||||
Assert.IsNotNull (endPoint);
|
||||
e.Set ();
|
||||
});
|
||||
e.WaitOne (10000);
|
||||
var e1 = new ManualResetEvent (false);
|
||||
var e2 = new ManualResetEvent (false);
|
||||
var monitor = new NWPathMonitor ();
|
||||
try {
|
||||
monitor.SetQueue (DispatchQueue.DefaultGlobalQueue);
|
||||
monitor.Start ();
|
||||
monitor.SnapshotHandler += path =>
|
||||
{
|
||||
path.EnumerateGateways (gateway =>
|
||||
{
|
||||
e1.Set ();
|
||||
return true;
|
||||
});
|
||||
|
||||
path.EnumerateInterfaces (@interface =>
|
||||
{
|
||||
e2.Set ();
|
||||
return true;
|
||||
});
|
||||
};
|
||||
TestRuntime.RunAsync (TimeSpan.FromSeconds (5),
|
||||
() => { },
|
||||
() => WaitHandle.WaitAll (new WaitHandle [] { e1, e2 }, 0));
|
||||
var rv = WaitHandle.WaitAll (new WaitHandle [] { e1, e2 }, 10000);
|
||||
if (!rv)
|
||||
TestRuntime.IgnoreInCI ("This test doesn't seem to be working on the bots, uncommon network setup?");
|
||||
Assert.IsTrue (rv, "Called back");
|
||||
} finally {
|
||||
monitor.Cancel ();
|
||||
monitor.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash -ex
|
||||
|
||||
# Go to the top level directory
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
SRC_DIR=$(pwd)
|
||||
|
||||
# Go one directory up, to avoid any global.json in xamarin-macios
|
||||
cd ..
|
||||
|
||||
# Start formatting!
|
||||
dotnet format "$SRC_DIR/tools/xibuild/xibuild.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/tests/cecil-tests/cecil-tests.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Messaging/Xamarin.Messaging.Build/Xamarin.Messaging.Build.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.Localization.MSBuild/Xamarin.Localization.MSBuild.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Tasks.Windows.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj"
|
||||
dotnet format whitespace "$SRC_DIR/tools/dotnet-linker/dotnet-linker.csproj"
|
||||
|
||||
# dotnet format "$SRC_DIR/[...]"
|
||||
# add more projects here...
|
||||
|
||||
cd "$SRC_DIR"
|
|
@ -428,7 +428,7 @@ public class Frameworks : Dictionary<string, Framework> {
|
|||
{ "MLCompute", "MLCompute", new Version (14,0), NotAvailableInSimulator },
|
||||
{ "NearbyInteraction", "NearbyInteraction", 14,0 },
|
||||
{ "ScreenTime", "ScreenTime", 14,0 },
|
||||
{ "SensorKit", "SensorKit", 14,0 },
|
||||
{ "SensorKit", "SensorKit", new Version (14, 0), null, true }, /* not always present on device, e.g. any iPad, so must be weak linked; https://github.com/xamarin/xamarin-macios/issues/9938 */
|
||||
{ "UniformTypeIdentifiers", "UniformTypeIdentifiers", 14,0 },
|
||||
|
||||
{ "AdServices", "AdServices", 14,3 },
|
||||
|
|
|
@ -16,6 +16,7 @@ steps:
|
|||
- bash: |
|
||||
sudo rm -Rf $(Build.SourcesDirectory)/artifacts
|
||||
displayName: "Remove artifacts"
|
||||
condition: always()
|
||||
|
||||
- template: uninstall-certificates/v1.yml@templates
|
||||
parameters:
|
||||
|
|
|
@ -116,6 +116,11 @@ steps:
|
|||
AUTH_TOKEN_VSENG_XAMARIN_MAC_DEVICES_P12: ${{ parameters.xqaCertPass }}
|
||||
AUTH_TOKEN_VSENG_XAMARIN_MAC_DEVICES_2_P12: ${{ parameters.xqaCertPass }}
|
||||
|
||||
- bash: |
|
||||
sudo rm -Rf $(Build.SourcesDirectory)/artifacts
|
||||
displayName: "Remove artifacts"
|
||||
condition: always()
|
||||
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: Download artifacts
|
||||
inputs:
|
||||
|
|
|
@ -63,6 +63,11 @@ steps:
|
|||
displayName: Generate constants files
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- bash: |
|
||||
sudo rm -Rf $(Build.SourcesDirectory)/artifacts
|
||||
displayName: "Remove artifacts"
|
||||
condition: always()
|
||||
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: Download artifacts
|
||||
inputs:
|
||||
|
|
Загрузка…
Ссылка в новой задаче