diff --git a/Make.config b/Make.config
index dceb7608cb8d..e90e9e8cb83b 100644
--- a/Make.config
+++ b/Make.config
@@ -256,8 +256,20 @@ MACCATALYST_SDK_VERSION=$(word 1, $(subst ., ,$(MACCATALYST_NUGET_VERSION))).$(w
MAX_IOS_DEPLOYMENT_TARGET=$(IOS_SDK_VERSION)
MAX_TVOS_DEPLOYMENT_TARGET=$(TVOS_SDK_VERSION)
+# Decide which OS version we should run the simulator tests in.
+# Note that this may not necessarily match the SDK version, if there are OS releases with no API changes, then there wouldn't necessarily be a corresponding SDK version.
+# If the errors below trigger, update the hardcoded Xcode version check (currently 26.3) to use the current Xcode version, and assign the corresponding max simulator versions.
+ifeq ($(XCODE_VERSION),26.3)
+MAX_IOS_SIMULATOR_VERSION=26.3
+MAX_TVOS_SIMULATOR_VERSION=26.2
+else ifneq ($(XCODE_VERSION),$(IOS_SDK_VERSION))
+$(error Check if a max iOS simulator is different than the current SDK version (this happens when there's a new iOS release, with no API changes so no new SDK))
+else ifneq ($(XCODE_VERSION),$(TVOS_SDK_VERSION))
+$(error Check if a max tvOS simulator is different than the current SDK version (this happens when there's a new tvOS release, with no API changes so no new SDK))
+else
MAX_IOS_SIMULATOR_VERSION=$(IOS_SDK_VERSION)
MAX_TVOS_SIMULATOR_VERSION=$(TVOS_SDK_VERSION)
+endif
# Minimum OS versions for running XI/XM apps.
MIN_IOS_SDK_VERSION=12.2
diff --git a/src/CoreGraphics/CGFont.cs b/src/CoreGraphics/CGFont.cs
index b286fe47dd04..71ab4c33e784 100644
--- a/src/CoreGraphics/CGFont.cs
+++ b/src/CoreGraphics/CGFont.cs
@@ -48,10 +48,10 @@ internal CGFont (NativeHandle handle, bool owns)
{
}
- static CGFont Create (IntPtr handle)
+ static CGFont? Create (IntPtr handle)
{
if (handle == IntPtr.Zero)
- ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handle));
+ return null;
return new CGFont (handle, true);
}
@@ -74,29 +74,27 @@ protected internal override void Release ()
[DllImport (Constants.CoreGraphicsLibrary)]
extern static /* CGFontRef */ IntPtr CGFontCreateWithDataProvider (/* CGDataProviderRef __nullable */ IntPtr provider);
+ /// Creates a font from a data provider.
/// Data provider that wraps the font.
- /// Creates a font from a data provider.
- /// The constructed font.
- ///
- ///
- /// You can use this method to create CGFonts from an
- /// in-memory representation of the font (for example, to
- /// embed binary fonts into your application to prevent easy
- /// copying of licensed fonts, or when you fetch the font from
- /// a streaming source and do not want to store it on disk).
- ///
- ///
- ///
- /// The constructed font, or in case of failure.
+ ///
+ ///
+ /// You can use this method to create instances from an
+ /// in-memory representation of the font (for example, to
+ /// embed binary fonts into your application to prevent easy
+ /// copying of licensed fonts, or when you fetch the font from
+ /// a streaming source and do not want to store it on disk).
+ ///
+ ///
+ ///
- ///
- ///
+ ///
+ ///
public static CGFont? CreateFromProvider (CGDataProvider provider)
{
// the API accept a `nil` argument but returns `nil`, we take a shortcut (no native call)
@@ -111,22 +109,24 @@ protected internal override void Release ()
[DllImport (Constants.CoreGraphicsLibrary)]
extern static /* CGFontRef */ IntPtr CGFontCreateWithFontName (/* CFStringRef __nullable */ IntPtr name);
- /// To be added.
- /// Creates a new CGFont representing the specified PostScript or full name.
- /// To be added.
- /// To be added.
+ /// Creates a new representing the specified PostScript or full name.
+ /// The PostScript or full name of the font.
+ /// The new , or if is or no matching font is found.
+ ///
+ ///
+ /// This method looks up a font by its PostScript name or full
+ /// name. If no font matching is found,
+ /// the method returns .
+ ///
+ ///
public static CGFont? CreateWithFontName (string name)
{
// the API accept a `nil` argument but returns `nil`, we take a shortcut (no native call)
// and have a unit tests to make sure this behavior does not change over time
if (name is null)
return null;
- var nameHandle = CFString.CreateNative (name);
- try {
- return Create (CGFontCreateWithFontName (nameHandle));
- } finally {
- CFString.ReleaseNative (nameHandle);
- }
+ var nameHandle = new TransientCFString (name);
+ return Create (CGFontCreateWithFontName (nameHandle));
}
//[DllImport (Constants.CoreGraphicsLibrary)]
diff --git a/tests/common/TestRuntime.cs b/tests/common/TestRuntime.cs
index caf521f4e25c..7febf3e26ca2 100644
--- a/tests/common/TestRuntime.cs
+++ b/tests/common/TestRuntime.cs
@@ -479,6 +479,16 @@ public static bool CheckXcodeVersion (int major, int minor, int build = 0)
return CheckMacSystemVersion (26, 2);
#else
throw new NotImplementedException ($"Missing platform case for Xcode {major}.{minor}");
+#endif
+ case 3:
+#if __TVOS__
+ return ChecktvOSSystemVersion (26, 3);
+#elif __IOS__
+ return CheckiOSSystemVersion (26, 3);
+#elif MONOMAC
+ return CheckMacSystemVersion (26, 3);
+#else
+ throw new NotImplementedException ($"Missing platform case for Xcode {major}.{minor}");
#endif
default:
throw new NotImplementedException ($"Missing version logic for checking for Xcode {major}.{minor}");
diff --git a/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt b/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt
index 7bb88c521706..fd07fe8f58d8 100644
--- a/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt
+++ b/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt
@@ -1,14 +1,14 @@
-AppBundleSize: 3,610,430 bytes (3,525.8 KB = 3.4 MB)
+AppBundleSize: 3,598,151 bytes (3,513.8 KB = 3.4 MB)
# The following list of files and their sizes is just informational / for review, and isn't used in the test:
_CodeSignature/CodeResources: 3,997 bytes (3.9 KB = 0.0 MB)
archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB)
-Info.plist: 1,164 bytes (1.1 KB = 0.0 MB)
-Microsoft.iOS.dll: 149,504 bytes (146.0 KB = 0.1 MB)
+Info.plist: 1,173 bytes (1.1 KB = 0.0 MB)
+Microsoft.iOS.dll: 150,528 bytes (147.0 KB = 0.1 MB)
PkgInfo: 8 bytes (0.0 KB = 0.0 MB)
runtimeconfig.bin: 1,405 bytes (1.4 KB = 0.0 MB)
-SizeTestApp: 2,404,544 bytes (2,348.2 KB = 2.3 MB)
+SizeTestApp: 2,391,216 bytes (2,335.2 KB = 2.3 MB)
SizeTestApp.dll: 7,680 bytes (7.5 KB = 0.0 MB)
-System.Private.CoreLib.aotdata.arm64: 41,296 bytes (40.3 KB = 0.0 MB)
+System.Private.CoreLib.aotdata.arm64: 41,312 bytes (40.3 KB = 0.0 MB)
System.Private.CoreLib.dll: 987,136 bytes (964.0 KB = 0.9 MB)
System.Runtime.dll: 5,120 bytes (5.0 KB = 0.0 MB)
System.Runtime.InteropServices.dll: 8,192 bytes (8.0 KB = 0.0 MB)
diff --git a/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt b/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt
index ba6711914953..da150421c7be 100644
--- a/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt
+++ b/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt
@@ -1,14 +1,14 @@
-AppBundleSize: 9,357,320 bytes (9,138.0 KB = 8.9 MB)
+AppBundleSize: 9,320,619 bytes (9,102.2 KB = 8.9 MB)
# The following list of files and their sizes is just informational / for review, and isn't used in the test:
_CodeSignature/CodeResources: 5,229 bytes (5.1 KB = 0.0 MB)
aot-instances.aotdata.arm64: 827,592 bytes (808.2 KB = 0.8 MB)
archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB)
-Info.plist: 1,138 bytes (1.1 KB = 0.0 MB)
-Microsoft.iOS.aotdata.arm64: 22,832 bytes (22.3 KB = 0.0 MB)
-Microsoft.iOS.dll: 47,616 bytes (46.5 KB = 0.0 MB)
+Info.plist: 1,173 bytes (1.1 KB = 0.0 MB)
+Microsoft.iOS.aotdata.arm64: 22,880 bytes (22.3 KB = 0.0 MB)
+Microsoft.iOS.dll: 48,640 bytes (47.5 KB = 0.0 MB)
PkgInfo: 8 bytes (0.0 KB = 0.0 MB)
runtimeconfig.bin: 1,481 bytes (1.4 KB = 0.0 MB)
-SizeTestApp: 7,256,864 bytes (7,086.8 KB = 6.9 MB)
+SizeTestApp: 7,219,056 bytes (7,049.9 KB = 6.9 MB)
SizeTestApp.aotdata.arm64: 1,456 bytes (1.4 KB = 0.0 MB)
SizeTestApp.dll: 7,168 bytes (7.0 KB = 0.0 MB)
System.Private.CoreLib.aotdata.arm64: 640,736 bytes (625.7 KB = 0.6 MB)
diff --git a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt
index fc32a822989c..57096102d5aa 100644
--- a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt
+++ b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt
@@ -1,8 +1,8 @@
-AppBundleSize: 2,450,623 bytes (2,393.2 KB = 2.3 MB)
+AppBundleSize: 2,437,082 bytes (2,380.0 KB = 2.3 MB)
# The following list of files and their sizes is just informational / for review, and isn't used in the test:
_CodeSignature/CodeResources: 2,589 bytes (2.5 KB = 0.0 MB)
archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB)
-Info.plist: 1,130 bytes (1.1 KB = 0.0 MB)
+Info.plist: 1,173 bytes (1.1 KB = 0.0 MB)
PkgInfo: 8 bytes (0.0 KB = 0.0 MB)
runtimeconfig.bin: 1,808 bytes (1.8 KB = 0.0 MB)
-SizeTestApp: 2,444,704 bytes (2,387.4 KB = 2.3 MB)
+SizeTestApp: 2,431,120 bytes (2,374.1 KB = 2.3 MB)
diff --git a/tests/monotouch-test/CoreGraphics/BitmapContextTest.cs b/tests/monotouch-test/CoreGraphics/BitmapContextTest.cs
index f8077805850d..fc32c3fbac7c 100644
--- a/tests/monotouch-test/CoreGraphics/BitmapContextTest.cs
+++ b/tests/monotouch-test/CoreGraphics/BitmapContextTest.cs
@@ -109,164 +109,244 @@ public void ToImage ()
}
[Test]
- public void CreateAdaptive ()
+ public void CreateAdaptive_1 ()
{
TestRuntime.AssertXcodeVersion (26, 0);
nuint width = 256;
nuint height = 256;
- {
+ using (var pool = new NSAutoreleasePool ()) {
using var context = CGBitmapContext.Create (width, height, (NSDictionary?) null, null, null, null, null);
Assert.NotNull (context, "Context#1");
}
+ }
- {
- var calledOnResolve = false;
- var calledOnAllocate = false;
- var calledOnFree = false;
- var calledOnError = false;
+ [Test]
+ public void CreateAdaptive_2 ()
+ {
+ TestRuntime.AssertXcodeVersion (26, 0);
+
+ nuint width = 256;
+ nuint height = 256;
+
+ var calledOnLockPointer = false;
+ var calledOnUnlockPointer = false;
+ var calledOnReleaseInfo = false;
+
+ var calledOnResolve = false;
+ var calledOnAllocate = false;
+ var calledOnFree = false;
+ var calledOnError = false;
+
+ using (var pool = new NSAutoreleasePool ()) {
using var context = CGBitmapContext.Create (width, height, (CGAdaptiveOptions?) null,
(ref CGContentInfo info, ref CGBitmapParameters parameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnResolve#2 info={info} parameters={parameters}");
+ // TestRuntime.NSLog ($"CreateAdaptive () OnResolve#2 info={info} parameters={parameters}");
calledOnResolve = true;
return true;
},
(ref CGContentInfo info, ref CGBitmapParameters parameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnAllocate#2 info={info} parameters={parameters}");
+ // TestRuntime.NSLog ($"CreateAdaptive () OnAllocate#2 info={info} parameters={parameters}");
calledOnAllocate = true;
- return null;
+ var renderingBufferProviderSize = checked(parameters.AlignedBytesPerRow * parameters.Height);
+ var renderingBufferProvider = CGRenderingBufferProvider.Create (IntPtr.Zero, renderingBufferProviderSize,
+ lockPointer: (info) => {
+ calledOnLockPointer = true;
+ var rv = Marshal.AllocHGlobal (checked((nint) renderingBufferProviderSize));
+ // TestRuntime.NSLog ($"CreateAdaptive3 () OnLockPointer#2 (0x{info:x}) => 0x{rv:x}");
+ return rv;
+ },
+ unlockPointer: (info, pointer) => {
+ // TestRuntime.NSLog ($"CreateAdaptive3 () OnUnlockPointer#2 (0x{info:x}, 0x{pointer:x})");
+ calledOnUnlockPointer = true;
+ Marshal.FreeHGlobal (pointer);
+ },
+ releaseInfo: (info) => {
+ // TestRuntime.NSLog ($"CreateAdaptive3 () OnReleaseInfo#2 (0x{info:x})");
+ calledOnReleaseInfo = true;
+ }
+ );
+ return renderingBufferProvider;
},
(CGRenderingBufferProvider renderingBufferProvider, ref CGContentInfo contentInfo, ref CGBitmapParameters bitmapParameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnFree#2 renderingBufferProvider={renderingBufferProvider} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
+ // TestRuntime.NSLog ($"CreateAdaptive () OnFree#2 renderingBufferProvider={renderingBufferProvider} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
calledOnFree = true;
},
(NSError error, ref CGContentInfo contentInfo, ref CGBitmapParameters bitmapParameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnError#2 error={error} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
+ // TestRuntime.NSLog ($"CreateAdaptive () OnError#2 error={error} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
calledOnError = true;
});
Assert.NotNull (context, "Context#2");
- // This fails because onAllocate returns null
using var img = context.ToImage ();
- Assert.Null (img, "ToImage");
-
- Assert.That (calledOnResolve, Is.True, "calledOnResolve#2");
- Assert.That (calledOnAllocate, Is.True, "calledOnAllocate#2");
- Assert.That (calledOnFree, Is.False, "calledOnFree#2");
- Assert.That (calledOnError, Is.True, "calledOnError#2");
+ Assert.NotNull (img, "ToImage");
}
- {
- var calledOnResolve = false;
- var calledOnAllocate = false;
- var calledOnFree = false;
- var calledOnError = false;
- var options = new CGAdaptiveOptions () {
- MaximumBitDepth = CGComponent.Float16Bit,
- };
+ Assert.That (calledOnResolve, Is.True, "calledOnResolve#2");
+ Assert.That (calledOnAllocate, Is.True, "calledOnAllocate#2");
+ Assert.That (calledOnFree, Is.True, "calledOnFree#2");
+ Assert.That (calledOnError, Is.False, "calledOnError#2");
+
+ Assert.That (calledOnLockPointer, Is.True, "calledOnLockPointer#2");
+ Assert.That (calledOnUnlockPointer, Is.True, "calledOnUnlockPointer#2");
+ Assert.That (calledOnReleaseInfo, Is.False, "calledOnReleaseInfo#2");
+ }
+
+ [Test]
+ public void CreateAdaptive_3 ()
+ {
+ TestRuntime.AssertXcodeVersion (26, 0);
+
+ nuint width = 256;
+ nuint height = 256;
+
+ var calledOnLockPointer = false;
+ var calledOnUnlockPointer = false;
+ var calledOnReleaseInfo = false;
+
+ var calledOnResolve = false;
+ var calledOnAllocate = false;
+ var calledOnFree = false;
+ var calledOnError = false;
+ var options = new CGAdaptiveOptions () {
+ MaximumBitDepth = CGComponent.Float16Bit,
+ };
+
+ using (var pool = new NSAutoreleasePool ()) {
using var context = CGBitmapContext.Create (width, height, options,
(ref CGContentInfo info, ref CGBitmapParameters parameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnResolve#3 info={info} parameters={parameters}");
+ // TestRuntime.NSLog ($"CreateAdaptive () OnResolve#3 info={info} parameters={parameters}");
calledOnResolve = true;
return true;
},
(ref CGContentInfo info, ref CGBitmapParameters parameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnAllocate#3 info={info} parameters={parameters}");
+ // TestRuntime.NSLog ($"CreateAdaptive () OnAllocate#3 info={info} parameters={parameters}");
calledOnAllocate = true;
- return null;
+ var renderingBufferProviderSize = checked(parameters.AlignedBytesPerRow * parameters.Height);
+ var renderingBufferProvider = CGRenderingBufferProvider.Create (IntPtr.Zero, renderingBufferProviderSize,
+ lockPointer: (info) => {
+ calledOnLockPointer = true;
+ var rv = Marshal.AllocHGlobal (checked((nint) renderingBufferProviderSize));
+ // TestRuntime.NSLog ($"CreateAdaptive3 () OnLockPointer#3 (0x{info:x}) => 0x{rv:x}");
+ return rv;
+ },
+ unlockPointer: (info, pointer) => {
+ // TestRuntime.NSLog ($"CreateAdaptive3 () OnUnlockPointer#3 (0x{info:x}, 0x{pointer:x})");
+ calledOnUnlockPointer = true;
+ Marshal.FreeHGlobal (pointer);
+ },
+ releaseInfo: (info) => {
+ // TestRuntime.NSLog ($"CreateAdaptive3 () OnReleaseInfo#3 (0x{info:x})");
+ calledOnReleaseInfo = true;
+ }
+ );
+ return renderingBufferProvider;
},
(CGRenderingBufferProvider renderingBufferProvider, ref CGContentInfo contentInfo, ref CGBitmapParameters bitmapParameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnFree#3 renderingBufferProvider={renderingBufferProvider} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
+ // TestRuntime.NSLog ($"CreateAdaptive () OnFree#3 renderingBufferProvider={renderingBufferProvider} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
calledOnFree = true;
},
(NSError error, ref CGContentInfo contentInfo, ref CGBitmapParameters bitmapParameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnError#3 error={error} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
+ // TestRuntime.NSLog ($"CreateAdaptive () OnError#3 error={error} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
calledOnError = true;
});
Assert.NotNull (context, "Context#3");
- // This fails because onAllocate returns null
using var img = context.ToImage ();
- Assert.Null (img, "ToImage");
-
- Assert.That (calledOnResolve, Is.True, "calledOnResolve#3");
- Assert.That (calledOnAllocate, Is.True, "calledOnAllocate#3");
- Assert.That (calledOnFree, Is.False, "calledOnFree#3");
- Assert.That (calledOnError, Is.True, "calledOnError#3");
+ Assert.NotNull (img, "ToImage");
}
+ Assert.That (calledOnResolve, Is.True, "calledOnResolve#3");
+ Assert.That (calledOnAllocate, Is.True, "calledOnAllocate#3");
+ Assert.That (calledOnFree, Is.True, "calledOnFree#3");
+ Assert.That (calledOnError, Is.False, "calledOnError#3");
+
+ Assert.That (calledOnLockPointer, Is.True, "calledOnLockPointer#3");
+ Assert.That (calledOnUnlockPointer, Is.True, "calledOnUnlockPointer#3");
+ Assert.That (calledOnReleaseInfo, Is.False, "calledOnReleaseInfo#3");
+ }
+
+ [Test]
+ public void CreateAdaptive_4 ()
+ {
+ TestRuntime.AssertXcodeVersion (26, 0);
+
+ nuint width = 256;
+ nuint height = 256;
+
+ var calledOnLockPointer = false;
+ var calledOnUnlockPointer = false;
+ var calledOnReleaseInfo = false;
+ CGRenderingBufferProvider? externalBufferProvider = null;
+
+ using (var pool = new NSAutoreleasePool ()) {
+ var calledOnResolve = false;
+ var calledOnAllocate = false;
+ var calledOnFree = false;
+ var calledOnError = false;
+ var options = new CGAdaptiveOptions () {
+ MaximumBitDepth = CGComponent.Float16Bit,
+ };
- {
- var calledOnLockPointer = false;
- var calledOnUnlockPointer = false;
- var calledOnReleaseInfo = false;
- const int renderingBufferProviderSize = 512;
- using (var renderingBufferProvider = CGRenderingBufferProvider.Create (IntPtr.Zero, renderingBufferProviderSize,
- lockPointer: (info) => {
- calledOnLockPointer = true;
- var rv = Marshal.AllocHGlobal (renderingBufferProviderSize);
- // Console.WriteLine ($"CreateAdaptive () OnLockPointer#4 ({info}) => {rv}");
- return rv;
+ using (var context = CGBitmapContext.Create (width, height, options,
+ (ref CGContentInfo info, ref CGBitmapParameters parameters) => {
+ // TestRuntime.NSLog ($"CreateAdaptive () OnResolve#4 info={info} parameters={parameters}");
+ calledOnResolve = true;
+ return true;
},
- unlockPointer: (info, pointer) => {
- // Console.WriteLine ($"CreateAdaptive () OnUnlockPointer#4 ({info}, {pointer})");
- calledOnUnlockPointer = true;
- Marshal.FreeHGlobal (pointer);
+ (ref CGContentInfo info, ref CGBitmapParameters parameters) => {
+ // TestRuntime.NSLog ($"CreateAdaptive () OnAllocate#4 info={info} parameters={parameters}");
+ calledOnAllocate = true;
+ var renderingBufferProviderSize = checked(parameters.AlignedBytesPerRow * parameters.Height);
+ externalBufferProvider = CGRenderingBufferProvider.Create (IntPtr.Zero, renderingBufferProviderSize,
+ lockPointer: (info) => {
+ calledOnLockPointer = true;
+ var rv = Marshal.AllocHGlobal (checked((nint) renderingBufferProviderSize));
+ // TestRuntime.NSLog ($"CreateAdaptive () OnLockPointer#4 (0x{info:x}) => 0x{rv:x}");
+ return rv;
+ },
+ unlockPointer: (info, pointer) => {
+ // TestRuntime.NSLog ($"CreateAdaptive () OnUnlockPointer#4 (0x{info:x}, 0x{pointer:x})");
+ calledOnUnlockPointer = true;
+ Marshal.FreeHGlobal (pointer);
+ },
+ releaseInfo: (info) => {
+ // TestRuntime.NSLog ($"CreateAdaptive () OnReleaseInfo#4 (0x{info:x})");
+ calledOnReleaseInfo = true;
+ }
+ );
+ return externalBufferProvider;
},
- releaseInfo: (info) => {
- // Console.WriteLine ($"CreateAdaptive () OnReleaseInfo#4 ({info})");
- calledOnReleaseInfo = true;
- }
- )) {
- Assert.That (renderingBufferProvider, Is.Not.Null, "RenderingBufferProvider");
-
- var calledOnResolve = false;
- var calledOnAllocate = false;
- var calledOnFree = false;
- var calledOnError = false;
- var options = new CGAdaptiveOptions () {
- MaximumBitDepth = CGComponent.Float16Bit,
- };
-
- using (var context = CGBitmapContext.Create (width, height, options,
- (ref CGContentInfo info, ref CGBitmapParameters parameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnResolve#4 info={info} parameters={parameters}");
- calledOnResolve = true;
- return true;
- },
- (ref CGContentInfo info, ref CGBitmapParameters parameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnAllocate#4 info={info} parameters={parameters}");
- calledOnAllocate = true;
- return renderingBufferProvider;
- },
- (CGRenderingBufferProvider renderingBufferProvider, ref CGContentInfo contentInfo, ref CGBitmapParameters bitmapParameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnFree#4 renderingBufferProvider={renderingBufferProvider} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
- calledOnFree = true;
- },
- (NSError error, ref CGContentInfo contentInfo, ref CGBitmapParameters bitmapParameters) => {
- TestRuntime.NSLog ($"CreateAdaptive () OnError#4 error={error} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
- calledOnError = true;
- })) {
-
- Assert.NotNull (context, "Context#4");
-
- using var img = context.ToImage ();
- Assert.NotNull (img, "ToImage");
- }
-
- Assert.That (calledOnResolve, Is.True, "calledOnResolve#4");
- Assert.That (calledOnAllocate, Is.True, "calledOnAllocate#4");
- Assert.That (calledOnFree, Is.True, "calledOnFree#4");
- Assert.That (calledOnError, Is.False, "calledOnError#4");
+ (CGRenderingBufferProvider renderingBufferProvider, ref CGContentInfo contentInfo, ref CGBitmapParameters bitmapParameters) => {
+ // TestRuntime.NSLog ($"CreateAdaptive () OnFree#4 renderingBufferProvider={renderingBufferProvider} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
+ calledOnFree = true;
+ },
+ (NSError error, ref CGContentInfo contentInfo, ref CGBitmapParameters bitmapParameters) => {
+ // TestRuntime.NSLog ($"CreateAdaptive () OnError#4 error={error} contentInfo={contentInfo} bitmapParameters={bitmapParameters}");
+ calledOnError = true;
+ })) {
+
+ Assert.NotNull (context, "Context#4");
+
+ using var img = context.ToImage ();
+ Assert.NotNull (img, "ToImage");
}
- Assert.That (calledOnLockPointer, Is.True, "calledOnLockPointer#4");
- Assert.That (calledOnUnlockPointer, Is.True, "calledOnUnlockPointer#4");
- Assert.That (calledOnReleaseInfo, Is.False, "calledOnReleaseInfo#4");
+ Assert.That (calledOnResolve, Is.True, "calledOnResolve#4");
+ Assert.That (calledOnAllocate, Is.True, "calledOnAllocate#4");
+ Assert.That (calledOnFree, Is.True, "calledOnFree#4");
+ Assert.That (calledOnError, Is.False, "calledOnError#4");
}
+
+ // Explicitly dispose the buffer provider to verify releaseInfo is called.
+ externalBufferProvider?.Dispose ();
+
+ Assert.That (calledOnLockPointer, Is.True, "calledOnLockPointer#4");
+ Assert.That (calledOnUnlockPointer, Is.True, "calledOnUnlockPointer#4");
+ Assert.That (calledOnReleaseInfo, Is.True, "calledOnReleaseInfo#4");
}
}
}
diff --git a/tests/monotouch-test/CoreGraphics/CGRenderingBufferProviderTest.cs b/tests/monotouch-test/CoreGraphics/CGRenderingBufferProviderTest.cs
index f09328ab1ebd..2b0a69b7db42 100644
--- a/tests/monotouch-test/CoreGraphics/CGRenderingBufferProviderTest.cs
+++ b/tests/monotouch-test/CoreGraphics/CGRenderingBufferProviderTest.cs
@@ -32,27 +32,26 @@ public void SizeProperty_DoesNotThrow ()
var calledOnLockPointer = false;
var calledOnUnlockPointer = false;
var calledOnReleaseInfo = false;
- var provider = CGRenderingBufferProvider.Create ((nint) 0x0ee1f00d, (nuint) size,
- lockPointer: (info) => {
- calledOnLockPointer = true;
- var rv = Marshal.AllocHGlobal (size);
- // Console.WriteLine ($"CreateAdaptive () OnLockPointer#4 ({info}) => {rv}");
- return rv;
- },
- unlockPointer: (info, pointer) => {
- // Console.WriteLine ($"CreateAdaptive () OnUnlockPointer#4 ({info}, {pointer})");
- calledOnUnlockPointer = true;
- Marshal.FreeHGlobal (pointer);
- },
- releaseInfo: (info) => {
- // Console.WriteLine ($"CreateAdaptive () OnReleaseInfo#4 ({info})");
- calledOnReleaseInfo = true;
- });
- Assert.That (provider, Is.Not.Null, "provider");
- Assert.That (provider.Size, Is.EqualTo ((nuint) size), "size");
+ using (var pool = new NSAutoreleasePool ()) {
+ using var provider = CGRenderingBufferProvider.Create ((nint) 0x0ee1f00d, (nuint) size,
+ lockPointer: (info) => {
+ calledOnLockPointer = true;
+ var rv = Marshal.AllocHGlobal (size);
+ return rv;
+ },
+ unlockPointer: (info, pointer) => {
+ calledOnUnlockPointer = true;
+ Marshal.FreeHGlobal (pointer);
+ },
+ releaseInfo: (info) => {
+ calledOnReleaseInfo = true;
+ });
+ Assert.That (provider, Is.Not.Null, "provider");
+ Assert.That (provider.Size, Is.EqualTo ((nuint) size), "size");
+ }
Assert.That (calledOnLockPointer, Is.EqualTo (false), "calledOnLockPointer");
Assert.That (calledOnUnlockPointer, Is.EqualTo (false), "calledOnUnlockPointer");
- Assert.That (calledOnReleaseInfo, Is.EqualTo (false), "calledOnReleaseInfo");
+ Assert.That (calledOnReleaseInfo, Is.EqualTo (true), "calledOnReleaseInfo");
}
[Test]
diff --git a/tests/monotouch-test/CoreText/FontTest.cs b/tests/monotouch-test/CoreText/FontTest.cs
index fc00ed2dd3b0..2cc954e4cd89 100644
--- a/tests/monotouch-test/CoreText/FontTest.cs
+++ b/tests/monotouch-test/CoreText/FontTest.cs
@@ -7,6 +7,8 @@
// Copyright 2015 Xamarin Inc. All rights reserved.
//
+using System.Linq;
+
using CoreGraphics;
using CoreText;
#if MONOMAC
@@ -82,7 +84,7 @@ public void GetLocalizedName ()
[Test]
public void GetGlyphsForCharacters_35048 ()
{
- using (var font = CGFont.CreateWithFontName ("AppleColorEmoji"))
+ using (var font = CreateAppleColorEmojiFont ())
using (var ctfont = font.ToCTFont ((nfloat) 10.0)) {
ushort [] gid = new ushort [2];
Assert.True (ctfont.GetGlyphsForCharacters ("\ud83d\ude00".ToCharArray (), gid), "GetGlyphsForCharacters");
@@ -115,6 +117,14 @@ public void CTFontCreateForStringWithLanguage ()
}
}
+ static CGFont CreateAppleColorEmojiFont ()
+ {
+ var font = CGFont.CreateWithFontName ("AppleColorEmoji");
+ if (font is null)
+ Assert.Ignore ("Unable to create the 'AppleColorEmoji' font.");
+ return font;
+ }
+
[Test]
public void CTFontCopyNameForGlyph ()
{
@@ -123,7 +133,7 @@ public void CTFontCopyNameForGlyph ()
using (var ctfont = new CTFont ("HoeflerText-Regular", 10, CTFontOptions.Default))
Assert.That (ctfont.GetGlyphName ((ushort) 65), Is.EqualTo ("asciicircum"), "1");
- using (var font = CGFont.CreateWithFontName ("AppleColorEmoji"))
+ using (var font = CreateAppleColorEmojiFont ())
using (var ctfont = font.ToCTFont ((nfloat) 10.0))
Assert.Null (ctfont.GetGlyphName ('\ud83d'), "2");
}
@@ -149,7 +159,11 @@ public void GetTypographicBoundsForAdaptiveImageProvider ()
using var font = new CTFont ("HoeflerText-Regular", 10, CTFontOptions.Default);
using var provider = new AdaptiveImageProvider ();
var bounds = font.GetTypographicBoundsForAdaptiveImageProvider (provider);
- Assert.AreEqual (new CGRect (0, -3.90625, 13, 16.40625), bounds, "Bounds");
+ var candidates = new object [] {
+ new CGRect (0, -3.90625, 13, 16.40625),
+ new CGRect (0, -3.90625, 35, 16.40625)
+ };
+ Assert.That (bounds, Is.AnyOf (candidates).Using ((x, y) => x == y), "Bounds");
Assert.AreEqual (0, provider.Count, "#Count");
}
diff --git a/tests/monotouch-test/VideoToolbox/VTDecompressionSessionTests.cs b/tests/monotouch-test/VideoToolbox/VTDecompressionSessionTests.cs
index 2c829c5ffd16..f18077f9c735 100644
--- a/tests/monotouch-test/VideoToolbox/VTDecompressionSessionTests.cs
+++ b/tests/monotouch-test/VideoToolbox/VTDecompressionSessionTests.cs
@@ -191,6 +191,7 @@ public void DecodeFrameTest ()
});
Assert.That (session.FinishDelayedFrames (), Is.EqualTo (VTStatus.Ok), "FinishDelayedFrames");
+ Assert.That (session.WaitForAsynchronousFrames (), Is.EqualTo (VTStatus.Ok), "WaitForAsynchronousFrames");
Assert.That (frameCallbackCounter, Is.GreaterThan (0), "Frame callback counter");
Assert.That (failures, Is.Empty, "Failures");
}
@@ -228,6 +229,7 @@ public void DecodeFrameMultiImageCallbackTest ()
});
Assert.That (session.FinishDelayedFrames (), Is.EqualTo (VTStatus.Ok), "FinishDelayedFrames");
+ Assert.That (session.WaitForAsynchronousFrames (), Is.EqualTo (VTStatus.Ok), "WaitForAsynchronousFrames");
Assert.That (frameCallbackCounter, Is.GreaterThan (0), "Frame callback counter 2");
Assert.That (failures, Is.Empty, "Failures");
}
@@ -278,6 +280,7 @@ public void DecodeFrameSetMultiImageCallbackTest ()
});
Assert.That (session.FinishDelayedFrames (), Is.EqualTo (VTStatus.Ok), "FinishDelayedFrames");
+ Assert.That (session.WaitForAsynchronousFrames (), Is.EqualTo (VTStatus.Ok), "WaitForAsynchronousFrames");
Assert.That (frameCallbackCounter, Is.GreaterThan (0), "Frame callback counter 2");
Assert.That (failures, Is.Empty, "Failures");
}
@@ -313,6 +316,7 @@ public void DecodeFrameCallbackTest ()
Assert.That (status, Is.EqualTo (VTStatus.Ok), "DecodeFrame");
});
Assert.That (session.FinishDelayedFrames (), Is.EqualTo (VTStatus.Ok), "FinishDelayedFrames");
+ Assert.That (session.WaitForAsynchronousFrames (), Is.EqualTo (VTStatus.Ok), "WaitForAsynchronousFrames");
Assert.That (frameCallbackCounter, Is.EqualTo (0), "Frame callback counter 3");
Assert.That (inlineCallback, Is.GreaterThan (0), "Frame callback counter 4");
diff --git a/tests/monotouch-test/xamvideotest.mp4 b/tests/monotouch-test/xamvideotest.mp4
index ce6a6378f25c..8478d85c03b9 100644
Binary files a/tests/monotouch-test/xamvideotest.mp4 and b/tests/monotouch-test/xamvideotest.mp4 differ
diff --git a/tools/common/SdkVersions.cs b/tools/common/SdkVersions.cs
index faebc29003f2..7fe747c3fecf 100644
--- a/tools/common/SdkVersions.cs
+++ b/tools/common/SdkVersions.cs
@@ -32,7 +32,7 @@ static class SdkVersions {
public const string MiniOSSimulator = "16.0";
public const string MinTVOSSimulator = "16.0";
- public const string MaxiOSSimulator = "26.2";
+ public const string MaxiOSSimulator = "26.3";
public const string MaxTVOSSimulator = "26.2";
public const string MaxiOSDeploymentTarget = "26.2";
diff --git a/tools/devops/automation/build-pipeline.yml b/tools/devops/automation/build-pipeline.yml
index 2d8a209f94b1..032878bcaca5 100644
--- a/tools/devops/automation/build-pipeline.yml
+++ b/tools/devops/automation/build-pipeline.yml
@@ -14,7 +14,7 @@ parameters:
- name: macOSName # comes from the build agent demand named macOS.Name
displayName: Name of the version of macOS to use
type: string
- default: 'Sequoia'
+ default: 'Tahoe'
- name: runGovernanceTests
displayName: Run Governance Checks
diff --git a/tools/devops/automation/build-pull-request.yml b/tools/devops/automation/build-pull-request.yml
index f0ca3413ef85..e2117e12ee44 100644
--- a/tools/devops/automation/build-pull-request.yml
+++ b/tools/devops/automation/build-pull-request.yml
@@ -15,7 +15,7 @@ parameters:
- name: macOSName # comes from the build agent demand named macOS.Name
displayName: Name of the version of macOS to use
type: string
- default: 'Sequoia'
+ default: 'Tahoe'
- name: runGovernanceTests
displayName: Run Governance Checks
diff --git a/tools/devops/automation/run-nightly-codeql.yml b/tools/devops/automation/run-nightly-codeql.yml
index bdfd3a2a7d4b..a32ac49a35e7 100644
--- a/tools/devops/automation/run-nightly-codeql.yml
+++ b/tools/devops/automation/run-nightly-codeql.yml
@@ -14,7 +14,7 @@ parameters:
- name: macOSName # comes from the build agent demand named macOS.Name
displayName: Name of the version of macOS to use
type: string
- default: 'Sequoia'
+ default: 'Tahoe'
resources:
repositories:
diff --git a/tools/devops/automation/scripts/.gitignore b/tools/devops/automation/scripts/.gitignore
new file mode 100644
index 000000000000..89923e7760bc
--- /dev/null
+++ b/tools/devops/automation/scripts/.gitignore
@@ -0,0 +1,2 @@
+_provisionator
+
diff --git a/tools/devops/automation/scripts/provisionator-bootstrap.sh b/tools/devops/automation/scripts/provisionator-bootstrap.sh
new file mode 100755
index 000000000000..143cfa4bf75e
--- /dev/null
+++ b/tools/devops/automation/scripts/provisionator-bootstrap.sh
@@ -0,0 +1,131 @@
+#!/bin/bash -e
+# shellcheck disable=SC2220,SC2181
+#
+# Remove the following GUID if you do not wish for this script self-update:
+# D6F71FB5-F2A7-4A62-86D3-10DFE08301CC
+# https://github.com/xamarin/provisionator
+
+while getopts ":t:" opt; do
+ case "${opt}" in
+ t)
+ TOKEN=${OPTARG}
+ shift 2
+ ;;
+ esac
+done
+
+function selfdir { (cd "$(dirname "$1")"; echo "$PWD"; ) }
+
+selfdir=$(selfdir "$0")
+
+channel="${PROVISIONATOR_CHANNEL:-latest}"
+
+provisionator_sas_token=$AUTH_TOKEN_PROVISIONATOR
+if [[ -n $provisionator_sas_token ]]; then
+ echo "Downloading Provisionator directly from BosStorageMirror Azure blob storage"
+ base_url="https://bosstoragemirror.blob.core.windows.net/provisionator/664bd334021e3102cdef1af66c4fc9f1b2ecd2a21b47419e80d08da1f6c61c2a/${channel}"
+else
+ # Grab auth token from Environment first
+ # Otherwise set to provided option, if available
+ base_url="https://dl.internalx.com/provisionator/664bd334021e3102cdef1af66c4fc9f1b2ecd2a21b47419e80d08da1f6c61c2a/${channel}"
+ auth_token=$AUTH_TOKEN_GITHUB_COM
+ if [[ -z $auth_token ]]; then
+ echo "Setting auth_token to input token and not AUTH_TOKEN_GITHUB_COM"
+ auth_token=$TOKEN
+ fi
+ if [[ -z $auth_token ]]; then
+ echo "WARNING: Please set AUTH_TOKEN_GITHUB_COM to a GitHub PAT before running provisionator or run provisionator.sh -t ..."
+ echo "At a future point, Provisionator will not be able to bootstrap without the PAT set properly"
+ base_url="https://bosstoragemirror.blob.core.windows.net/provisionator/664bd334021e3102cdef1af66c4fc9f1b2ecd2a21b47419e80d08da1f6c61c2a/${channel}"
+ fi
+fi
+
+latest_version_url="${base_url}/version"
+
+if [[ -n $provisionator_sas_token ]]; then
+ echo "latest_version_url: Appending SAS token"
+ latest_version_url="${latest_version_url}?${provisionator_sas_token}"
+fi
+
+archive_name="provisionator.osx.10.11-x64.zip"
+archive_path="${selfdir}/${archive_name}"
+archive_extract_path="${selfdir}/_provisionator"
+archive_url="${base_url}/${archive_name}"
+if [[ -n $provisionator_sas_token ]]; then
+ echo "archive_url: Appending SAS token"
+ archive_url="${archive_url}?${provisionator_sas_token}"
+fi
+
+binary_path="${archive_extract_path}/provisionator"
+pk_path="${archive_extract_path}/pk"
+
+set +e
+
+# Double brackets are required for the following condition to evaulate as expected
+if [[ -z $auth_token ]] || [[ -n $provisionator_sas_token ]]; then
+ if [[ -n $provisionator_sas_token ]]; then
+ echo "Fetching latest version with SAS token"
+ else
+ echo "Fetching latest version without auth token"
+ fi
+ latest_version="$(curl -fsL "${latest_version_url}")"
+else
+ echo "Fetching latest version with auth token"
+ latest_version="$(curl -fsL -H "Authorization: token ${auth_token}" "${latest_version_url}")"
+fi
+if [[ $? != 0 ]]; then
+ echo "Unable to determine latest version from ${latest_version_url}"
+ echo "Please check to make sure a valid GitHub PAT was provided"
+ exit 1
+fi
+set -e
+
+function update_in_place {
+ echo "Downloading Provisionator $latest_version..."
+ local progress_type="-s"
+ tty -s && progress_type="-#"
+ if [[ -z $auth_token ]] || [[ -n $provisionator_sas_token ]]; then
+ curl -fL $progress_type -o "$archive_path" "$archive_url"
+ else
+ curl -fLH "Authorization: token ${auth_token}" $progress_type -o "$archive_path" "$archive_url"
+ fi
+ rm -rf "$archive_extract_path"
+ unzip -q -o -d "$archive_extract_path" "$archive_path"
+ rm -f "$archive_path"
+}
+
+if [[ -f "$binary_path" ]]; then
+ chmod +x "$binary_path"
+ current_version="$("$binary_path" -version 2>&1 || true)"
+ if [[ "$latest_version" != "$current_version" ]]; then
+ update_in_place
+ fi
+else
+ update_in_place
+fi
+
+# Check for the pk (PackageKitTool) binary, which should be included in the provisionator macOS ZIP package
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ echo "Checking for PackageKitTool (pk) binary..."
+ if [[ -f "$pk_path" ]]; then
+ echo "PackageKitTool (pk) binary found: ${pk_path}"
+ echo "chmod +x ${pk_path}"
+ chmod +x "$pk_path"
+ else
+ echo "ERROR: pk file not found: ${pk_path}"
+ exit 5
+ fi
+fi
+
+# Opt out of macOS backward compat so correct Big Sur OS versions can be obtained.
+# More info https://github.com/ziglang/zig/issues/7569
+export SYSTEM_VERSION_COMPAT=0
+
+# TODO: The executable permission should be applied here. However, since this script is reflective of production scripts used by other clients/teams avoid modifying the executable permission here.
+# A reason to avoid this is that the executable permission is expected to be preserved in the ZIP file produced by the ClientTools.Provisionator build pipeline
+# CONSIDER: A possible follow up item would be to go update all the production scripts to apply the executable permission here to ensure the provisionator binary has the executable permission set
+# This may also involve updating the Provisionator Azure DevOps provisionator task to ensure it applies the executable attribute after ZIP extraction
+# https://devdiv.visualstudio.com/Engineering/_git/xamarin-azdev-extension?path=/provisionator-task
+# echo "Applying executable attribute: ${binary_path}"
+# chmod +x "$binary_path"
+exec caffeinate "$binary_path" "$@"
diff --git a/tools/devops/automation/templates/build/build.yml b/tools/devops/automation/templates/build/build.yml
index d3d9951de246..ae746a2d4776 100644
--- a/tools/devops/automation/templates/build/build.yml
+++ b/tools/devops/automation/templates/build/build.yml
@@ -85,14 +85,12 @@ steps:
make -C $(Build.SourcesDirectory)/$(BUILD_REPOSITORY_TITLE)/tools/devops provisioning
displayName: 'Generate provisionator files.'
- - task: xamops.azdevex.provisionator-task.provisionator@2
- displayName: 'Provision Products & Frameworks'
- inputs:
+ - template: ../common/provision.yml
+ parameters:
provisioning_script: $(Build.SourcesDirectory)/$(BUILD_REPOSITORY_TITLE)/tools/devops/build-provisioning.csx
- provisioning_extra_args: '-vvvv'
- github_token: ${{ parameters.gitHubToken }}
- timeoutInMinutes: 250
- retryCountOnTaskFailure: ${{ parameters.retryCount }} # mono does give issues sometimes to download, we will retry
+ displayName: 'Provision Products & Frameworks'
+ provisionatorChannel: $(PROVISIONATOR_CHANNEL)
+ retryCount: ${{ parameters.retryCount }} # mono does give issues sometimes to download, we will retry
- bash: |
set -x
diff --git a/tools/devops/automation/templates/common/provision.yml b/tools/devops/automation/templates/common/provision.yml
new file mode 100644
index 000000000000..6424ffd2103d
--- /dev/null
+++ b/tools/devops/automation/templates/common/provision.yml
@@ -0,0 +1,116 @@
+# yamllint disable rule:line-length
+# Template to run provisionator via the bootstrap script with BosStorageMirror SAS token auth.
+# This replaces the xamops.azdevex.provisionator-task.provisionator@3 task to avoid
+# dl.internalx.com timeout issues under concurrent load.
+
+parameters:
+ - name: provisioning_script
+ type: string
+
+ - name: displayName
+ type: string
+ default: 'Provisionator'
+
+ - name: provisionatorChannel
+ type: string
+ default: 'latest'
+
+ - name: provisioning_extra_args
+ type: string
+ default: '-vvvv'
+
+ - name: timeoutInMinutes
+ type: number
+ default: 250
+
+ - name: retryCount
+ type: number
+ default: 0
+
+ - name: enabled
+ type: boolean
+ default: true
+
+steps:
+ - task: AzureCLI@2
+ displayName: 'Generate BosStorageMirror SAS tokens'
+ condition: and(succeeded(), ${{ parameters.enabled }})
+ inputs:
+ azureSubscription: 'Xamarin - RelEng (BosStorageMirror-Contributor-MI)'
+ scriptType: 'bash'
+ scriptLocation: 'inlineScript'
+ failOnStandardError: true
+ inlineScript: |
+ set -euo pipefail
+
+ storage_account="bosstoragemirror"
+
+ # macOS/BSD date syntax for expiry calculation
+ start_time="$(date -u '+%Y-%m-%dT%H:%MZ')"
+ prov_expiry="$(date -u -v+20M '+%Y-%m-%dT%H:%MZ')"
+ files_expiry="$(date -u -v+3H '+%Y-%m-%dT%H:%MZ')"
+
+ echo "Generating provisionator SAS token (expires $prov_expiry)..."
+ sas_provisionator="$(az storage container generate-sas \
+ --account-name "$storage_account" \
+ --name provisionator \
+ --permissions r \
+ --start "$start_time" \
+ --expiry "$prov_expiry" \
+ --https-only \
+ --as-user \
+ --auth-mode login \
+ -o tsv)"
+
+ if [[ -z "$sas_provisionator" || ${#sas_provisionator} -le 16 ]]; then
+ echo "ERROR: Failed to generate SAS token for BosStorageMirror provisionator container"
+ exit 1
+ fi
+
+ echo "Generating internal-files SAS token (expires $files_expiry)..."
+ sas_internal_files="$(az storage container generate-sas \
+ --account-name "$storage_account" \
+ --name internal-files \
+ --permissions r \
+ --start "$start_time" \
+ --expiry "$files_expiry" \
+ --https-only \
+ --as-user \
+ --auth-mode login \
+ -o tsv)"
+
+ if [[ -z "$sas_internal_files" || ${#sas_internal_files} -le 16 ]]; then
+ echo "ERROR: Failed to generate SAS token for BosStorageMirror internal-files container"
+ exit 1
+ fi
+
+ prov_hint="${sas_provisionator:0:8}...${sas_provisionator: -8}"
+ files_hint="${sas_internal_files:0:8}...${sas_internal_files: -8}"
+
+ echo "sasTokenProvisionator [hint]: $prov_hint"
+ echo "sasToken [hint]: $files_hint"
+
+ echo "##vso[task.setvariable variable=Provisionator.SASToken;issecret=true]$sas_provisionator"
+ echo "##vso[task.setvariable variable=Provisionator.SASTokenHint]$prov_hint"
+ echo "##vso[task.setvariable variable=BosStorageMirror.SASToken;issecret=true]$sas_internal_files"
+ echo "##vso[task.setvariable variable=BosStorageMirror.SASTokenHint]$files_hint"
+
+ - bash: |
+ set -x
+ set -e
+
+ BOOTSTRAP_SCRIPT="$(Build.SourcesDirectory)/$(BUILD_REPOSITORY_TITLE)/tools/devops/automation/scripts/provisionator-bootstrap.sh"
+ chmod +x "$BOOTSTRAP_SCRIPT"
+
+ echo "Provisionator channel: ${PROVISIONATOR_CHANNEL}"
+ echo "Provisioning script: ${{ parameters.provisioning_script }}"
+
+ "$BOOTSTRAP_SCRIPT" ${{ parameters.provisioning_script }} ${{ parameters.provisioning_extra_args }} || exit 2
+ displayName: '${{ parameters.displayName }}'
+ condition: and(succeeded(), ${{ parameters.enabled }})
+ env:
+ PROVISIONATOR_CHANNEL: ${{ parameters.provisionatorChannel }}
+ AUTH_TOKEN_PROVISIONATOR: $(Provisionator.SASToken)
+ AUTH_TOKEN_BOSSTORAGEMIRROR: $(BosStorageMirror.SASToken)
+ timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
+ retryCountOnTaskFailure: ${{ parameters.retryCount }}
diff --git a/tools/devops/automation/templates/mac/build.yml b/tools/devops/automation/templates/mac/build.yml
index 9b59ebabc2cb..e08a5b0eed5f 100644
--- a/tools/devops/automation/templates/mac/build.yml
+++ b/tools/devops/automation/templates/mac/build.yml
@@ -96,14 +96,13 @@ steps:
displayName: 'Set VM Vendor'
-- task: xamops.azdevex.provisionator-task.provisionator@2
- displayName: 'Provision Brew components'
- inputs:
+- template: ../common/provision.yml
+ parameters:
provisioning_script: $(Build.SourcesDirectory)/$(BUILD_REPOSITORY_TITLE)/tools/devops/provision-brew-packages.csx
- provisioning_extra_args: '-vvvv'
- github_token: $(Github.Token)
- timeoutInMinutes: 30
- enabled: false
+ displayName: 'Provision Brew components'
+ provisionatorChannel: $(PROVISIONATOR_CHANNEL)
+ timeoutInMinutes: 30
+ enabled: false
- bash: |
sudo rm -Rf $(Build.SourcesDirectory)/package
diff --git a/tools/devops/automation/templates/pipelines/api-diff-pipeline.yml b/tools/devops/automation/templates/pipelines/api-diff-pipeline.yml
index 94ac5b176cd6..4f7753475d67 100644
--- a/tools/devops/automation/templates/pipelines/api-diff-pipeline.yml
+++ b/tools/devops/automation/templates/pipelines/api-diff-pipeline.yml
@@ -11,7 +11,7 @@ parameters:
- name: macOSName # comes from the build agent demand named macOS.Name
displayName: Name of the version of macOS to use
type: string
- default: 'Sequoia'
+ default: 'Tahoe'
- name: pool
type: string
diff --git a/tools/devops/automation/templates/pipelines/build-pipeline.yml b/tools/devops/automation/templates/pipelines/build-pipeline.yml
index b0407ca93886..1293841671b3 100644
--- a/tools/devops/automation/templates/pipelines/build-pipeline.yml
+++ b/tools/devops/automation/templates/pipelines/build-pipeline.yml
@@ -11,7 +11,7 @@ parameters:
- name: macOSName # comes from the build agent demand named macOS.Name
displayName: Name of the version of macOS to use
type: string
- default: 'Sequoia'
+ default: 'Tahoe'
- name: pool
type: string
diff --git a/tools/devops/automation/templates/pipelines/run-tests-pipeline.yml b/tools/devops/automation/templates/pipelines/run-tests-pipeline.yml
index 618c8def6418..5cbf25b469f1 100644
--- a/tools/devops/automation/templates/pipelines/run-tests-pipeline.yml
+++ b/tools/devops/automation/templates/pipelines/run-tests-pipeline.yml
@@ -14,7 +14,7 @@ parameters:
- name: macOSName # comes from the build agent demand named macOS.Name
displayName: Name of the version of macOS to use
type: string
- default: 'Sequoia'
+ default: 'Tahoe'
- name: runTests
displayName: Run Simulator Tests
diff --git a/tools/devops/automation/templates/tests/build.yml b/tools/devops/automation/templates/tests/build.yml
index 2ce9d00de007..c65b8b8fba67 100644
--- a/tools/devops/automation/templates/tests/build.yml
+++ b/tools/devops/automation/templates/tests/build.yml
@@ -203,13 +203,11 @@ steps:
condition: ${{ parameters.clearProvisionatorCache }}
# Use the provisionator to install the test dependencies. Those have been generated in the 'Generate Provisionator csx file' step.
-- task: xamops.azdevex.provisionator-task.provisionator@2
- displayName: 'Provisionator dependencies'
- inputs:
+- template: ../common/provision.yml
+ parameters:
provisioning_script: $(System.DefaultWorkingDirectory)/$(BUILD_REPOSITORY_TITLE)/tools/devops/build-provisioning.csx
- provisioning_extra_args: '-vvvv'
- github_token: ${{ parameters.gitHubToken }}
- timeoutInMinutes: 250
+ displayName: 'Provisionator dependencies'
+ provisionatorChannel: $(PROVISIONATOR_CHANNEL)
- task: UseDotNet@2
inputs:
diff --git a/tools/devops/automation/templates/windows/reserve-mac.yml b/tools/devops/automation/templates/windows/reserve-mac.yml
index f743429443c0..3b6aca762a7b 100644
--- a/tools/devops/automation/templates/windows/reserve-mac.yml
+++ b/tools/devops/automation/templates/windows/reserve-mac.yml
@@ -99,13 +99,11 @@ steps:
rm -f ~/Library/Preferences/Xamarin/Settings.plist
displayName: 'Clear old Xcode settings'
-- task: xamops.azdevex.provisionator-task.provisionator@2
- displayName: 'Provision Xcode'
- inputs:
+- template: ../common/provision.yml
+ parameters:
provisioning_script: $(System.DefaultWorkingDirectory)/$(BUILD_REPOSITORY_TITLE)/tools/devops/provision-xcode.csx
- provisioning_extra_args: '-vvvv'
- github_token: ${{ parameters.gitHubToken }}
- timeoutInMinutes: 250
+ displayName: 'Provision Xcode'
+ provisionatorChannel: $(PROVISIONATOR_CHANNEL)
- task: UseDotNet@2
inputs: