diff --git a/.github/workflows/update-single-platform-branches.yml b/.github/workflows/update-single-platform-branches.yml index 0a0deab61fa4..e5c75d63a120 100644 --- a/.github/workflows/update-single-platform-branches.yml +++ b/.github/workflows/update-single-platform-branches.yml @@ -28,7 +28,7 @@ jobs: set -ex git config user.email "github-actions-single-platform-branch-updater@xamarin.com" git config user.name "GitHub Actions Single Platform Branch Updater" - for platform in dotnet-iOS dotnet-tvOS dotnet-MacCatalyst dotnet-macOS dotnet; do + for platform in dotnet-iOS dotnet-tvOS dotnet-MacCatalyst dotnet-macOS; do git checkout -b release-test/only-$platform origin/release-test/only-$platform git merge origin/main git push diff --git a/.gitignore b/.gitignore index f152fefaf654..d7c8df4a40a7 100644 --- a/.gitignore +++ b/.gitignore @@ -34,9 +34,7 @@ tests/bcl-test/SystemCoreXunit*.csproj tests/bcl-test/SystemXunit.csproj global.json .idea -device-tests-provisioning.csx -build-provisioning.csx -provision-xcode.csx +provision-shared.csx mono_crash.*.json *.binlog .vscode diff --git a/Make.config b/Make.config index 1cf09339a6a8..6842ebe01c79 100644 --- a/Make.config +++ b/Make.config @@ -44,10 +44,10 @@ include $(TOP)/Make.versions # The value is taken from the name + version of the Ref pack. # Example: given the Ref pack "Microsoft.iOS.Ref.net8.0_17.5" with the version "17.5.8030", the value # to write here would be the part after "Microsoft.iOS.Ref." + "/" + version: "net8.0_17.5/17.5.8030" -STABLE_NUGET_VERSION_iOS=net8.0_17.5/17.5.8030 -STABLE_NUGET_VERSION_tvOS=net8.0_17.5/17.5.8030 -STABLE_NUGET_VERSION_MacCatalyst=net8.0_17.5/17.5.8030 -STABLE_NUGET_VERSION_macOS=net8.0_14.5/14.5.8030 +STABLE_NUGET_VERSION_iOS=net8.0_18.0/18.0.8303 +STABLE_NUGET_VERSION_tvOS=net8.0_18.0/18.0.8303 +STABLE_NUGET_VERSION_MacCatalyst=net8.0_18.0/18.0.8303 +STABLE_NUGET_VERSION_macOS=net8.0_15.0/15.0.8303 PACKAGE_HEAD_REV=$(shell git rev-parse HEAD) @@ -748,9 +748,6 @@ EMSCRIPTEN_MANIFEST_VERSION_BAND=$(DOTNET_MANIFEST_VERSION_BAND_WITH_PRERELEASE_ # It should typically be $(DOTNET_MANIFEST_VERSION_BAND_WITH_PRERELEASE_COMPONENT), unless we decide to hardcode it to something else MACIOS_MANIFEST_VERSION_BAND=$(DOTNET_MANIFEST_VERSION_BAND_WITH_PRERELEASE_COMPONENT) -# Set this to 1 if the Microsoft.NETCore.App.Ref dependency in eng/Version.Details.xml does *not* specify a CoherentParentDependency on VS.Tools.Net.Core.SDK.Resolver. -TRACKING_DOTNET_RUNTIME_SEPARATELY= - # The location of csc changes depending on whether we're using a preview or a stable/service release :/ DOTNET_CSC_PATH_PREVIEW=$(DOTNET_DIR)/sdk/$(DOTNET_VERSION)/Roslyn/bincore/csc.dll DOTNET_CSC_PATH_STABLE=$(DOTNET_DIR)/sdk/$(DOTNET_VERSION_BAND)/Roslyn/bincore/csc.dll diff --git a/Makefile b/Makefile index ef263bb0ceaa..5f79a6024671 100644 --- a/Makefile +++ b/Makefile @@ -110,6 +110,7 @@ else @echo endif endif + $(Q) $(MAKE) -C dotnet shutdown-build-server .PHONY: package release package release: diff --git a/dotnet/Makefile b/dotnet/Makefile index 6e54ef326dcf..7e1eb766c266 100644 --- a/dotnet/Makefile +++ b/dotnet/Makefile @@ -550,4 +550,9 @@ all-hook:: $(Q) $(MAKE) shutdown-build-server shutdown-build-server: - $(Q) $(DOTNET) build-server shutdown + $(Q) echo "Shutting down build servers:" + $(Q) $(DOTNET) build-server shutdown | sed 's/^/ /' || true + $(Q) echo "Listing .NET processes still alive:" + $(Q) pgrep -lf "^$(DOTNET)" | sed 's/^/ /' || true + $(Q) echo "Killing the above mentioned processes." + $(Q) pkill -9 -f "^$(DOTNET)" | sed 's/^/ /' || true diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 63b930ae7f1f..dc7dff2aa87d 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -1540,6 +1540,11 @@ <_NativeExecutableFrameworks Include="Security" /> + + <_NativeExecutableFrameworks Remove="BrowserEngineKit" Condition="'$(LinkWithBrowserEngineKit)' != 'true'" /> + <_MainLinkerFlags Include="-lz" /> <_MainLinkerFlags Include="-liconv" /> diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 70438f62d6e0..c944a42768eb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -78,9 +78,9 @@ https://github.com/dotnet/templating - + https://github.com/dotnet/xharness - edae8a9491f747ba2a36023075aa3ac57be4d32e + 7d5c32dbda0c6c8b9dc20cde4e1261b191896138 diff --git a/eng/Versions.props b/eng/Versions.props index fca800893758..f79e90fe3d43 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -12,7 +12,7 @@ 9.0.0-rc.2.24462.10 7.0.100-alpha.1.21601.1 0.11.5-alpha.24467.1 - 10.0.0-prerelease.24467.4 + 10.0.0-prerelease.24476.1 $(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version) $(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version) diff --git a/mk/xamarin.mk b/mk/xamarin.mk index a1590c9054be..45698e3896d6 100644 --- a/mk/xamarin.mk +++ b/mk/xamarin.mk @@ -18,7 +18,7 @@ endif # Available versions can be seen here: # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/Microsoft.Tools.Mlaunch/versions -MLAUNCH_NUGET_VERSION=1.0.256 +MLAUNCH_NUGET_VERSION=1.0.261 define CheckVersionTemplate check-$(1):: diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs index 52c9b5357cd7..8c6d713e2e2a 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs @@ -2,6 +2,8 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Reflection.Metadata; +using System.Reflection.PortableExecutable; using System.Text; using System.Collections.Generic; @@ -15,7 +17,6 @@ namespace Xamarin.MacDev.Tasks { public class UnpackLibraryResources : XamarinTask, ITaskCallback, ICancelableTask { - MetadataLoadContext? universe; List unpackedResources = new List (); #region Inputs @@ -26,9 +27,6 @@ public class UnpackLibraryResources : XamarinTask, ITaskCallback, ICancelableTas [Required] public string IntermediateOutputPath { get; set; } = string.Empty; - [Required] - public ITaskItem [] ReferenceAssemblies { get; set; } = Array.Empty (); - [Required] public ITaskItem [] ReferencedLibraries { get; set; } = Array.Empty (); @@ -52,15 +50,6 @@ public class UnpackLibraryResources : XamarinTask, ITaskCallback, ICancelableTas #endregion public override bool Execute () - { - try { - return ExecuteImpl (); - } finally { - universe?.Dispose (); - } - } - - bool ExecuteImpl () { if (ShouldExecuteRemotely ()) { var result = new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result; @@ -87,7 +76,7 @@ bool ExecuteImpl () Log.LogMessage (MessageImportance.Low, MSBStrings.M0168, asm.ItemSpec); } else { var perAssemblyOutputPath = Path.Combine (IntermediateOutputPath, "unpack", asm.GetMetadata ("Filename")); - var extracted = ExtractContentAssembly (asm.ItemSpec, perAssemblyOutputPath).ToArray (); + var extracted = ExtractContentAssembly (asm.ItemSpec, perAssemblyOutputPath); results.AddRange (extracted); @@ -113,58 +102,88 @@ bool IsFrameworkAssembly (ITaskItem asm) return false; } - IEnumerable ExtractContentAssembly (string assembly, string intermediatePath) + List ExtractContentAssembly (string assembly, string intermediatePath) { + var rv = new List (); + if (!File.Exists (assembly)) { Log.LogMessage (MessageImportance.Low, $"Not inspecting assembly because it doesn't exist: {assembly}"); - yield break; + return rv; } - var asmWriteTime = File.GetLastWriteTimeUtc (assembly); - var manifestResources = GetAssemblyManifestResources (assembly).ToArray (); - if (!manifestResources.Any ()) - yield break; - - Log.LogMessage (MessageImportance.Low, $"Inspecting assembly with {manifestResources.Length} resources: {assembly}"); - foreach (var embedded in manifestResources) { - string rpath; - - if (embedded.Name.StartsWith ("__" + Prefix + "_content_", StringComparison.Ordinal)) { - var mangled = embedded.Name.Substring (("__" + Prefix + "_content_").Length); - rpath = UnmangleResource (mangled); - } else if (embedded.Name.StartsWith ("__" + Prefix + "_page_", StringComparison.Ordinal)) { - var mangled = embedded.Name.Substring (("__" + Prefix + "_page_").Length); - rpath = UnmangleResource (mangled); - } else { - continue; - } - - var path = Path.Combine (intermediatePath, rpath); - var file = new FileInfo (path); - - var item = new TaskItem (path); - item.SetMetadata ("LogicalName", rpath); - item.SetMetadata ("Optimize", "false"); - - if (file.Exists && file.LastWriteTimeUtc >= asmWriteTime) { - Log.LogMessage (" Up to date: {0}", rpath); - } else { - Log.LogMessage (" Unpacking: {0}", rpath); - - Directory.CreateDirectory (Path.GetDirectoryName (path)); + try { + var asmWriteTime = File.GetLastWriteTimeUtc (assembly); + using var peStream = File.OpenRead (assembly); + using var peReader = new PEReader (peStream); + var metadataReader = PEReaderExtensions.GetMetadataReader (peReader); + Log.LogMessage (MessageImportance.Low, $"Inspecting resources in assembly {assembly}"); + foreach (var manifestResourceHandle in metadataReader.ManifestResources) { + var manifestResource = metadataReader.GetManifestResource (manifestResourceHandle); + if (!manifestResource.Implementation.IsNil) + continue; // embedded resources have Implementation.IsNil = true, and those are the ones we care about + + var name = metadataReader.GetString (manifestResource.Name); + if (string.IsNullOrEmpty (name)) + continue; + + string rpath; + + if (name.StartsWith ("__" + Prefix + "_content_", StringComparison.Ordinal)) { + var mangled = name.Substring (("__" + Prefix + "_content_").Length); + rpath = UnmangleResource (mangled); + } else if (name.StartsWith ("__" + Prefix + "_page_", StringComparison.Ordinal)) { + var mangled = name.Substring (("__" + Prefix + "_page_").Length); + rpath = UnmangleResource (mangled); + } else { + continue; + } - using (var stream = File.Open (path, FileMode.Create)) { - using (var resource = embedded.Open ()) - resource.CopyTo (stream); + var path = Path.Combine (intermediatePath, rpath); + var file = new FileInfo (path); + + var item = new TaskItem (path); + item.SetMetadata ("LogicalName", rpath); + item.SetMetadata ("Optimize", "false"); + + if (file.Exists && file.LastWriteTimeUtc >= asmWriteTime) { + Log.LogMessage (" Up to date: {0}", rpath); + } else { + Log.LogMessage (" Unpacking: {0}", rpath); + + Directory.CreateDirectory (Path.GetDirectoryName (path)); + + var resourceDirectory = peReader.GetSectionData (peReader.PEHeaders.CorHeader!.ResourcesDirectory.RelativeVirtualAddress); + var reader = resourceDirectory.GetReader ((int) manifestResource.Offset, resourceDirectory.Length - (int) manifestResource.Offset); + var length = reader.ReadUInt32 (); + if (length > reader.RemainingBytes) + throw new BadImageFormatException (); +#if NET + using var fs = new FileStream (path, FileMode.Create, FileAccess.Write, FileShare.Read); + unsafe { + var span = new ReadOnlySpan (reader.CurrentPointer, (int) length); + fs.Write (span); + } +#else + var buffer = new byte [4096]; + using var fs = new FileStream (path, FileMode.Create, FileAccess.Write, FileShare.Read, buffer.Length); + var left = (int) length; + while (left > 0) { + var read = Math.Min (left, buffer.Length); + reader.ReadBytes (read, buffer, 0); + fs.Write (buffer, 0, read); + left -= read; + } +#endif + unpackedResources.Add (item); } - unpackedResources.Add (item); + rv.Add (item); } - - yield return item; + } catch (Exception e) { + Log.LogMessage (MessageImportance.Low, $"Unable to load the resources from the assembly '{assembly}': {e}"); + return new List (); } - - yield break; + return rv; } static string UnmangleResource (string mangled) @@ -237,27 +256,5 @@ public bool ShouldCopyToBuildServer (ITaskItem item) public IEnumerable GetAdditionalItemsToBeCopied () => ItemsFiles; - IEnumerable GetAssemblyManifestResources (string fileName) - { - if (universe is null) - universe = new MetadataLoadContext (new PathAssemblyResolver (ReferenceAssemblies.Select (v => v.ItemSpec))); - - Assembly assembly; - try { - assembly = universe.LoadFromAssemblyPath (fileName); - } catch (Exception e) { - Log.LogMessage (MessageImportance.Low, $"Unable to load the assembly '{fileName}: {e}"); - yield break; - } - - foreach (var resourceName in assembly.GetManifestResourceNames ()) { - if (string.IsNullOrEmpty (resourceName)) - continue; - var info = assembly.GetManifestResourceInfo (resourceName); - if (!info.ResourceLocation.HasFlag (ResourceLocation.Embedded)) - continue; - yield return new ManifestResource (resourceName, () => assembly.GetManifestResourceStream (resourceName)); - } - } } } diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.targets b/msbuild/Xamarin.Shared/Xamarin.Shared.targets index 9313d69f7241..6c9d3ebf9d4a 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.targets +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.targets @@ -1933,7 +1933,9 @@ Copyright (C) 2018 Microsoft. All rights reserved. <_StampDirectory>$(DeviceSpecificIntermediateOutputPath)resourcestamps\ - <_UnpackLibraryResourceItems Include="@(ReferencePath);@(ReferenceDependencyPaths)"> + <_UnpackLibraryResourceItems Include="@(ReferencePath)" Condition="'%(ReferencePath.FrameworkReferenceName)' != 'Microsoft.NETCore.App' And '%(ReferencePath.FrameworkReferenceName)' != 'Microsoft.$(_PlatformName)'" /> + <_UnpackLibraryResourceItems Include="@(ReferenceDependencyPaths)" Condition="'%(ReferenceDependencyPaths.FrameworkReferenceName)' != 'Microsoft.NETCore.App' And '%(ReferenceDependencyPaths.FrameworkReferenceName)' != 'Microsoft.$(_PlatformName)'" /> + <_UnpackLibraryResourceItems> $(_StampDirectory)%(FileName).stamp $(_StampDirectory)%(FileName).items @@ -1982,14 +1984,12 @@ Copyright (C) 2018 Microsoft. All rights reserved. - diff --git a/src/Foundation/DictionaryContainer.cs b/src/Foundation/DictionaryContainer.cs index 5a7918052cb8..d8247bf5cb33 100644 --- a/src/Foundation/DictionaryContainer.cs +++ b/src/Foundation/DictionaryContainer.cs @@ -546,6 +546,7 @@ static public NativeHandle GetHandle (this DictionaryContainer? self) // helper to avoid the (common pattern) // var p = x is null ? null : x.Dictionary; + [return: NotNullIfNotNull (nameof (self))] static public NSDictionary? GetDictionary (this DictionaryContainer? self) { return self is null ? null : self.Dictionary; diff --git a/src/PassKit/PKPayLaterView.cs b/src/PassKit/PKPayLaterView.cs index 49c26d19733e..15457dc99641 100644 --- a/src/PassKit/PKPayLaterView.cs +++ b/src/PassKit/PKPayLaterView.cs @@ -1,72 +1,79 @@ -// Can be uncommented when this issue is resolved: # https://github.com/xamarin/xamarin-macios/issues/19271 +#nullable enable -// #nullable enable +#if IOS && !__MACCATALYST__ -// #if IOS && !__MACCATALYST__ +using System; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; -// using System; -// using System.Runtime.InteropServices; -// using System.Runtime.CompilerServices; -// using ObjCRuntime; -// using Foundation; -// using PassKit; +using Foundation; +using ObjCRuntime; +using PassKit; -// #if !NET -// using NativeHandle = System.IntPtr; -// #endif +namespace PassKit { -// namespace PassKit { + /// The delegate that is called when has determined whether the Pay Later Merchandising information is valid. + /// True if the Pay Later Merchandising information is valid, false otherwise. + public delegate void PKPayLaterViewValidateAmountCallback (bool eligible); -// public partial class PKPayLaterView { + public partial class PKPayLaterView { + [UnmanagedCallersOnly] + static void TrampolineValidateAmount (IntPtr block, byte eligible) + { + var del = BlockLiteral.GetTarget (block); + if (del is not null) { + del (eligible != 0); + } + } -// #if !NET -// delegate void PKPayLaterValidateAmountCompletionHandler (IntPtr block, byte eligible); -// static PKPayLaterValidateAmountCompletionHandler static_ValidateAmount = TrampolineValidateAmount; + /// Checks whether the Pay Later Merchandising information is valid for the specified amount and currency. + /// The amount to check for. + /// The ISO 4217 currency code to use. + /// The delegate that will be called with the result. + [SupportedOSPlatform ("ios17.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos")] + [UnsupportedOSPlatform ("tvos")] + [BindingImpl (BindingImplOptions.Optimizable)] + public static void ValidateAmount (NSDecimalNumber amount, string currencyCode, PKPayLaterViewValidateAmountCallback callback) + { + if (callback is null) + ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (callback)); -// [MonoPInvokeCallback (typeof (PKPayLaterValidateAmountCompletionHandler))] -// #else -// [UnmanagedCallersOnly] -// #endif -// static void TrampolineValidateAmount (IntPtr block, byte eligible) -// { -// var del = BlockLiteral.GetTarget> (block); -// if (del is not null) { -// del (eligible != 0); -// } -// } + unsafe { + delegate* unmanaged trampoline = &TrampolineValidateAmount; + using var block = new BlockLiteral (trampoline, callback, typeof (PKPayLaterView), nameof (TrampolineValidateAmount)); + var nsCurrencyCodePtr = NSString.CreateNative (currencyCode); + try { + PKPayLaterValidateAmount (amount.Handle, nsCurrencyCodePtr, &block); + } finally { + NSString.ReleaseNative (nsCurrencyCodePtr); + } + } + } -// #if NET -// [SupportedOSPlatform ("ios17.0")] -// [UnsupportedOSPlatform ("maccatalyst")] -// [UnsupportedOSPlatform ("macos")] -// [UnsupportedOSPlatform ("tvos")] -// #endif -// [BindingImpl (BindingImplOptions.Optimizable)] -// public static void ValidateAmount (NSDecimalNumber amount, string currencyCode, Action callback) -// { -// if (callback is null) -// ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (callback)); + /// Checks whether the Pay Later Merchandising information is valid for the specified amount and currency. + /// The amount to check for. + /// The ISO 4217 currency code to use. + /// The delegate that will be called with the result. + [SupportedOSPlatform ("ios17.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos")] + [UnsupportedOSPlatform ("tvos")] + [BindingImpl (BindingImplOptions.Optimizable)] + public static void ValidateAmount (decimal amount, string currencyCode, PKPayLaterViewValidateAmountCallback callback) + { + using var decimalAmount = new NSDecimalNumber ((NSDecimal) amount); + ValidateAmount (decimalAmount, currencyCode, callback); + } -// unsafe { -// #if NET -// delegate* unmanaged trampoline = &TrampolineValidateAmount; -// using var block = new BlockLiteral (trampoline, callback, typeof (PKPayLaterView), nameof (TrampolineValidateAmount)); -// #else -// using var block = new BlockLiteral (); -// block.SetupBlockUnsafe (static_ValidateAmount, callback); -// #endif -// var nsCurrencyCodePtr = NSString.CreateNative (currencyCode); -// try { -// PKPayLaterValidateAmount (amount.Handle, nsCurrencyCodePtr, &block); -// } finally { -// NSString.ReleaseNative (nsCurrencyCodePtr); -// } -// } -// } + [SupportedOSPlatform ("ios17.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos")] + [UnsupportedOSPlatform ("tvos")] + [DllImport (Constants.PassKitLibrary)] + unsafe static extern void PKPayLaterValidateAmount (IntPtr /* NSDecimalNumber */ amount, IntPtr /* NSString */ currencyCode, BlockLiteral* callback); + } +} -// [DllImport (Constants.PassKitLibrary)] -// unsafe static extern void PKPayLaterValidateAmount (IntPtr /* NSDecimalNumber */ amount, IntPtr /* NSString */ currencyCode, BlockLiteral* callback); -// } -// } - -// #endif +#endif diff --git a/src/UIKit/UISegmentedControl.cs b/src/UIKit/UISegmentedControl.cs index f80fe2c8f0f9..d3756f66ca79 100644 --- a/src/UIKit/UISegmentedControl.cs +++ b/src/UIKit/UISegmentedControl.cs @@ -8,19 +8,14 @@ // Copyright 2011 Xamarin, Inc // -#if !WATCH - using System; using System.Collections; using Foundation; using ObjCRuntime; using CoreGraphics; +using UIKit; -#if XAMCORE_3_0 -using TextAttributes = UIKit.UIStringAttributes; -#else -using TextAttributes = UIKit.UITextAttributes; -#endif +#nullable enable namespace UIKit { public partial class UISegmentedControl { @@ -92,49 +87,5 @@ static NSArray FromStrings (string [] strings) return NSArray.FromStrings (strings); } - - public void SetTitleTextAttributes (TextAttributes attributes, UIControlState state) - { - if (attributes is null) - throw new ArgumentNullException ("attributes"); - -#if XAMCORE_3_0 - var dict = attributes.Dictionary; -#else - using var dict = attributes.ToDictionary (); -#endif - _SetTitleTextAttributes (dict, state); - } - - public TextAttributes GetTitleTextAttributes (UIControlState state) - { - using (var d = _GetTitleTextAttributes (state)) { - return new TextAttributes (d); - } - } - - public partial class UISegmentedControlAppearance { - public void SetTitleTextAttributes (TextAttributes attributes, UIControlState state) - { - if (attributes is null) - throw new ArgumentNullException ("attributes"); - -#if XAMCORE_3_0 - var dict = attributes.Dictionary; -#else - using var dict = attributes.ToDictionary (); -#endif - _SetTitleTextAttributes (dict, state); - } - - public TextAttributes GetTitleTextAttributes (UIControlState state) - { - using (var d = _GetTitleTextAttributes (state)) { - return new TextAttributes (d); - } - } - } } } - -#endif // !WATCH diff --git a/src/appkit.cs b/src/appkit.cs index 7d9e27e3bca0..3279cb05973a 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -9288,10 +9288,13 @@ interface NSOpenPanel { [ForcedType] // different type used inside a sandbox NSOpenPanel OpenPanel { get; } +#if !XAMCORE_5_0 + [EditorBrowsable (EditorBrowsableState.Never)] [Advice ("You must use 'OpenPanel' method if the application is sandboxed.")] [Deprecated (PlatformName.MacOSX, 10, 15, message: "All open panels now run out-of-process, use 'OpenPanel' method instead")] [Export ("init")] NativeHandle Constructor (); +#endif [Export ("URLs")] NSUrl [] Urls { get; } @@ -13627,10 +13630,13 @@ interface NSSavePanel { [ForcedType] // different type used inside a sandbox NSSavePanel SavePanel { get; } +#if !XAMCORE_5_0 [Advice ("You must use 'SavePanel' method if the application is sandboxed.")] [Deprecated (PlatformName.MacOSX, 10, 15, message: "All save panels now run out-of-process, use 'SavePanel' method instead")] + [EditorBrowsable (EditorBrowsableState.Never)] [Export ("init")] NativeHandle Constructor (); +#endif [Export ("URL")] NSUrl Url { get; } @@ -20450,8 +20456,23 @@ interface NSToolbarItem : NSCopying, NSMenuItemValidation, NSValidatedUserInterf [Export ("maxSize")] CGSize MaxSize { get; set; } +#if XAMCORE_5_0 + [Export ("visibilityPriority")] + NSToolbarItemVisibilityPriority VisibilityPriority { get; set; } +#else + /// Indicate which toolbar items should be kept when the toolbar space is limited. + /// + /// The valid values come from the enum, and they can be referenced as follows: + /// + /// + /// + /// [Export ("visibilityPriority")] nint VisibilityPriority { get; set; } +#endif [Export ("autovalidates")] bool Autovalidates { get; set; } @@ -28757,4 +28778,12 @@ interface NSViewContentSelectionInfo { [Export ("selectionAnchorRect")] CGRect /* NSRect */ SelectionAnchorRect { get; } } + + [Native] + enum NSToolbarItemVisibilityPriority : long { + Standard = 0, + Low = -1000, + High = 1000, + User = 2000, + } } diff --git a/src/bgen/Generator.cs b/src/bgen/Generator.cs index 6752ee0530a7..0208eba94716 100644 --- a/src/bgen/Generator.cs +++ b/src/bgen/Generator.cs @@ -2918,7 +2918,7 @@ void GetReturnsWrappers (MethodInfo mi, MemberInformation minfo, Type declaringT // protocol support means we can return interfaces and, as far as .NET knows, they might not be NSObject if (IsProtocolInterface (mi.ReturnType)) { cast_a = " Runtime.GetINativeObject<" + TypeManager.FormatType (minfo?.type ?? mi.DeclaringType, mi.ReturnType) + "> ("; - cast_b = ", false)!"; + cast_b = $", {(minfo?.is_return_release == true ? "true" : "false")})!"; } else if (minfo is not null && minfo.is_forced) { cast_a = " Runtime.GetINativeObject<" + TypeManager.FormatType (minfo.type, mi.ReturnType) + "> ("; cast_b = $", true, {minfo.is_forced_owns})!"; @@ -3686,7 +3686,7 @@ public void GenerateMethodBody (MemberInformation minfo, MethodInfo mi, string s if (shouldMarshalNativeExceptions) print ("Runtime.ThrowException (exception_gchandle);"); - if (minfo.is_return_release) { + if (minfo.is_return_release && !IsProtocolInterface (mi.ReturnType)) { // Make sure we generate the required signature in Messaging only if needed // bool_objc_msgSendSuper_IntPtr: for respondsToSelector: diff --git a/src/uikit.cs b/src/uikit.cs index f3587f754824..a8c8a1bb48fc 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -14085,13 +14085,22 @@ interface UISegmentedControl UIImage DividerImageForLeftSegmentStaterightSegmentStatebarMetrics (UIControlState leftState, UIControlState rightState, UIBarMetrics barMetrics); #endif - [Export ("setTitleTextAttributes:forState:"), Internal] [Appearance] - void _SetTitleTextAttributes (NSDictionary attributes, UIControlState state); + [Wrap ("SetTitleTextAttributes (attributes?.GetDictionary (), state)")] + void SetTitleTextAttributes ([NullAllowed] UIStringAttributes attributes, UIControlState state); - [Export ("titleTextAttributesForState:"), Internal] + [Export ("setTitleTextAttributes:forState:")] [Appearance] - NSDictionary _GetTitleTextAttributes (UIControlState state); + void SetTitleTextAttributes ([NullAllowed] NSDictionary attributes, UIControlState state); + + [Appearance] + [Wrap ("new UIStringAttributes (GetWeakTitleTextAttributes (state))")] + UIStringAttributes GetTitleTextAttributes (UIControlState state); + + [Appearance] + [Export ("titleTextAttributesForState:")] + [return: NullAllowed] + NSDictionary GetWeakTitleTextAttributes (UIControlState state); [Export ("setContentPositionAdjustment:forSegmentType:barMetrics:")] [Appearance] diff --git a/src/vision.cs b/src/vision.cs index 47408698ca42..fa98a0daeb15 100644 --- a/src/vision.cs +++ b/src/vision.cs @@ -38,6 +38,12 @@ namespace Vision { + [Partial] + interface VNUtils { + [Field ("VNVisionVersionNumber")] + double VisionVersionNumber { get; } + } + /// Enumerates errors associated with Vision requests. [ErrorDomain ("VNErrorDomain")] [MacCatalyst (13, 1)] diff --git a/tests/Makefile b/tests/Makefile index b242791bc3ff..2f7cb8bf75a7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -85,9 +85,9 @@ test.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Version.De @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(platform)_NUGET_REF_NAME=$($(platform)_NUGET_REF_NAME)\\n)" | sed 's/^ //' >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(rid)_NUGET_RUNTIME_NAME=$($(rid)_NUGET_RUNTIME_NAME)\\n))" | sed 's/^ //' >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),SUPPORTED_API_VERSIONS_$(platform)='$(SUPPORTED_API_VERSIONS_$(platform))'\\n)" | sed 's/^ //' >> $@ - @printf "ENABLE_XAMARIN=$(ENABLE_XAMARIN)" >> $@ - @printf "XCODE_IS_STABLE=$(XCODE_IS_STABLE)" >> $@ - @printf "XCODE_VERSION=$(XCODE_VERSION)" >> $@ + @printf "ENABLE_XAMARIN=$(ENABLE_XAMARIN)\n" >> $@ + @printf "XCODE_IS_STABLE=$(XCODE_IS_STABLE)\n" >> $@ + @printf "XCODE_VERSION=$(XCODE_VERSION)\n" >> $@ test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Version.Details.xml @rm -f $@ @@ -119,9 +119,9 @@ test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Ver @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(platform)_NUGET_REF_NAME=$($(platform)_NUGET_REF_NAME)\\n)" | sed 's/^ //' >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(rid)_NUGET_RUNTIME_NAME=$($(rid)_NUGET_RUNTIME_NAME)\\n))" | sed 's/^ //' >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),SUPPORTED_API_VERSIONS_$(platform)='$(SUPPORTED_API_VERSIONS_$(platform))'\\n)" | sed 's/^ //' >> $@ - @printf "ENABLE_XAMARIN=$(ENABLE_XAMARIN)" >> $@ - @printf "XCODE_IS_STABLE=$(XCODE_IS_STABLE)" >> $@ - @printf "XCODE_VERSION=$(XCODE_VERSION)" >> $@ + @printf "ENABLE_XAMARIN=$(ENABLE_XAMARIN)\n" >> $@ + @printf "XCODE_IS_STABLE=$(XCODE_IS_STABLE)\n" >> $@ + @printf "XCODE_VERSION=$(XCODE_VERSION)\n" >> $@ clean-local:: $(Q) $(SYSTEM_XBUILD) /t:Clean /p:Platform=iPhoneSimulator /p:Configuration=$(CONFIG) $(XBUILD_VERBOSITY) tests.sln @@ -352,8 +352,6 @@ package-test-libraries.zip: $(Q) $(MAKE) all -C test-libraries/custom-type-assembly build-assembly $(Q_GEN) rm -f "$@" "$@.tmp" $(Q_GEN) cd $(TOP) && zip -9r --symlinks $(abspath $@).tmp ./tests/test-libraries - $(Q_GEN) cd $(TOP) && zip -9r --symlinks $(abspath $@).tmp ./tests/mono-native/macOS/unified ./tests/mono-native/macOS/compat - $(Q_GEN) cd $(TOP) && zip -9r --symlinks $(abspath $@).tmp ./tests/mono-native/iOS/unified ./tests/mono-native/iOS/compat $(Q_GEN) cd $(TOP) && find tests -regex '.*/generated-projects/.*[c|f]sproj' -exec zip -9r --symlinks $(abspath $@).tmp {} + $(Q_GEN) cd $(TOP) && find tests -regex '.*/generated-projects/.*sln' -exec zip -9r --symlinks $(abspath $@).tmp {} + $(Q_GEN) cd $(TOP) && find tests -regex 'tests/test-libraries/custom-type-assembly/.libs/.*dll' -exec zip -9r --symlinks $(abspath $@).tmp {} + diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index 56aca8bf163d..db2e9ad2042c 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -2869,6 +2869,10 @@ F:AppKit.NSToolbarItemGroupControlRepresentation.Expanded F:AppKit.NSToolbarItemGroupSelectionMode.Momentary F:AppKit.NSToolbarItemGroupSelectionMode.SelectAny F:AppKit.NSToolbarItemGroupSelectionMode.SelectOne +F:AppKit.NSToolbarItemVisibilityPriority.High +F:AppKit.NSToolbarItemVisibilityPriority.Low +F:AppKit.NSToolbarItemVisibilityPriority.Standard +F:AppKit.NSToolbarItemVisibilityPriority.User F:AppKit.NSToolbarSizeMode.Default F:AppKit.NSToolbarSizeMode.Regular F:AppKit.NSToolbarSizeMode.Small @@ -24338,7 +24342,6 @@ M:AppKit.NSOpenGLPixelFormat.#ctor(System.Object[]) M:AppKit.NSOpenGLPixelFormat.#ctor(System.UInt32[]) M:AppKit.NSOpenGLPixelFormat.EncodeTo(Foundation.NSCoder) M:AppKit.NSOpenGLView.#ctor(CoreGraphics.CGRect) -M:AppKit.NSOpenPanel.#ctor M:AppKit.NSOpenPanel.BeginSheet(System.String,System.String,System.String[],AppKit.NSWindow,System.Action) M:AppKit.NSOpenPanel.BeginSheet(System.String,System.String,System.String[],AppKit.NSWindow) M:AppKit.NSOpenSaveExpandingEventArgs.#ctor(System.Boolean) @@ -24683,7 +24686,6 @@ M:AppKit.NSRulerMarkerClientViewDelegation.RulerViewLocation(AppKit.NSView,AppKi M:AppKit.NSRulerMarkerClientViewDelegation.RulerViewPoint(AppKit.NSView,AppKit.NSRulerView,System.Runtime.InteropServices.NFloat) M:AppKit.NSRulerView.#ctor(CoreGraphics.CGRect) M:AppKit.NSRulerView.Dispose(System.Boolean) -M:AppKit.NSSavePanel.#ctor M:AppKit.NSSavePanel.add_DidChangeToDirectory(System.EventHandler{AppKit.NSOpenSavePanelUrlEventArgs}) M:AppKit.NSSavePanel.add_DidSelectType(System.EventHandler{AppKit.NSopenSavePanelUTTypeEventArgs}) M:AppKit.NSSavePanel.add_DirectoryDidChange(System.EventHandler{AppKit.NSOpenSaveFilenameEventArgs}) @@ -51488,9 +51490,11 @@ M:UIKit.UISegmentedControl.UISegmentedControlAppearance.ContentPositionAdjustmen M:UIKit.UISegmentedControl.UISegmentedControlAppearance.GetBackgroundImage(UIKit.UIControlState,UIKit.UIBarMetrics) M:UIKit.UISegmentedControl.UISegmentedControlAppearance.GetDividerImage(UIKit.UIControlState,UIKit.UIControlState,UIKit.UIBarMetrics) M:UIKit.UISegmentedControl.UISegmentedControlAppearance.GetTitleTextAttributes(UIKit.UIControlState) +M:UIKit.UISegmentedControl.UISegmentedControlAppearance.GetWeakTitleTextAttributes(UIKit.UIControlState) M:UIKit.UISegmentedControl.UISegmentedControlAppearance.SetBackgroundImage(UIKit.UIImage,UIKit.UIControlState,UIKit.UIBarMetrics) M:UIKit.UISegmentedControl.UISegmentedControlAppearance.SetContentPositionAdjustment(UIKit.UIOffset,UIKit.UISegmentedControlSegment,UIKit.UIBarMetrics) M:UIKit.UISegmentedControl.UISegmentedControlAppearance.SetDividerImage(UIKit.UIImage,UIKit.UIControlState,UIKit.UIControlState,UIKit.UIBarMetrics) +M:UIKit.UISegmentedControl.UISegmentedControlAppearance.SetTitleTextAttributes(Foundation.NSDictionary,UIKit.UIControlState) M:UIKit.UISegmentedControl.UISegmentedControlAppearance.SetTitleTextAttributes(UIKit.UIStringAttributes,UIKit.UIControlState) M:UIKit.UISelectionFeedbackGenerator.GetFeedbackGenerator(UIKit.UIView) M:UIKit.UIShadowProperties.Copy(Foundation.NSZone) @@ -79914,6 +79918,7 @@ P:Vision.VNTranslationalImageRegistrationRequest.Results P:Vision.VNTranslationalImageRegistrationRequest.SupportedRevisions P:Vision.VNTranslationalImageRegistrationRequest.WeakSupportedRevisions P:Vision.VNUtils.NormalizedIdentityRect +P:Vision.VNUtils.VisionVersionNumber P:Vision.VNVector.Length P:Vision.VNVector.R P:Vision.VNVector.SquaredLength @@ -80962,6 +80967,7 @@ T:AppKit.NSToolbarImmovableItemIdentifiers T:AppKit.NSToolbarItemEventArgs T:AppKit.NSToolbarItemGroupControlRepresentation T:AppKit.NSToolbarItemGroupSelectionMode +T:AppKit.NSToolbarItemVisibilityPriority T:AppKit.NSToolbarSizeMode T:AppKit.NSToolbarWillInsert T:AppKit.NSTouch_NSTouchBar diff --git a/tests/common/MonoNativeConfig.cs b/tests/common/MonoNativeConfig.cs deleted file mode 100644 index 770ea99552ca..000000000000 --- a/tests/common/MonoNativeConfig.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.IO; -using System.Reflection; -using NUnit.Framework; - -namespace Xamarin.Tests { - public enum MonoNativeLinkMode { - None, - Static, - Dynamic, - Framework, - Symlink, - } - - public enum MonoNativeFlavor { - None, - Unified, - } - - public static class MonoNativeConfig { - public static MonoNativeLinkMode LinkMode { - get { -#if MONO_NATIVE_STATIC - return MonoNativeLinkMode.Static; -#elif MONO_NATIVE_DYNAMIC - return MonoNativeLinkMode.Dynamic; -#elif MONO_NATIVE_SYMLINK - return MonoNativeLinkMode.Symlink; -#else - return MonoNativeLinkMode.None; -#endif - } - } - - public static MonoNativeFlavor Flavor { - get { -#if MONO_NATIVE_UNIFIED - return MonoNativeFlavor.Unified; -#else - return MonoNativeFlavor.None; -#endif - } - } - - public static bool UsingCompat { - get { -#if MONO_NATIVE_UNIFIED - return false; -#else - Assert.Fail ("Missing `MONO_NATIVE_UNIFIED`"); - throw new NotImplementedException (); -#endif - } - } - - public static string GetDynamicLibraryName () - { - return GetDynamicLibraryName (MonoNativeFlavor.Unified); - } - - public static string GetDynamicLibraryName (MonoNativeFlavor flavor) - { - switch (flavor) { - case MonoNativeFlavor.Unified: - return "libmono-native-unified.dylib"; - default: - Assert.Fail ($"Invalid MonoNativeFlavor: {flavor}"); - throw new NotImplementedException (); - } - } - - public static string GetPInvokeLibraryName (MonoNativeFlavor flavor, MonoNativeLinkMode link) - { - switch (link) { - case MonoNativeLinkMode.Static: - return null; - case MonoNativeLinkMode.Dynamic: - return GetDynamicLibraryName (flavor); - case MonoNativeLinkMode.Symlink: - return "libmono-native.dylib"; - default: - Assert.Fail ($"Invalid link mode: {MonoNativeConfig.LinkMode}"); - throw new NotImplementedException (); - } - } - - public static string DynamicLibraryName => GetDynamicLibraryName (); - } -} diff --git a/tests/dotnet/MySimpleApp/Directory.Build.props b/tests/dotnet/MySimpleApp/Directory.Build.props index f35c2a50a994..465fa5046e93 100644 --- a/tests/dotnet/MySimpleApp/Directory.Build.props +++ b/tests/dotnet/MySimpleApp/Directory.Build.props @@ -3,5 +3,5 @@ false - + diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs index fdafd16ca615..cc8541998b91 100644 --- a/tests/dotnet/UnitTests/ProjectTest.cs +++ b/tests/dotnet/UnitTests/ProjectTest.cs @@ -2149,5 +2149,693 @@ public void AppendRuntimeIdentifierToOutputPath_DisableDirectoryBuildProps (Appl properties ["SetAppendRuntimeIdentifierToOutputPathToFalse"] = "true"; DotNet.AssertBuild (project_path, properties); } + + static string [] expectedFrameworks_iOS_None = [ + "/System/Library/Frameworks/Accelerate.framework/Accelerate", + "/System/Library/Frameworks/Accessibility.framework/Accessibility", + "/System/Library/Frameworks/AccessorySetupKit.framework/AccessorySetupKit", + "/System/Library/Frameworks/Accounts.framework/Accounts", + "/System/Library/Frameworks/AddressBook.framework/AddressBook", + "/System/Library/Frameworks/AddressBookUI.framework/AddressBookUI", + "/System/Library/Frameworks/AdServices.framework/AdServices", + "/System/Library/Frameworks/AdSupport.framework/AdSupport", + "/System/Library/Frameworks/AppClip.framework/AppClip", + "/System/Library/Frameworks/AppTrackingTransparency.framework/AppTrackingTransparency", + "/System/Library/Frameworks/ARKit.framework/ARKit", + "/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox", + "/System/Library/Frameworks/AuthenticationServices.framework/AuthenticationServices", + "/System/Library/Frameworks/AutomaticAssessmentConfiguration.framework/AutomaticAssessmentConfiguration", + "/System/Library/Frameworks/AVFoundation.framework/AVFoundation", + "/System/Library/Frameworks/AVKit.framework/AVKit", + "/System/Library/Frameworks/AVRouting.framework/AVRouting", + "/System/Library/Frameworks/BackgroundAssets.framework/BackgroundAssets", + "/System/Library/Frameworks/BackgroundTasks.framework/BackgroundTasks", + "/System/Library/Frameworks/BusinessChat.framework/BusinessChat", + "/System/Library/Frameworks/CallKit.framework/CallKit", + "/System/Library/Frameworks/CarPlay.framework/CarPlay", + "/System/Library/Frameworks/CFNetwork.framework/CFNetwork", + "/System/Library/Frameworks/Cinematic.framework/Cinematic", + "/System/Library/Frameworks/ClassKit.framework/ClassKit", + "/System/Library/Frameworks/CloudKit.framework/CloudKit", + "/System/Library/Frameworks/Contacts.framework/Contacts", + "/System/Library/Frameworks/ContactsUI.framework/ContactsUI", + "/System/Library/Frameworks/CoreAudioKit.framework/CoreAudioKit", + "/System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth", + "/System/Library/Frameworks/CoreData.framework/CoreData", + "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", + "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics", + "/System/Library/Frameworks/CoreHaptics.framework/CoreHaptics", + "/System/Library/Frameworks/CoreImage.framework/CoreImage", + "/System/Library/Frameworks/CoreLocation.framework/CoreLocation", + "/System/Library/Frameworks/CoreLocationUI.framework/CoreLocationUI", + "/System/Library/Frameworks/CoreMedia.framework/CoreMedia", + "/System/Library/Frameworks/CoreMIDI.framework/CoreMIDI", + "/System/Library/Frameworks/CoreML.framework/CoreML", + "/System/Library/Frameworks/CoreMotion.framework/CoreMotion", + "/System/Library/Frameworks/CoreNFC.framework/CoreNFC", + "/System/Library/Frameworks/CoreSpotlight.framework/CoreSpotlight", + "/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", + "/System/Library/Frameworks/CoreText.framework/CoreText", + "/System/Library/Frameworks/CoreVideo.framework/CoreVideo", + "/System/Library/Frameworks/CryptoTokenKit.framework/CryptoTokenKit", + "/System/Library/Frameworks/DeviceCheck.framework/DeviceCheck", + "/System/Library/Frameworks/DeviceDiscoveryExtension.framework/DeviceDiscoveryExtension", + "/System/Library/Frameworks/EventKit.framework/EventKit", + "/System/Library/Frameworks/EventKitUI.framework/EventKitUI", + "/System/Library/Frameworks/ExternalAccessory.framework/ExternalAccessory", + "/System/Library/Frameworks/FileProvider.framework/FileProvider", + "/System/Library/Frameworks/FileProviderUI.framework/FileProviderUI", + "/System/Library/Frameworks/Foundation.framework/Foundation", + "/System/Library/Frameworks/GameController.framework/GameController", + "/System/Library/Frameworks/GameKit.framework/GameKit", + "/System/Library/Frameworks/GameplayKit.framework/GameplayKit", + "/System/Library/Frameworks/GLKit.framework/GLKit", + "/System/Library/Frameworks/GSS.framework/GSS", + "/System/Library/Frameworks/HealthKit.framework/HealthKit", + "/System/Library/Frameworks/HealthKitUI.framework/HealthKitUI", + "/System/Library/Frameworks/HomeKit.framework/HomeKit", + "/System/Library/Frameworks/IdentityLookup.framework/IdentityLookup", + "/System/Library/Frameworks/IdentityLookupUI.framework/IdentityLookupUI", + "/System/Library/Frameworks/ImageIO.framework/ImageIO", + "/System/Library/Frameworks/Intents.framework/Intents", + "/System/Library/Frameworks/IntentsUI.framework/IntentsUI", + "/System/Library/Frameworks/IOSurface.framework/IOSurface", + "/System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore", + "/System/Library/Frameworks/LinkPresentation.framework/LinkPresentation", + "/System/Library/Frameworks/LocalAuthentication.framework/LocalAuthentication", + "/System/Library/Frameworks/MapKit.framework/MapKit", + "/System/Library/Frameworks/MediaAccessibility.framework/MediaAccessibility", + "/System/Library/Frameworks/MediaPlayer.framework/MediaPlayer", + "/System/Library/Frameworks/MediaSetup.framework/MediaSetup", + "/System/Library/Frameworks/MediaToolbox.framework/MediaToolbox", + "/System/Library/Frameworks/Messages.framework/Messages", + "/System/Library/Frameworks/MessageUI.framework/MessageUI", + "/System/Library/Frameworks/Metal.framework/Metal", + "/System/Library/Frameworks/MetalFX.framework/MetalFX", + "/System/Library/Frameworks/MetalKit.framework/MetalKit", + "/System/Library/Frameworks/MetalPerformanceShaders.framework/MetalPerformanceShaders", + "/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/MetalPerformanceShadersGraph", + "/System/Library/Frameworks/MetricKit.framework/MetricKit", + "/System/Library/Frameworks/MLCompute.framework/MLCompute", + "/System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices", + "/System/Library/Frameworks/ModelIO.framework/ModelIO", + "/System/Library/Frameworks/MultipeerConnectivity.framework/MultipeerConnectivity", + "/System/Library/Frameworks/NaturalLanguage.framework/NaturalLanguage", + "/System/Library/Frameworks/NearbyInteraction.framework/NearbyInteraction", + "/System/Library/Frameworks/Network.framework/Network", + "/System/Library/Frameworks/NetworkExtension.framework/NetworkExtension", + "/System/Library/Frameworks/NotificationCenter.framework/NotificationCenter", + "/System/Library/Frameworks/OpenGLES.framework/OpenGLES", + "/System/Library/Frameworks/OSLog.framework/OSLog", + "/System/Library/Frameworks/PassKit.framework/PassKit", + "/System/Library/Frameworks/PDFKit.framework/PDFKit", + "/System/Library/Frameworks/PencilKit.framework/PencilKit", + "/System/Library/Frameworks/PHASE.framework/PHASE", + "/System/Library/Frameworks/Photos.framework/Photos", + "/System/Library/Frameworks/PhotosUI.framework/PhotosUI", + "/System/Library/Frameworks/PushKit.framework/PushKit", + "/System/Library/Frameworks/PushToTalk.framework/PushToTalk", + "/System/Library/Frameworks/QuartzCore.framework/QuartzCore", + "/System/Library/Frameworks/QuickLook.framework/QuickLook", + "/System/Library/Frameworks/QuickLookThumbnailing.framework/QuickLookThumbnailing", + "/System/Library/Frameworks/ReplayKit.framework/ReplayKit", + "/System/Library/Frameworks/SafariServices.framework/SafariServices", + "/System/Library/Frameworks/SafetyKit.framework/SafetyKit", + "/System/Library/Frameworks/SceneKit.framework/SceneKit", + "/System/Library/Frameworks/ScreenTime.framework/ScreenTime", + "/System/Library/Frameworks/Security.framework/Security", + "/System/Library/Frameworks/SensitiveContentAnalysis.framework/SensitiveContentAnalysis", + "/System/Library/Frameworks/SensorKit.framework/SensorKit", + "/System/Library/Frameworks/SharedWithYou.framework/SharedWithYou", + "/System/Library/Frameworks/SharedWithYouCore.framework/SharedWithYouCore", + "/System/Library/Frameworks/ShazamKit.framework/ShazamKit", + "/System/Library/Frameworks/Social.framework/Social", + "/System/Library/Frameworks/SoundAnalysis.framework/SoundAnalysis", + "/System/Library/Frameworks/Speech.framework/Speech", + "/System/Library/Frameworks/SpriteKit.framework/SpriteKit", + "/System/Library/Frameworks/StoreKit.framework/StoreKit", + "/System/Library/Frameworks/Symbols.framework/Symbols", + "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration", + "/System/Library/Frameworks/ThreadNetwork.framework/ThreadNetwork", + "/System/Library/Frameworks/Twitter.framework/Twitter", + "/System/Library/Frameworks/UIKit.framework/UIKit", + "/System/Library/Frameworks/UniformTypeIdentifiers.framework/UniformTypeIdentifiers", + "/System/Library/Frameworks/UserNotifications.framework/UserNotifications", + "/System/Library/Frameworks/UserNotificationsUI.framework/UserNotificationsUI", + "/System/Library/Frameworks/VideoSubscriberAccount.framework/VideoSubscriberAccount", + "/System/Library/Frameworks/VideoToolbox.framework/VideoToolbox", + "/System/Library/Frameworks/Vision.framework/Vision", + "/System/Library/Frameworks/VisionKit.framework/VisionKit", + "/System/Library/Frameworks/WatchConnectivity.framework/WatchConnectivity", + "/System/Library/Frameworks/WebKit.framework/WebKit", + "/usr/lib/libc++.1.dylib", + "/usr/lib/libcompression.dylib", + "/usr/lib/libiconv.2.dylib", + "/usr/lib/libobjc.A.dylib", + "/usr/lib/libSystem.B.dylib", + "/usr/lib/libz.1.dylib", + "/System/Library/Frameworks/CryptoKit.framework/CryptoKit", + "/usr/lib/libicucore.A.dylib", + "/usr/lib/swift/libswiftCore.dylib", + "/usr/lib/swift/libswiftCoreFoundation.dylib", + "/usr/lib/swift/libswiftDarwin.dylib", + "/usr/lib/swift/libswiftDispatch.dylib", + "/usr/lib/swift/libswiftFoundation.dylib", + "/usr/lib/swift/libswiftObjectiveC.dylib", + ]; + + static string [] expectedFrameworks_iOS_Full = [ + "/System/Library/Frameworks/CFNetwork.framework/CFNetwork", + "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", + "/System/Library/Frameworks/Foundation.framework/Foundation", + "/System/Library/Frameworks/GSS.framework/GSS", + "/System/Library/Frameworks/Security.framework/Security", + "/System/Library/Frameworks/UIKit.framework/UIKit", + "/usr/lib/libc++.1.dylib", + "/usr/lib/libcompression.dylib", + "/usr/lib/libiconv.2.dylib", + "/usr/lib/libicucore.A.dylib", + "/usr/lib/libobjc.A.dylib", + "/usr/lib/libSystem.B.dylib", + "/usr/lib/libz.1.dylib", + ]; + + static string [] expectedFrameworks_tvOS_None = [ + "/System/Library/Frameworks/Accelerate.framework/Accelerate", + "/System/Library/Frameworks/Accessibility.framework/Accessibility", + "/System/Library/Frameworks/AdSupport.framework/AdSupport", + "/System/Library/Frameworks/AppTrackingTransparency.framework/AppTrackingTransparency", + "/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox", + "/System/Library/Frameworks/AuthenticationServices.framework/AuthenticationServices", + "/System/Library/Frameworks/AVFoundation.framework/AVFoundation", + "/System/Library/Frameworks/AVKit.framework/AVKit", + "/System/Library/Frameworks/BackgroundTasks.framework/BackgroundTasks", + "/System/Library/Frameworks/CFNetwork.framework/CFNetwork", + "/System/Library/Frameworks/Cinematic.framework/Cinematic", + "/System/Library/Frameworks/CloudKit.framework/CloudKit", + "/System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth", + "/System/Library/Frameworks/CoreData.framework/CoreData", + "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", + "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics", + "/System/Library/Frameworks/CoreHaptics.framework/CoreHaptics", + "/System/Library/Frameworks/CoreImage.framework/CoreImage", + "/System/Library/Frameworks/CoreLocation.framework/CoreLocation", + "/System/Library/Frameworks/CoreMedia.framework/CoreMedia", + "/System/Library/Frameworks/CoreMIDI.framework/CoreMIDI", + "/System/Library/Frameworks/CoreML.framework/CoreML", + "/System/Library/Frameworks/CoreSpotlight.framework/CoreSpotlight", + "/System/Library/Frameworks/CoreText.framework/CoreText", + "/System/Library/Frameworks/CoreVideo.framework/CoreVideo", + "/System/Library/Frameworks/CryptoKit.framework/CryptoKit", + "/System/Library/Frameworks/CryptoTokenKit.framework/CryptoTokenKit", + "/System/Library/Frameworks/DeviceCheck.framework/DeviceCheck", + "/System/Library/Frameworks/DeviceDiscoveryUI.framework/DeviceDiscoveryUI", + "/System/Library/Frameworks/ExternalAccessory.framework/ExternalAccessory", + "/System/Library/Frameworks/Foundation.framework/Foundation", + "/System/Library/Frameworks/GameController.framework/GameController", + "/System/Library/Frameworks/GameKit.framework/GameKit", + "/System/Library/Frameworks/GameplayKit.framework/GameplayKit", + "/System/Library/Frameworks/GLKit.framework/GLKit", + "/System/Library/Frameworks/HomeKit.framework/HomeKit", + "/System/Library/Frameworks/ImageIO.framework/ImageIO", + "/System/Library/Frameworks/Intents.framework/Intents", + "/System/Library/Frameworks/IOSurface.framework/IOSurface", + "/System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore", + "/System/Library/Frameworks/LinkPresentation.framework/LinkPresentation", + "/System/Library/Frameworks/MapKit.framework/MapKit", + "/System/Library/Frameworks/MediaAccessibility.framework/MediaAccessibility", + "/System/Library/Frameworks/MediaPlayer.framework/MediaPlayer", + "/System/Library/Frameworks/MediaToolbox.framework/MediaToolbox", + "/System/Library/Frameworks/Metal.framework/Metal", + "/System/Library/Frameworks/MetalKit.framework/MetalKit", + "/System/Library/Frameworks/MetalPerformanceShaders.framework/MetalPerformanceShaders", + "/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/MetalPerformanceShadersGraph", + "/System/Library/Frameworks/MLCompute.framework/MLCompute", + "/System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices", + "/System/Library/Frameworks/ModelIO.framework/ModelIO", + "/System/Library/Frameworks/MultipeerConnectivity.framework/MultipeerConnectivity", + "/System/Library/Frameworks/NaturalLanguage.framework/NaturalLanguage", + "/System/Library/Frameworks/Network.framework/Network", + "/System/Library/Frameworks/NetworkExtension.framework/NetworkExtension", + "/System/Library/Frameworks/OpenGLES.framework/OpenGLES", + "/System/Library/Frameworks/OSLog.framework/OSLog", + "/System/Library/Frameworks/PHASE.framework/PHASE", + "/System/Library/Frameworks/Photos.framework/Photos", + "/System/Library/Frameworks/PhotosUI.framework/PhotosUI", + "/System/Library/Frameworks/QuartzCore.framework/QuartzCore", + "/System/Library/Frameworks/ReplayKit.framework/ReplayKit", + "/System/Library/Frameworks/SceneKit.framework/SceneKit", + "/System/Library/Frameworks/Security.framework/Security", + "/System/Library/Frameworks/SharedWithYou.framework/SharedWithYou", + "/System/Library/Frameworks/ShazamKit.framework/ShazamKit", + "/System/Library/Frameworks/SoundAnalysis.framework/SoundAnalysis", + "/System/Library/Frameworks/SpriteKit.framework/SpriteKit", + "/System/Library/Frameworks/StoreKit.framework/StoreKit", + "/System/Library/Frameworks/Symbols.framework/Symbols", + "/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration", + "/System/Library/Frameworks/TVMLKit.framework/TVMLKit", + "/System/Library/Frameworks/TVServices.framework/TVServices", + "/System/Library/Frameworks/TVUIKit.framework/TVUIKit", + "/System/Library/Frameworks/UIKit.framework/UIKit", + "/System/Library/Frameworks/UniformTypeIdentifiers.framework/UniformTypeIdentifiers", + "/System/Library/Frameworks/UserNotifications.framework/UserNotifications", + "/System/Library/Frameworks/VideoSubscriberAccount.framework/VideoSubscriberAccount", + "/System/Library/Frameworks/VideoToolbox.framework/VideoToolbox", + "/System/Library/Frameworks/Vision.framework/Vision", + "/usr/lib/libc++.1.dylib", + "/usr/lib/libcompression.dylib", + "/usr/lib/libiconv.2.dylib", + "/usr/lib/libicucore.A.dylib", + "/usr/lib/libobjc.A.dylib", + "/usr/lib/libSystem.B.dylib", + "/usr/lib/libz.1.dylib", + "/usr/lib/swift/libswiftCore.dylib", + "/usr/lib/swift/libswiftCoreFoundation.dylib", + "/usr/lib/swift/libswiftDarwin.dylib", + "/usr/lib/swift/libswiftDispatch.dylib", + "/usr/lib/swift/libswiftFoundation.dylib", + "/usr/lib/swift/libswiftObjectiveC.dylib", + ]; + + static string [] expectedFrameworks_tvOS_Full = [ + "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", + "/System/Library/Frameworks/Foundation.framework/Foundation", + "/System/Library/Frameworks/Security.framework/Security", + "/System/Library/Frameworks/UIKit.framework/UIKit", + "/usr/lib/libc++.1.dylib", + "/usr/lib/libcompression.dylib", + "/usr/lib/libiconv.2.dylib", + "/usr/lib/libicucore.A.dylib", + "/usr/lib/libobjc.A.dylib", + "/usr/lib/libSystem.B.dylib", + "/usr/lib/libz.1.dylib", + ]; + + static string [] expectedFrameworks_macOS_None = [ + "@executable_path/../../Contents/MonoBundle/libclrgc.dylib", + "@executable_path/../../Contents/MonoBundle/libclrgcexp.dylib", + "@executable_path/../../Contents/MonoBundle/libclrjit.dylib", + "@executable_path/../../Contents/MonoBundle/libcoreclr.dylib", + "@executable_path/../../Contents/MonoBundle/libhostfxr.dylib", + "@executable_path/../../Contents/MonoBundle/libhostpolicy.dylib", + "@executable_path/../../Contents/MonoBundle/libmscordaccore.dylib", + "@executable_path/../../Contents/MonoBundle/libmscordbi.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.Globalization.Native.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.IO.Compression.Native.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.Native.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.Net.Security.Native.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.Security.Cryptography.Native.Apple.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.Security.Cryptography.Native.OpenSsl.dylib", + "/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate", + "/System/Library/Frameworks/Accessibility.framework/Versions/A/Accessibility", + "/System/Library/Frameworks/Accounts.framework/Versions/A/Accounts", + "/System/Library/Frameworks/AdServices.framework/Versions/A/AdServices", + "/System/Library/Frameworks/AdSupport.framework/Versions/A/AdSupport", + "/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit", + "/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices", + "/System/Library/Frameworks/AppTrackingTransparency.framework/Versions/A/AppTrackingTransparency", + "/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox", + "/System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit", + "/System/Library/Frameworks/AuthenticationServices.framework/Versions/A/AuthenticationServices", + "/System/Library/Frameworks/AutomaticAssessmentConfiguration.framework/Versions/A/AutomaticAssessmentConfiguration", + "/System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation", + "/System/Library/Frameworks/AVKit.framework/Versions/A/AVKit", + "/System/Library/Frameworks/AVRouting.framework/Versions/A/AVRouting", + "/System/Library/Frameworks/BackgroundAssets.framework/Versions/A/BackgroundAssets", + "/System/Library/Frameworks/BusinessChat.framework/Versions/A/BusinessChat", + "/System/Library/Frameworks/CallKit.framework/Versions/A/CallKit", + "/System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork", + "/System/Library/Frameworks/Cinematic.framework/Versions/A/Cinematic", + "/System/Library/Frameworks/ClassKit.framework/Versions/A/ClassKit", + "/System/Library/Frameworks/CloudKit.framework/Versions/A/CloudKit", + "/System/Library/Frameworks/Contacts.framework/Versions/A/Contacts", + "/System/Library/Frameworks/ContactsUI.framework/Versions/A/ContactsUI", + "/System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio", + "/System/Library/Frameworks/CoreAudioKit.framework/Versions/A/CoreAudioKit", + "/System/Library/Frameworks/CoreBluetooth.framework/Versions/A/CoreBluetooth", + "/System/Library/Frameworks/CoreData.framework/Versions/A/CoreData", + "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation", + "/System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage", + "/System/Library/Frameworks/CoreLocation.framework/Versions/A/CoreLocation", + "/System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia", + "/System/Library/Frameworks/CoreMIDI.framework/Versions/A/CoreMIDI", + "/System/Library/Frameworks/CoreML.framework/Versions/A/CoreML", + "/System/Library/Frameworks/CoreMotion.framework/Versions/A/CoreMotion", + "/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices", + "/System/Library/Frameworks/CoreSpotlight.framework/Versions/A/CoreSpotlight", + "/System/Library/Frameworks/CoreText.framework/Versions/A/CoreText", + "/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo", + "/System/Library/Frameworks/CoreWLAN.framework/Versions/A/CoreWLAN", + "/System/Library/Frameworks/CryptoTokenKit.framework/Versions/A/CryptoTokenKit", + "/System/Library/Frameworks/DeviceCheck.framework/Versions/A/DeviceCheck", + "/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Versions/A/DeviceDiscoveryExtension", + "/System/Library/Frameworks/EventKit.framework/Versions/A/EventKit", + "/System/Library/Frameworks/ExecutionPolicy.framework/Versions/A/ExecutionPolicy", + "/System/Library/Frameworks/ExtensionKit.framework/Versions/A/ExtensionKit", + "/System/Library/Frameworks/ExternalAccessory.framework/ExternalAccessory", + "/System/Library/Frameworks/FileProvider.framework/Versions/A/FileProvider", + "/System/Library/Frameworks/FileProviderUI.framework/Versions/A/FileProviderUI", + "/System/Library/Frameworks/FinderSync.framework/Versions/A/FinderSync", + "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation", + "/System/Library/Frameworks/GameController.framework/Versions/A/GameController", + "/System/Library/Frameworks/GameKit.framework/Versions/A/GameKit", + "/System/Library/Frameworks/GameplayKit.framework/Versions/A/GameplayKit", + "/System/Library/Frameworks/GLKit.framework/Versions/A/GLKit", + "/System/Library/Frameworks/HealthKit.framework/Versions/A/HealthKit", + "/System/Library/Frameworks/ImageCaptureCore.framework/Versions/A/ImageCaptureCore", + "/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO", + "/System/Library/Frameworks/Intents.framework/Versions/A/Intents", + "/System/Library/Frameworks/IntentsUI.framework/Versions/A/IntentsUI", + "/System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface", + "/System/Library/Frameworks/iTunesLibrary.framework/Versions/A/iTunesLibrary", + "/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/JavaScriptCore", + "/System/Library/Frameworks/LinkPresentation.framework/Versions/A/LinkPresentation", + "/System/Library/Frameworks/LocalAuthentication.framework/Versions/A/LocalAuthentication", + "/System/Library/Frameworks/LocalAuthenticationEmbeddedUI.framework/Versions/A/LocalAuthenticationEmbeddedUI", + "/System/Library/Frameworks/MailKit.framework/Versions/A/MailKit", + "/System/Library/Frameworks/MapKit.framework/Versions/A/MapKit", + "/System/Library/Frameworks/MediaAccessibility.framework/Versions/A/MediaAccessibility", + "/System/Library/Frameworks/MediaExtension.framework/Versions/A/MediaExtension", + "/System/Library/Frameworks/MediaLibrary.framework/Versions/A/MediaLibrary", + "/System/Library/Frameworks/MediaPlayer.framework/Versions/A/MediaPlayer", + "/System/Library/Frameworks/MediaToolbox.framework/Versions/A/MediaToolbox", + "/System/Library/Frameworks/Metal.framework/Versions/A/Metal", + "/System/Library/Frameworks/MetalFX.framework/Versions/A/MetalFX", + "/System/Library/Frameworks/MetalKit.framework/Versions/A/MetalKit", + "/System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/MetalPerformanceShaders", + "/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Versions/A/MetalPerformanceShadersGraph", + "/System/Library/Frameworks/MetricKit.framework/Versions/A/MetricKit", + "/System/Library/Frameworks/MLCompute.framework/Versions/A/MLCompute", + "/System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO", + "/System/Library/Frameworks/MultipeerConnectivity.framework/Versions/A/MultipeerConnectivity", + "/System/Library/Frameworks/NaturalLanguage.framework/Versions/A/NaturalLanguage", + "/System/Library/Frameworks/Network.framework/Versions/A/Network", + "/System/Library/Frameworks/NetworkExtension.framework/Versions/A/NetworkExtension", + "/System/Library/Frameworks/NotificationCenter.framework/Versions/A/NotificationCenter", + "/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL", + "/System/Library/Frameworks/OSLog.framework/Versions/A/OSLog", + "/System/Library/Frameworks/PassKit.framework/Versions/A/PassKit", + "/System/Library/Frameworks/PencilKit.framework/Versions/A/PencilKit", + "/System/Library/Frameworks/PHASE.framework/Versions/A/PHASE", + "/System/Library/Frameworks/Photos.framework/Versions/A/Photos", + "/System/Library/Frameworks/PhotosUI.framework/Versions/A/PhotosUI", + "/System/Library/Frameworks/PushKit.framework/Versions/A/PushKit", + "/System/Library/Frameworks/Quartz.framework/Versions/A/Quartz", + "/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore", + "/System/Library/Frameworks/QuickLook.framework/Versions/A/QuickLook", + "/System/Library/Frameworks/QuickLookThumbnailing.framework/Versions/A/QuickLookThumbnailing", + "/System/Library/Frameworks/ReplayKit.framework/Versions/A/ReplayKit", + "/System/Library/Frameworks/SafariServices.framework/Versions/A/SafariServices", + "/System/Library/Frameworks/SafetyKit.framework/Versions/A/SafetyKit", + "/System/Library/Frameworks/SceneKit.framework/Versions/A/SceneKit", + "/System/Library/Frameworks/ScreenCaptureKit.framework/Versions/A/ScreenCaptureKit", + "/System/Library/Frameworks/ScreenTime.framework/Versions/A/ScreenTime", + "/System/Library/Frameworks/ScriptingBridge.framework/Versions/A/ScriptingBridge", + "/System/Library/Frameworks/Security.framework/Versions/A/Security", + "/System/Library/Frameworks/SensitiveContentAnalysis.framework/Versions/A/SensitiveContentAnalysis", + "/System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement", + "/System/Library/Frameworks/SharedWithYou.framework/Versions/A/SharedWithYou", + "/System/Library/Frameworks/SharedWithYouCore.framework/Versions/A/SharedWithYouCore", + "/System/Library/Frameworks/ShazamKit.framework/Versions/A/ShazamKit", + "/System/Library/Frameworks/Social.framework/Versions/A/Social", + "/System/Library/Frameworks/SoundAnalysis.framework/Versions/A/SoundAnalysis", + "/System/Library/Frameworks/Speech.framework/Versions/A/Speech", + "/System/Library/Frameworks/SpriteKit.framework/Versions/A/SpriteKit", + "/System/Library/Frameworks/StoreKit.framework/Versions/A/StoreKit", + "/System/Library/Frameworks/Symbols.framework/Versions/A/Symbols", + "/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration", + "/System/Library/Frameworks/ThreadNetwork.framework/Versions/A/ThreadNetwork", + "/System/Library/Frameworks/UniformTypeIdentifiers.framework/Versions/A/UniformTypeIdentifiers", + "/System/Library/Frameworks/UserNotifications.framework/Versions/A/UserNotifications", + "/System/Library/Frameworks/UserNotificationsUI.framework/Versions/A/UserNotificationsUI", + "/System/Library/Frameworks/VideoSubscriberAccount.framework/Versions/A/VideoSubscriberAccount", + "/System/Library/Frameworks/VideoToolbox.framework/Versions/A/VideoToolbox", + "/System/Library/Frameworks/Vision.framework/Versions/A/Vision", + "/System/Library/Frameworks/WebKit.framework/Versions/A/WebKit", + "/usr/lib/libc++.1.dylib", + "/usr/lib/libcompression.dylib", + "/usr/lib/libiconv.2.dylib", + "/usr/lib/libicucore.A.dylib", + "/usr/lib/libobjc.A.dylib", + "/usr/lib/libSystem.B.dylib", + "/usr/lib/libz.1.dylib", + ]; + + static string [] expectedFrameworks_macOS_Full = [ + "@executable_path/../../Contents/MonoBundle/libclrgc.dylib", + "@executable_path/../../Contents/MonoBundle/libclrgcexp.dylib", + "@executable_path/../../Contents/MonoBundle/libclrjit.dylib", + "@executable_path/../../Contents/MonoBundle/libcoreclr.dylib", + "@executable_path/../../Contents/MonoBundle/libhostfxr.dylib", + "@executable_path/../../Contents/MonoBundle/libhostpolicy.dylib", + "@executable_path/../../Contents/MonoBundle/libmscordaccore.dylib", + "@executable_path/../../Contents/MonoBundle/libmscordbi.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.Globalization.Native.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.IO.Compression.Native.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.Native.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.Net.Security.Native.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.Security.Cryptography.Native.Apple.dylib", + "@executable_path/../../Contents/MonoBundle/libSystem.Security.Cryptography.Native.OpenSsl.dylib", + "/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit", + "/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices", + "/System/Library/Frameworks/CloudKit.framework/Versions/A/CloudKit", + "/System/Library/Frameworks/CoreData.framework/Versions/A/CoreData", + "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation", + "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation", + "/System/Library/Frameworks/Quartz.framework/Versions/A/Quartz", + "/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore", + "/System/Library/Frameworks/Security.framework/Versions/A/Security", + "/usr/lib/libc++.1.dylib", + "/usr/lib/libcompression.dylib", + "/usr/lib/libiconv.2.dylib", + "/usr/lib/libicucore.A.dylib", + "/usr/lib/libobjc.A.dylib", + "/usr/lib/libSystem.B.dylib", + "/usr/lib/libz.1.dylib", + ]; + + static string [] expectedFrameworks_MacCatalyst_None = [ + "/System/iOSSupport/System/Library/Frameworks/AddressBook.framework/Versions/A/AddressBook", + "/System/iOSSupport/System/Library/Frameworks/AppClip.framework/Versions/A/AppClip", + "/System/iOSSupport/System/Library/Frameworks/AuthenticationServices.framework/Versions/A/AuthenticationServices", + "/System/iOSSupport/System/Library/Frameworks/AVKit.framework/Versions/A/AVKit", + "/System/iOSSupport/System/Library/Frameworks/BusinessChat.framework/Versions/A/BusinessChat", + "/System/iOSSupport/System/Library/Frameworks/ContactsUI.framework/Versions/A/ContactsUI", + "/System/iOSSupport/System/Library/Frameworks/CoreAudioKit.framework/Versions/A/CoreAudioKit", + "/System/iOSSupport/System/Library/Frameworks/CoreLocationUI.framework/Versions/A/CoreLocationUI", + "/System/iOSSupport/System/Library/Frameworks/CoreNFC.framework/Versions/A/CoreNFC", + "/System/iOSSupport/System/Library/Frameworks/EventKitUI.framework/Versions/A/EventKitUI", + "/System/iOSSupport/System/Library/Frameworks/GameController.framework/Versions/A/GameController", + "/System/iOSSupport/System/Library/Frameworks/GameKit.framework/Versions/A/GameKit", + "/System/iOSSupport/System/Library/Frameworks/GameplayKit.framework/Versions/A/GameplayKit", + "/System/iOSSupport/System/Library/Frameworks/HealthKitUI.framework/Versions/A/HealthKitUI", + "/System/iOSSupport/System/Library/Frameworks/HomeKit.framework/Versions/A/HomeKit", + "/System/iOSSupport/System/Library/Frameworks/IdentityLookupUI.framework/Versions/A/IdentityLookupUI", + "/System/iOSSupport/System/Library/Frameworks/IntentsUI.framework/Versions/A/IntentsUI", + "/System/iOSSupport/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/JavaScriptCore", + "/System/iOSSupport/System/Library/Frameworks/LinkPresentation.framework/Versions/A/LinkPresentation", + "/System/iOSSupport/System/Library/Frameworks/MapKit.framework/Versions/A/MapKit", + "/System/iOSSupport/System/Library/Frameworks/MediaPlayer.framework/Versions/A/MediaPlayer", + "/System/iOSSupport/System/Library/Frameworks/Messages.framework/Versions/A/Messages", + "/System/iOSSupport/System/Library/Frameworks/MessageUI.framework/Versions/A/MessageUI", + "/System/iOSSupport/System/Library/Frameworks/MetalKit.framework/Versions/A/MetalKit", + "/System/iOSSupport/System/Library/Frameworks/MobileCoreServices.framework/Versions/A/MobileCoreServices", + "/System/iOSSupport/System/Library/Frameworks/MultipeerConnectivity.framework/Versions/A/MultipeerConnectivity", + "/System/iOSSupport/System/Library/Frameworks/PassKit.framework/Versions/A/PassKit", + "/System/iOSSupport/System/Library/Frameworks/PDFKit.framework/Versions/A/PDFKit", + "/System/iOSSupport/System/Library/Frameworks/PencilKit.framework/Versions/A/PencilKit", + "/System/iOSSupport/System/Library/Frameworks/PhotosUI.framework/Versions/A/PhotosUI", + "/System/iOSSupport/System/Library/Frameworks/QuickLook.framework/Versions/A/QuickLook", + "/System/iOSSupport/System/Library/Frameworks/ReplayKit.framework/Versions/A/ReplayKit", + "/System/iOSSupport/System/Library/Frameworks/SafariServices.framework/Versions/A/SafariServices", + "/System/iOSSupport/System/Library/Frameworks/SceneKit.framework/Versions/A/SceneKit", + "/System/iOSSupport/System/Library/Frameworks/ScreenTime.framework/Versions/A/ScreenTime", + "/System/iOSSupport/System/Library/Frameworks/SharedWithYou.framework/Versions/A/SharedWithYou", + "/System/iOSSupport/System/Library/Frameworks/Social.framework/Versions/A/Social", + "/System/iOSSupport/System/Library/Frameworks/SpriteKit.framework/Versions/A/SpriteKit", + "/System/iOSSupport/System/Library/Frameworks/StoreKit.framework/Versions/A/StoreKit", + "/System/iOSSupport/System/Library/Frameworks/UIKit.framework/Versions/A/UIKit", + "/System/iOSSupport/System/Library/Frameworks/UserNotificationsUI.framework/Versions/A/UserNotificationsUI", + "/System/iOSSupport/System/Library/Frameworks/VisionKit.framework/Versions/A/VisionKit", + "/System/iOSSupport/System/Library/Frameworks/WebKit.framework/Versions/A/WebKit", + "/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate", + "/System/Library/Frameworks/Accessibility.framework/Versions/A/Accessibility", + "/System/Library/Frameworks/Accounts.framework/Versions/A/Accounts", + "/System/Library/Frameworks/AdServices.framework/Versions/A/AdServices", + "/System/Library/Frameworks/AdSupport.framework/Versions/A/AdSupport", + "/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit", + "/System/Library/Frameworks/AppTrackingTransparency.framework/Versions/A/AppTrackingTransparency", + "/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox", + "/System/Library/Frameworks/AutomaticAssessmentConfiguration.framework/Versions/A/AutomaticAssessmentConfiguration", + "/System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation", + "/System/Library/Frameworks/AVRouting.framework/Versions/A/AVRouting", + "/System/Library/Frameworks/BackgroundAssets.framework/Versions/A/BackgroundAssets", + "/System/Library/Frameworks/BackgroundTasks.framework/Versions/A/BackgroundTasks", + "/System/Library/Frameworks/CallKit.framework/Versions/A/CallKit", + "/System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork", + "/System/Library/Frameworks/ClassKit.framework/Versions/A/ClassKit", + "/System/Library/Frameworks/CloudKit.framework/Versions/A/CloudKit", + "/System/Library/Frameworks/Contacts.framework/Versions/A/Contacts", + "/System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio", + "/System/Library/Frameworks/CoreBluetooth.framework/Versions/A/CoreBluetooth", + "/System/Library/Frameworks/CoreData.framework/Versions/A/CoreData", + "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation", + "/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics", + "/System/Library/Frameworks/CoreHaptics.framework/Versions/A/CoreHaptics", + "/System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage", + "/System/Library/Frameworks/CoreLocation.framework/Versions/A/CoreLocation", + "/System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia", + "/System/Library/Frameworks/CoreMIDI.framework/Versions/A/CoreMIDI", + "/System/Library/Frameworks/CoreML.framework/Versions/A/CoreML", + "/System/Library/Frameworks/CoreMotion.framework/Versions/A/CoreMotion", + "/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices", + "/System/Library/Frameworks/CoreSpotlight.framework/Versions/A/CoreSpotlight", + "/System/Library/Frameworks/CoreTelephony.framework/Versions/A/CoreTelephony", + "/System/Library/Frameworks/CoreText.framework/Versions/A/CoreText", + "/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo", + "/System/Library/Frameworks/CoreWLAN.framework/Versions/A/CoreWLAN", + "/System/Library/Frameworks/CryptoKit.framework/Versions/A/CryptoKit", + "/System/Library/Frameworks/CryptoTokenKit.framework/Versions/A/CryptoTokenKit", + "/System/Library/Frameworks/DeviceCheck.framework/Versions/A/DeviceCheck", + "/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Versions/A/DeviceDiscoveryExtension", + "/System/Library/Frameworks/EventKit.framework/Versions/A/EventKit", + "/System/Library/Frameworks/ExecutionPolicy.framework/Versions/A/ExecutionPolicy", + "/System/Library/Frameworks/ExternalAccessory.framework/ExternalAccessory", + "/System/Library/Frameworks/FileProvider.framework/Versions/A/FileProvider", + "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation", + "/System/Library/Frameworks/GSS.framework/Versions/A/GSS", + "/System/Library/Frameworks/HealthKit.framework/Versions/A/HealthKit", + "/System/Library/Frameworks/IdentityLookup.framework/Versions/A/IdentityLookup", + "/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO", + "/System/Library/Frameworks/Intents.framework/Versions/A/Intents", + "/System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface", + "/System/Library/Frameworks/LocalAuthentication.framework/Versions/A/LocalAuthentication", + "/System/Library/Frameworks/MediaAccessibility.framework/Versions/A/MediaAccessibility", + "/System/Library/Frameworks/MediaToolbox.framework/Versions/A/MediaToolbox", + "/System/Library/Frameworks/Metal.framework/Versions/A/Metal", + "/System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/MetalPerformanceShaders", + "/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Versions/A/MetalPerformanceShadersGraph", + "/System/Library/Frameworks/MetricKit.framework/Versions/A/MetricKit", + "/System/Library/Frameworks/MLCompute.framework/Versions/A/MLCompute", + "/System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO", + "/System/Library/Frameworks/NaturalLanguage.framework/Versions/A/NaturalLanguage", + "/System/Library/Frameworks/NearbyInteraction.framework/Versions/A/NearbyInteraction", + "/System/Library/Frameworks/Network.framework/Versions/A/Network", + "/System/Library/Frameworks/NetworkExtension.framework/Versions/A/NetworkExtension", + "/System/Library/Frameworks/OSLog.framework/Versions/A/OSLog", + "/System/Library/Frameworks/PHASE.framework/Versions/A/PHASE", + "/System/Library/Frameworks/Photos.framework/Versions/A/Photos", + "/System/Library/Frameworks/PushKit.framework/Versions/A/PushKit", + "/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore", + "/System/Library/Frameworks/QuickLookThumbnailing.framework/Versions/A/QuickLookThumbnailing", + "/System/Library/Frameworks/Security.framework/Versions/A/Security", + "/System/Library/Frameworks/SensitiveContentAnalysis.framework/Versions/A/SensitiveContentAnalysis", + "/System/Library/Frameworks/SensorKit.framework/Versions/A/SensorKit", + "/System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement", + "/System/Library/Frameworks/SharedWithYouCore.framework/Versions/A/SharedWithYouCore", + "/System/Library/Frameworks/ShazamKit.framework/Versions/A/ShazamKit", + "/System/Library/Frameworks/SoundAnalysis.framework/Versions/A/SoundAnalysis", + "/System/Library/Frameworks/Speech.framework/Versions/A/Speech", + "/System/Library/Frameworks/Symbols.framework/Versions/A/Symbols", + "/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration", + "/System/Library/Frameworks/ThreadNetwork.framework/Versions/A/ThreadNetwork", + "/System/Library/Frameworks/UniformTypeIdentifiers.framework/Versions/A/UniformTypeIdentifiers", + "/System/Library/Frameworks/UserNotifications.framework/Versions/A/UserNotifications", + "/System/Library/Frameworks/VideoToolbox.framework/Versions/A/VideoToolbox", + "/System/Library/Frameworks/Vision.framework/Versions/A/Vision", + "/usr/lib/libc++.1.dylib", + "/usr/lib/libcompression.dylib", + "/usr/lib/libiconv.2.dylib", + "/usr/lib/libicucore.A.dylib", + "/usr/lib/libobjc.A.dylib", + "/usr/lib/libSystem.B.dylib", + "/usr/lib/libz.1.dylib", + "/usr/lib/swift/libswiftCore.dylib", + "/usr/lib/swift/libswiftCoreFoundation.dylib", + "/usr/lib/swift/libswiftDarwin.dylib", + "/usr/lib/swift/libswiftDispatch.dylib", + "/usr/lib/swift/libswiftFoundation.dylib", + "/usr/lib/swift/libswiftIOKit.dylib", + "/usr/lib/swift/libswiftObjectiveC.dylib", + "/usr/lib/swift/libswiftXPC.dylib", + ]; + + static string [] expectedFrameworks_MacCatalyst_Full = [ + "/System/iOSSupport/System/Library/Frameworks/UIKit.framework/Versions/A/UIKit", + "/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit", + "/System/Library/Frameworks/CloudKit.framework/Versions/A/CloudKit", + "/System/Library/Frameworks/CoreData.framework/Versions/A/CoreData", + "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation", + "/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics", + "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation", + "/System/Library/Frameworks/GSS.framework/Versions/A/GSS", + "/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore", + "/System/Library/Frameworks/Security.framework/Versions/A/Security", + "/usr/lib/libc++.1.dylib", + "/usr/lib/libcompression.dylib", + "/usr/lib/libiconv.2.dylib", + "/usr/lib/libicucore.A.dylib", + "/usr/lib/libobjc.A.dylib", + "/usr/lib/libSystem.B.dylib", + "/usr/lib/libz.1.dylib", + ]; + + static IEnumerable GetLinkedWithNativeLibrariesTestCases () + { + // Generally speaking, whenever we bind a new framework, we'll have to adjust the LinkMode="None" test cases, + // but we shouldn't have to adjust the LinkMode="Full" test cases (which would typically mean that we'll end + // up linking with said framework in every app - it's also an indication that we're not trimming away as much + // as we want, because just adding an (unused) framework shouldn't make it impossible to trim away all the + // code in that framework). + // + // However, new .NET versions often require updates to both the "None" and "Full lists of frameworks and libraries. + // + + yield return new TestCaseData (ApplePlatform.iOS, "ios-arm64", "None", expectedFrameworks_iOS_None); + yield return new TestCaseData (ApplePlatform.iOS, "ios-arm64", "Full", expectedFrameworks_iOS_Full); + yield return new TestCaseData (ApplePlatform.TVOS, "tvos-arm64", "None", expectedFrameworks_tvOS_None); + yield return new TestCaseData (ApplePlatform.TVOS, "tvos-arm64", "Full", expectedFrameworks_tvOS_Full); + yield return new TestCaseData (ApplePlatform.MacOSX, "osx-arm64", "None", expectedFrameworks_macOS_None); + yield return new TestCaseData (ApplePlatform.MacOSX, "osx-arm64", "Full", expectedFrameworks_macOS_Full); + yield return new TestCaseData (ApplePlatform.MacCatalyst, "maccatalyst-x64", "None", expectedFrameworks_MacCatalyst_None); + yield return new TestCaseData (ApplePlatform.MacCatalyst, "maccatalyst-x64", "Full", expectedFrameworks_MacCatalyst_Full); + } + + [TestCaseSource (nameof (GetLinkedWithNativeLibrariesTestCases))] + public void LinkedWithNativeLibraries (ApplePlatform platform, string runtimeIdentifiers, string linkMode, string [] expectedFrameworks) + { + var project = "MySimpleApp"; + Configuration.IgnoreIfIgnoredPlatform (platform); + Configuration.AssertRuntimeIdentifiersAvailable (platform, runtimeIdentifiers); + + var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath); + Clean (project_path); + var properties = GetDefaultProperties (runtimeIdentifiers); + properties ["MtouchLink"] = linkMode; + properties ["LinkMode"] = linkMode; + if (platform != ApplePlatform.MacOSX) + properties ["UseInterpreter"] = "true"; // just to speed up the build + DotNet.AssertBuild (project_path, properties); + + var appExecutable = GetNativeExecutable (platform, appPath); + var actualFrameworks = GetLinkedWithFrameworks (appExecutable); + CollectionAssert.AreEquivalent ( + expectedFrameworks.OrderBy (v => v).ToArray (), + actualFrameworks.OrderBy (v => v).ToArray (), + "Frameworks"); + } + + static HashSet GetLinkedWithFrameworks (string path) + { + var rv = new HashSet (); + foreach (var file in MachO.Read (path)) { + foreach (var lc in file.load_commands) { + if (lc is DylibLoadCommand loadCommand) { + rv.Add (loadCommand.name); + } + } + } + return rv; + } } } diff --git a/tests/generator/BGenTool.cs b/tests/generator/BGenTool.cs index 68c3faafe80b..4326c98f24b0 100644 --- a/tests/generator/BGenTool.cs +++ b/tests/generator/BGenTool.cs @@ -247,7 +247,7 @@ public static void AddPreviewNoWarn (IList argumentList) public static string? GetPreviewNoWarn (string? existingNowarn) { if (Configuration.XcodeIsStable) - return null; + return existingNowarn; var previewNoWarn = $"XCODE_{Configuration.XcodeVersion.Major}_{Configuration.XcodeVersion.Minor}_PREVIEW"; if (string.IsNullOrEmpty (existingNowarn)) { diff --git a/tests/introspection/ApiPInvokeTest.cs b/tests/introspection/ApiPInvokeTest.cs index 043ef299944a..e75f72d0e01e 100644 --- a/tests/introspection/ApiPInvokeTest.cs +++ b/tests/introspection/ApiPInvokeTest.cs @@ -158,13 +158,7 @@ public void SymbolExists () case "System.Native": case "System.Security.Cryptography.Native.Apple": case "System.Net.Security.Native": - if (MonoNativeConfig.LinkMode == MonoNativeLinkMode.None) - continue; -#if __IOS__ - libname = MonoNativeConfig.GetPInvokeLibraryName (MonoNativeFlavor.Unified, MonoNativeConfig.LinkMode); -#else libname = null; -#endif break; } @@ -248,13 +242,7 @@ protected void Check (Assembly a) case "System.Native": case "System.Security.Cryptography.Native.Apple": case "System.Net.Security.Native": - if (MonoNativeConfig.LinkMode == MonoNativeLinkMode.None) - continue; -#if __IOS__ - path = MonoNativeConfig.GetPInvokeLibraryName (MonoNativeFlavor.Unified, MonoNativeConfig.LinkMode); -#else path = null; -#endif break; } diff --git a/tests/introspection/Mac/introspection-mac.csproj b/tests/introspection/Mac/introspection-mac.csproj index 7119a988ade4..1909259c4a0e 100644 --- a/tests/introspection/Mac/introspection-mac.csproj +++ b/tests/introspection/Mac/introspection-mac.csproj @@ -122,9 +122,6 @@ TestRuntime.cs - - MonoNativeConfig.cs - ApiAvailabilityTest.cs diff --git a/tests/introspection/dotnet/iOS/introspection.csproj b/tests/introspection/dotnet/iOS/introspection.csproj index 6bd13ee186cf..8aec236aa0ab 100644 --- a/tests/introspection/dotnet/iOS/introspection.csproj +++ b/tests/introspection/dotnet/iOS/introspection.csproj @@ -2,6 +2,8 @@ net$(BundledNETCoreAppTargetFrameworkVersion)-ios + + true diff --git a/tests/introspection/dotnet/macOS/introspection.csproj b/tests/introspection/dotnet/macOS/introspection.csproj index 29307a09fef5..3a187c9a8bd6 100644 --- a/tests/introspection/dotnet/macOS/introspection.csproj +++ b/tests/introspection/dotnet/macOS/introspection.csproj @@ -2,6 +2,8 @@ net$(BundledNETCoreAppTargetFrameworkVersion)-macos + + true diff --git a/tests/introspection/dotnet/shared.csproj b/tests/introspection/dotnet/shared.csproj index c787b358fcf5..a20624fe5b36 100644 --- a/tests/introspection/dotnet/shared.csproj +++ b/tests/introspection/dotnet/shared.csproj @@ -111,9 +111,6 @@ EnvironmentVariable.cs - - MonoNativeConfig.cs - PlatformInfo.cs diff --git a/tests/introspection/dotnet/tvOS/introspection.csproj b/tests/introspection/dotnet/tvOS/introspection.csproj index e3d65c592a4e..b0232ed33cc2 100644 --- a/tests/introspection/dotnet/tvOS/introspection.csproj +++ b/tests/introspection/dotnet/tvOS/introspection.csproj @@ -2,6 +2,8 @@ net$(BundledNETCoreAppTargetFrameworkVersion)-tvos + + true diff --git a/tests/introspection/iOS/introspection-ios.csproj b/tests/introspection/iOS/introspection-ios.csproj index 56901f7b3870..8e2601f88ae0 100644 --- a/tests/introspection/iOS/introspection-ios.csproj +++ b/tests/introspection/iOS/introspection-ios.csproj @@ -148,9 +148,6 @@ EnvironmentVariable.cs - - MonoNativeConfig.cs - PlatformInfo.cs diff --git a/tests/mmptest/src/CodeStrippingTests.cs b/tests/mmptest/src/CodeStrippingTests.cs index 5fb469da1b54..45ec14d41849 100644 --- a/tests/mmptest/src/CodeStrippingTests.cs +++ b/tests/mmptest/src/CodeStrippingTests.cs @@ -9,11 +9,11 @@ namespace Xamarin.MMP.Tests { public class CodeStrippingTests { static Func LipoStripConditional = s => s.Contains ("lipo") && s.Contains ("-extract_family"); - static Func LipoStripSkipPosixAndMonoNativeConditional = s => LipoStripConditional (s) && !s.Contains ("libMonoPosixHelper.dylib") && !s.Contains ("libmono-native.dylib"); + static Func LipoStripSkipPosixConditional = s => LipoStripConditional (s) && !s.Contains ("libMonoPosixHelper.dylib"); - static bool DidAnyLipoStripSkipPosixAndMonoNative (BuildResult buildResult) + static bool DidAnyLipoStripSkipPosix (BuildResult buildResult) { - return buildResult.BuildOutputLines.Any (LipoStripSkipPosixAndMonoNativeConditional); + return buildResult.BuildOutputLines.Any (LipoStripSkipPosixConditional); } static bool DidAnyLipoStrip (BuildResult buildResult) @@ -129,9 +129,9 @@ void AssertNoLipoOrWarning (BuildResult buildOutput, string context) Assert.False (buildOutput.HasMessage (2108), "MM2108 incorrectly given in in context: " + context); } - void AssertLipoOnlyMonoPosixAndMonoNative (BuildResult buildOutput, string context) + void AssertLipoOnlyMonoPosix (BuildResult buildOutput, string context) { - Assert.False (DidAnyLipoStripSkipPosixAndMonoNative (buildOutput), "lipo incorrectly run in context outside of libMonoPosixHelper/libmono-native: " + context); + Assert.False (DidAnyLipoStripSkipPosix (buildOutput), "lipo incorrectly run in context outside of libMonoPosixHelper/libmono-native: " + context); Assert.False (buildOutput.HasMessage (2108), "MM2108 incorrectly given in in context: " + context); } @@ -173,7 +173,7 @@ public void ThirdPartyLibrary_WithCorrectBitness_ShouldNotStripOrWarn () test.Release = true; testResult = TI.TestUnifiedExecutable (test); - AssertLipoOnlyMonoPosixAndMonoNative (testResult.BuildResult, "Release"); // libMonoPosixHelper.dylib and libmono-native.dylib will lipo in Release + AssertLipoOnlyMonoPosix (testResult.BuildResult, "Release"); // libMonoPosixHelper.dylib and libmono-native.dylib will lipo in Release }); } } diff --git a/tests/mono-native/.gitignore b/tests/mono-native/.gitignore deleted file mode 100644 index 7f0c25398785..000000000000 --- a/tests/mono-native/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.csproj diff --git a/tests/mono-native/AppDelegate.cs b/tests/mono-native/AppDelegate.cs deleted file mode 100644 index e08e3de2785a..000000000000 --- a/tests/mono-native/AppDelegate.cs +++ /dev/null @@ -1,117 +0,0 @@ -#if !__WATCHOS__ && !MONOMAC -using System; -using System.Collections.Generic; -using System.Reflection; -using Foundation; -using UIKit; -using MonoTouch.NUnit.UI; -using NUnit.Framework.Internal; - -namespace Mono.Native.Tests { - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to - // application events from iOS. - [Register ("AppDelegate")] - public partial class AppDelegate : UIApplicationDelegate { - // class-level declarations - static UIWindow window; - TouchRunner runner; - -#if !__TVOS__ - public override bool AccessibilityPerformMagicTap () - { - try { - runner.OpenWriter ("Magic Tap"); - runner.Run (runner.LoadedTest as TestSuite); - } finally { - runner.CloseWriter (); - } - return true; - } -#endif - // - // This method is invoked when the application has loaded and is ready to run. In this - // method you should instantiate the window, load the UI into it and then make the window - // visible. - // - // You have 17 seconds to return from this method, or iOS will terminate your application. - // - public override bool FinishedLaunching (UIApplication app, NSDictionary options) - { - // create a new window instance based on the screen size - window = new UIWindow (UIScreen.MainScreen.Bounds); - runner = new TouchRunner (window); - - // tests can be inside the main assembly - runner.Add (Assembly.GetExecutingAssembly ()); - - window.RootViewController = new UINavigationController (runner.GetViewController ()); - // make the window visible - window.MakeKeyAndVisible (); - - return true; - } - - public static void PresentModalViewController (UIViewController vc, double duration) - { - var bckp = window.RootViewController; - window.RootViewController = vc; - try { - NSRunLoop.Main.RunUntil (NSDate.Now.AddSeconds (duration)); - } finally { - window.RootViewController = bckp; - } - } - - public static bool RunAsync (DateTime timeout, Action action, Func check_completed) - { - var vc = new AsyncController (action); - var bckp = window.RootViewController; - window.RootViewController = vc; - try { - do { - if (timeout < DateTime.Now) - return false; - NSRunLoop.Main.RunUntil (NSDate.Now.AddSeconds (0.1)); - } while (!check_completed ()); - } finally { - window.RootViewController = bckp; - } - - return true; - } - - static void Main (string [] args) - { - UIApplication.Main (args, null, typeof (AppDelegate)); - } - } - - class AsyncController : UIViewController { - Action action; - static int counter; - - public AsyncController (Action action) - { - this.action = action; - counter++; - } - - public override void ViewDidLoad () - { - base.ViewDidLoad (); - - switch (counter % 2) { - case 0: - View.BackgroundColor = UIColor.Yellow; - break; - default: - View.BackgroundColor = UIColor.LightGray; - break; - } - NSTimer.CreateScheduledTimer (0.01, (v) => action ()); - } - } -} - -#endif // !__WATCHOS__ diff --git a/tests/mono-native/Introspection.cs b/tests/mono-native/Introspection.cs deleted file mode 100644 index 6343229c77ca..000000000000 --- a/tests/mono-native/Introspection.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Threading; -using System.Reflection; -using System.Runtime.InteropServices; -using NUnit.Framework; -using ObjCRuntime; - -namespace Xamarin.Tests { - [TestFixture] - public class Introspection { - public static string RootDirectory => Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location); - - void AssertShouldExist (string name) - { - var pathName = Path.Combine (RootDirectory, name); - Assert.That (File.Exists (pathName), $"Found {name}."); - } - - void AssertShouldNotExist (string name) - { - var pathName = Path.Combine (RootDirectory, name); - Assert.That (File.Exists (pathName), Is.False, $"Should not have {name}."); - } - - int CountFiles (string pattern) - { - // Don't use Linq as it'd use too much memory. - return Directory.GetFiles (RootDirectory, pattern, SearchOption.AllDirectories).Length; - } - - void CheckDynamicLibrary () - { - AssertShouldExist (MonoNativeConfig.DynamicLibraryName); - AssertShouldNotExist ("libmono-native.dylib"); - - var count = CountFiles ("libmono-native*"); - Assert.That (count, Is.EqualTo (1), "exactly one mono-native library."); - } - - void CheckStaticLibrary () - { - AssertShouldNotExist ("libmono-native.dylib"); - AssertShouldNotExist ("libmono-native-compat.dylib"); - AssertShouldNotExist ("libmono-native-unified.dylib"); - - var count = CountFiles ("libmono-native*"); - Assert.That (count, Is.EqualTo (0), "zero mono-native libraries."); - } - - void CheckSymlinkedLibrary () - { - AssertShouldExist ("libmono-native.dylib"); - AssertShouldNotExist ("libmono-native-compat.dylib"); - AssertShouldNotExist ("libmono-native-unified.dylib"); - - var count = CountFiles ("libmono-native*"); - Assert.That (count, Is.EqualTo (1), "exactly one mono-native library."); - } - - [Test] - public void CheckLibrary () - { - switch (MonoNativeConfig.LinkMode) { - case MonoNativeLinkMode.Dynamic: - CheckDynamicLibrary (); - break; - case MonoNativeLinkMode.Static: - CheckStaticLibrary (); - break; - case MonoNativeLinkMode.Symlink: - CheckSymlinkedLibrary (); - break; - default: - Assert.Fail ($"Unknown link mode: {MonoNativeConfig.LinkMode}"); - break; - } - } - - [DllImport ("System.Native")] - extern static void mono_native_initialize (); - - [Test] - public void TestInvoke () - { - mono_native_initialize (); - } - } -} diff --git a/tests/mono-native/MacAppDelegate.cs b/tests/mono-native/MacAppDelegate.cs deleted file mode 100644 index b8b1ef0127ae..000000000000 --- a/tests/mono-native/MacAppDelegate.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using NUnitLite; -using AppKit; -using Foundation; - -namespace Mono.Native.Tests { - [Register ("AppDelegate")] - public class MacAppDelegate : NSApplicationDelegate { - public override void DidFinishLaunching (NSNotification notification) - { - } - - public override void WillTerminate (NSNotification notification) - { - // Insert code here to tear down your application - } - } -} diff --git a/tests/mono-native/MacMain.cs b/tests/mono-native/MacMain.cs deleted file mode 100644 index b2e379ef7de7..000000000000 --- a/tests/mono-native/MacMain.cs +++ /dev/null @@ -1,10 +0,0 @@ -using NUnitLite; - -namespace mononativetests { - public class Application { - static int Main (string [] args) - { - return new AutoRun ().Execute (args); - } - } -} diff --git a/tests/mono-native/Main.cs b/tests/mono-native/Main.cs deleted file mode 100644 index aaa9fe15eeb7..000000000000 --- a/tests/mono-native/Main.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -#if __WATCHOS__ -using Foundation; -#endif -using UIKit; - -partial class TestRuntime { - public static bool RunAsync (DateTime timeout, Action action, Func check_completed) - { -#if __WATCHOS__ - NSTimer.CreateScheduledTimer (0.01, (v) => action ()); - do { - if (timeout < DateTime.Now) - return false; - NSRunLoop.Main.RunUntil (NSDate.Now.AddSeconds (0.1)); - } while (!check_completed ()); - - return true; -#else - return Mono.Native.Tests.AppDelegate.RunAsync (timeout, action, check_completed); -#endif - } -} diff --git a/tests/mono-native/NativePlatformConfig.cs b/tests/mono-native/NativePlatformConfig.cs deleted file mode 100644 index 08f3a9056122..000000000000 --- a/tests/mono-native/NativePlatformConfig.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.IO; -using System.Reflection; -using NUnit.Framework; -using Mono; - -namespace Xamarin.Tests { - [TestFixture] - public class NativePlatformConfig { - [Test] - public void PlatformType () - { - var type = MonoNativePlatform.GetPlatformType (); - Assert.That ((int) type, Is.GreaterThan (0), "platform type"); - - var usingCompat = (type & MonoNativePlatformType.MONO_NATIVE_PLATFORM_TYPE_COMPAT) != 0; - Assert.AreEqual (MonoNativeConfig.UsingCompat, usingCompat, "using compatibility layer"); - } - } -} diff --git a/tests/mono-native/iOS/Info.plist b/tests/mono-native/iOS/Info.plist deleted file mode 100644 index 1a07cf53dc9a..000000000000 --- a/tests/mono-native/iOS/Info.plist +++ /dev/null @@ -1,44 +0,0 @@ - - - - - CFBundleDisplayName - MonoNativeTest - CFBundleIdentifier - com.xamarin.mono-native-test - CFBundleName - MonoNativeTest - MinimumOSVersion - 12.2 - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UIDeviceFamily - - 1 - 2 - - UILaunchStoryboardName - LaunchScreen - UIRequiresFullScreen - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - XSAppIconAssets - Assets.xcassets/AppIcons.appiconset - - diff --git a/tests/mono-native/iOS/mono-native.csproj.template b/tests/mono-native/iOS/mono-native.csproj.template deleted file mode 100644 index 18c13ef180c5..000000000000 --- a/tests/mono-native/iOS/mono-native.csproj.template +++ /dev/null @@ -1,125 +0,0 @@ - - - - Debug - iPhoneSimulator - 10.0.0 - 2.0 - {26125265-2204-4514-A572-36079CA4F925} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Mono.Native.Tests - Resources - mononativetests - 168,169,219,414,612,618,649,672 - Xamarin.iOS - obj\$(Platform)\$(Configuration)-unified - PackageReference - ..\.. - latest - true - - - MONO_NATIVE_SYMLINK - MONO_NATIVE_STATIC - $(MonoNativeMode);$(DefineConstants) - - - True - full - False - bin\iPhoneSimulator\$(Configuration)-unified - DEBUG;$(DefineConstants) - prompt - 4 - True - None - True - -v -v - x86_64 - iPhone Developer - HttpClientHandler - - - none - True - bin\iPhoneSimulator\$(Configuration)-unified - $(DefineConstants) - prompt - 4 - None - True - -v -v - x86_64 - HttpClientHandler - - - True - full - False - bin\iPhone\$(Configuration)-unified - DEBUG;$(DefineConstants) - prompt - 4 - iPhone Developer - True - True - -v -v - ARM64 - SdkOnly - HttpClientHandler - - - none - True - bin\iPhone\$(Configuration)-unified - $(DefineConstants) - prompt - 4 - iPhone Developer - True - -v -v - ARM64 - true - SdkOnly - HttpClientHandler - - - - - - - - {F611ED96-54B5-4975-99BB-12F50AF95936} - Touch.Client-iOS - - - - - - - - Info.plist - - - - - - - - MonoNativePlatform.cs - - - MonoNativePlatformType.cs - - - NativePlatformTest.cs - - - MonoNativeConfig.cs - - - - - - diff --git a/tests/mono-native/macOS/Entitlements.plist b/tests/mono-native/macOS/Entitlements.plist deleted file mode 100644 index 9ae599370b42..000000000000 --- a/tests/mono-native/macOS/Entitlements.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/mono-native/macOS/Info.plist b/tests/mono-native/macOS/Info.plist deleted file mode 100644 index 7d7eb38e1bd1..000000000000 --- a/tests/mono-native/macOS/Info.plist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - CFBundleName - mononativetests - CFBundleIdentifier - com.xamarin.mononativetests - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSMinimumSystemVersion - 12.0 - CFBundleDevelopmentRegion - en - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleSignature - ???? - NSHumanReadableCopyright - Xamarin Inc. (http://www.xamarin.com) - NSPrincipalClass - NSApplication - NSMainStoryboardFile - Main - - diff --git a/tests/mono-native/macOS/mono-native.csproj.template b/tests/mono-native/macOS/mono-native.csproj.template deleted file mode 100644 index 82a7761c8c04..000000000000 --- a/tests/mono-native/macOS/mono-native.csproj.template +++ /dev/null @@ -1,85 +0,0 @@ - - - - ..\.. - Debug - AnyCPU - {2B174B45-CC6B-443D-870F-6B5394FDE3FD} - {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Mono.Native.Tests - mononativetests - Resources - 67,168,169,219,414,612,618,649,672 - Xamarin.Mac - v2.0 - $(DefineConstants);MOBILE;XAMMAC - PackageReference - latest - true - - - false - bin\Mac - 4 - false - false - false - false - HttpClientHandler - None - $(DefineConstants); - - - - - - - - - - Info.plist - - - - - - MacMain.cs - - - Assert.cs - - - MonoNativeConfig.cs - - - TestAssemblyLoader.cs - - - - MonoNativePlatform.cs - - - MonoNativePlatformType.cs - - - NativePlatformTest.cs - - - TestRuntime.cs - - - ApplePlatform.cs - - - SdkVersions.cs - - - - - {88A8A1AC-0829-4C98-8F4A-9FC23DC42A06} - Touch.Client-macOS-mobile - - - - \ No newline at end of file diff --git a/tests/monotouch-test/CoreText/FontManagerTest.cs b/tests/monotouch-test/CoreText/FontManagerTest.cs index 098f7789f929..63ab0b683b9a 100644 --- a/tests/monotouch-test/CoreText/FontManagerTest.cs +++ b/tests/monotouch-test/CoreText/FontManagerTest.cs @@ -188,7 +188,6 @@ public void UnregisterFontDescriptors_Null () Assert.Throws (() => CTFontManager.UnregisterFontDescriptors (new CTFontDescriptor [] { null }, CTFontManagerScope.Process, null), "null element"); } -#if !__WATCHOS__ [Test] public void RegisterFontDescriptors_NoCallback () { @@ -205,11 +204,6 @@ public void RegisterFontDescriptors_NoCallback () } } -#if __TVOS__ - [Ignore ("Fails on tvOS with undocumented error code 'The operation couldn’t be completed. (com.apple.CoreText.CTFontManagerErrorDomain error 500.'")] -#elif __IOS__ - [Ignore ("https://github.com/xamarin/xamarin-macios/issues/6690. This began failing for no aparent reason in iOS 13 Beta 5. Check back with GM.")] -#endif [Test] public void RegisterFontDescriptors_WithCallback () { @@ -220,13 +214,30 @@ public void RegisterFontDescriptors_WithCallback () StyleName = "Bold", Size = 16.0f }; + Exception? ex = null; using (CTFontDescriptor fd = new CTFontDescriptor (fda)) { var array = new [] { fd }; - CTFontManager.RegisterFontDescriptors (array, CTFontManagerScope.Process, true, SuccessDone); - CTFontManager.UnregisterFontDescriptors (array, CTFontManagerScope.Process, SuccessDone); + CTFontManager.RegisterFontDescriptors (array, CTFontManagerScope.Process, true, (NSError [] errors, bool done) => { + try { + Assert.True (done, "done: RegisterFontDescriptors"); + } catch (Exception e) { + ex = e; + } + return true; + }); + Assert.That (ex, Is.Null.Or.Not.Null, "RegisterFontDescriptors"); + + CTFontManager.UnregisterFontDescriptors (array, CTFontManagerScope.Process, (NSError [] errors, bool done) => { + try { + Assert.True (done, "done: UnregisterFontDescriptors"); + } catch (Exception e) { + ex = e; + } + return true; + }); + Assert.That (ex, Is.Null.Or.Not.Null, "UnregisterFontDescriptors"); } } -#endif [Test] public void GetFontsNullUrl () diff --git a/tests/monotouch-test/CoreText/StringAttributes.cs b/tests/monotouch-test/CoreText/StringAttributes.cs index 049196ae4455..7bc7e36d8ded 100644 --- a/tests/monotouch-test/CoreText/StringAttributes.cs +++ b/tests/monotouch-test/CoreText/StringAttributes.cs @@ -24,13 +24,9 @@ namespace MonoTouchFixtures.CoreText { [TestFixture] [Preserve (AllMembers = true)] public class StringAttributesTests { -#if !MONOMAC // No UIGraphics on mac [Test] - public void SimpleValuesSet () + public void NoCTLine () { - if (TestRuntime.CheckXcodeVersion (15, 0)) - Assert.Ignore ("Test timeouts on Xcode 15 beta 4: https://github.com/xamarin/xamarin-macios/issues/18656"); - var sa = new CTStringAttributes (); sa.ForegroundColor = UIColor.Blue.CGColor; sa.Font = new CTFont ("Georgia-BoldItalic", 24); @@ -50,14 +46,51 @@ public void SimpleValuesSet () sa.TrackingAdjustment = 1.0f; AdaptiveImageProvider? provider = null; -#if NET + if (TestRuntime.CheckXcodeVersion (16, 0)) { + sa.AdaptiveImageProvider = provider = new AdaptiveImageProvider (); + Assert.AreSame (provider, sa.AdaptiveImageProvider, "AdaptiveImageProvider"); + } + } + + [Test] + public void SimpleValuesSet () + { + var sa = new CTStringAttributes (); + sa.ForegroundColor = UIColor.Blue.CGColor; + sa.Font = new CTFont ("Georgia-BoldItalic", 24); + sa.UnderlineStyle = CTUnderlineStyle.Double; // It does not seem to do anything + sa.UnderlineColor = UIColor.Blue.CGColor; + sa.UnderlineStyleModifiers = CTUnderlineStyleModifiers.PatternDashDotDot; + + Assert.IsNull (sa.BaselineClass, "#0"); + sa.BaselineClass = CTBaselineClass.IdeographicHigh; + Assert.AreEqual (CTBaselineClass.IdeographicHigh, sa.BaselineClass, "#1"); + + // Calling sa.SetBaselineInfo makes the CTLine ctor crash (https://github.com/xamarin/maccore/issues/2947) + // so don't do that here. + // sa.SetBaselineInfo (CTBaselineClass.Roman, 13); + // sa.SetBaselineInfo (CTBaselineClass.IdeographicHigh, 3); + sa.SetWritingDirection (CTWritingDirection.LeftToRight); + + if (TestRuntime.CheckXcodeVersion (11, 0)) + sa.TrackingAdjustment = 1.0f; + + AdaptiveImageProvider? provider = null; if (TestRuntime.CheckXcodeVersion (16, 0)) sa.AdaptiveImageProvider = provider = new AdaptiveImageProvider (); -#endif var size = new CGSize (300, 300); +#if MONOMAC + using var imageRep = new NSBitmapImageRep (IntPtr.Zero, (nint) size.Width, (nint) size.Height, 8, 4, true, false, NSColorSpace.DeviceRGB, 4 * (int) size.Width, 32); + using var graphicsContext = NSGraphicsContext.FromBitmap (imageRep); + using var img = new NSImage (size); + img.AddRepresentation (imageRep); + img.LockFocus (); + using var gctx = graphicsContext.CGContext; +#else UIGraphics.BeginImageContext (size); - var gctx = UIGraphics.GetCurrentContext (); + using var gctx = UIGraphics.GetCurrentContext (); +#endif gctx.SetFillColor (UIColor.Green.CGColor); @@ -67,9 +100,8 @@ public void SimpleValuesSet () textLine.Draw (gctx); } -#if NET if (TestRuntime.CheckXcodeVersion (16, 0)) - Assert.AreEqual (0, provider!.Count, "AdaptiveImageProvider #0"); + Assert.AreEqual (1, provider!.Count, "AdaptiveImageProvider #0"); attributedString = new NSAttributedString ("🙈`", sa); using (var textLine = new CTLine (attributedString)) { @@ -77,12 +109,14 @@ public void SimpleValuesSet () } if (TestRuntime.CheckXcodeVersion (16, 0)) - Assert.AreEqual (1, provider!.Count, "AdaptiveImageProvider #1"); -#endif + Assert.AreEqual (2, provider!.Count, "AdaptiveImageProvider #1"); +#if MONOMAC + img.UnlockFocus (); +#else UIGraphics.EndImageContext (); - } #endif + } [Test] public void BackgroundColor () diff --git a/tests/monotouch-test/ObjCRuntime/RegistrarTestGenerated.cs b/tests/monotouch-test/ObjCRuntime/RegistrarTestGenerated.cs index f1d9f7930ab0..2a500d50b312 100644 --- a/tests/monotouch-test/ObjCRuntime/RegistrarTestGenerated.cs +++ b/tests/monotouch-test/ObjCRuntime/RegistrarTestGenerated.cs @@ -1,3 +1,4 @@ +using ObjCRuntime; using System.Runtime.CompilerServices; using NUnit.Framework; @@ -8,13 +9,24 @@ public partial class RegistrarTestGenerated { void AssertIfIgnored ([CallerMemberName] string testCase = null) { switch (testCase) { -#if __WATCHOS__ - case "Test_c": - case "Test_cc": - case "Test_ccc": - case "Test_s": - case "Test_sss": - Assert.Ignore ("https://github.com/mono/mono/issues/8486"); +#if __MACCATALYST__ + case "NSNumberBindAs_Boolean_Array_Overrides": + case "NSNumberBindAs_Byte_Array_Overrides": + case "NSNumberBindAs_Double_Array_Overrides": + case "NSNumberBindAs_Int16_Array_Overrides": + case "NSNumberBindAs_Int32_Array_Overrides": + case "NSNumberBindAs_Int64_Array_Overrides": + case "NSNumberBindAs_nint_Array_Overrides": + case "NSNumberBindAs_NSStreamStatus_Array_Overrides": + case "NSNumberBindAs_nuint_Array_Overrides": + case "NSNumberBindAs_SByte_Array_Overrides": + case "NSNumberBindAs_Single_Array_Overrides": + case "NSNumberBindAs_UInt16_Array_Overrides": + case "NSNumberBindAs_UInt32_Array_Overrides": + case "NSNumberBindAs_UInt64_Array_Overrides": + // https://github.com/xamarin/xamarin-macios/issues/19781 + if (Runtime.IsARM64CallingConvention) + Assert.Ignore ("https://github.com/xamarin/xamarin-macios/issues/19781"); break; #endif default: diff --git a/tests/monotouch-test/PassKit/PKPayLaterViewTest.cs b/tests/monotouch-test/PassKit/PKPayLaterViewTest.cs index 54ab17be2f74..3dafe6dec6b0 100644 --- a/tests/monotouch-test/PassKit/PKPayLaterViewTest.cs +++ b/tests/monotouch-test/PassKit/PKPayLaterViewTest.cs @@ -1,31 +1,55 @@ -// Can be uncommented when this issue is resolved: # https://github.com/xamarin/xamarin-macios/issues/19271 +#if __IOS__ && !__MACCATALYST__ -// #if __IOS__ && !__MACCATALYST__ +using System; +using System.Threading; -// using System; -// using Foundation; -// using UIKit; -// using PassKit; -// using NUnit.Framework; +using Foundation; +using UIKit; -// namespace MonoTouchFixtures.PassKit { +using PassKit; -// [TestFixture] -// [Preserve (AllMembers = true)] -// public class PKPayLaterViewTest { +using NUnit.Framework; -// [Test] -// public void ValidateAmountTest () -// { -// TestRuntime.AssertXcodeVersion (15, 0); +namespace MonoTouchFixtures.PassKit { -// for (int i = 0; i < 1000; i++){ -// PKPayLaterView.ValidateAmount (new NSDecimalNumber (i), "USD", (eligible) => { -// Assert.False (eligible); -// }); -// } -// } -// } -// } + [TestFixture] + [Preserve (AllMembers = true)] + public class PKPayLaterViewTest { -// #endif + [Test] + public void ValidateAmountTest_NSDecimal () + { + TestRuntime.AssertXcodeVersion (15, 0); + + var counter = 100; + var cnt = 0; + for (int i = 0; i < counter; i++) { + PKPayLaterView.ValidateAmount (new NSDecimalNumber (i), "USD", (eligible) => { + Interlocked.Increment (ref cnt); + }); + } + // The callback is rarely called, so just assert that we don't get more callbacks than + // actual validation requests. + Assert.That (cnt, Is.Not.LessThan (0).And.Not.GreaterThan (counter), $"NSDecimalNumber overload"); + } + + [Test] + public void ValidateAmountTest_Decimal () + { + TestRuntime.AssertXcodeVersion (15, 0); + + var counter = 100; + var cnt = 0; + for (int i = 0; i < counter; i++) { + PKPayLaterView.ValidateAmount (i, "USD", (eligible) => { + Interlocked.Increment (ref cnt); + }); + } + // The callback is rarely called, so just assert that we don't get more callbacks than + // actual validation requests. + Assert.That (cnt, Is.Not.LessThan (0).And.Not.GreaterThan (counter), $"decimal overload"); + } + } +} + +#endif diff --git a/tests/monotouch-test/Security/RecordTest.cs b/tests/monotouch-test/Security/RecordTest.cs index c356ccf2e17f..322914ed0626 100644 --- a/tests/monotouch-test/Security/RecordTest.cs +++ b/tests/monotouch-test/Security/RecordTest.cs @@ -315,16 +315,16 @@ public void DeskCase_83099_InmutableDictionary () var testUsername = "testusername"; //TEST 1: Save a keychain value - var test1 = SaveUserPassword (testUsername, "testValue1"); - Assert.IsTrue (test1, "Password could not be saved to keychain"); + var test1 = SaveUserPassword (testUsername, "testValue1", out var queryCode, out var addCode, out var updateCode); + Assert.IsTrue (test1, $"Password could not be saved to keychain. queryCode: {queryCode} addCode: {addCode} updateCode: {updateCode}"); //TEST 2: Get the saved keychain value var test2 = GetUserPassword (testUsername); Assert.IsTrue (StringUtil.StringsEqual (test2, "testValue1", false)); //TEST 3: Update the keychain value - var test3 = SaveUserPassword (testUsername, "testValue2"); - Assert.IsTrue (test3, "Password could not be saved to keychain"); + var test3 = SaveUserPassword (testUsername, "testValue2", out queryCode, out addCode, out updateCode); + Assert.IsTrue (test3, "Password could not be saved to keychain. queryCode: {queryCode} addCode: {addCode} updateCode: {updateCode}"); //TEST 4: Get the updated keychain value var test4 = GetUserPassword (testUsername); @@ -353,14 +353,15 @@ public static string GetUserPassword (string username) return password; } - public static bool SaveUserPassword (string username, string password) + public static bool SaveUserPassword (string username, string password, out SecStatusCode queryCode, out SecStatusCode addCode, out SecStatusCode updateCode) { + addCode = (SecStatusCode) (-1); // pick a value that doesn't already exist in SecStatusCode + updateCode = (SecStatusCode) (-1); // pick a value that doesn't already exist in SecStatusCode var success = false; var searchRecord = CreateSecRecord (SecKind.InternetPassword, server: "Test1", account: username.ToLower () ); - SecStatusCode queryCode; var record = SecKeyChain.QueryAsRecord (searchRecord, out queryCode); if (queryCode == SecStatusCode.ItemNotFound) { record = CreateSecRecord (SecKind.InternetPassword, @@ -368,12 +369,12 @@ record = CreateSecRecord (SecKind.InternetPassword, account: username.ToLower (), valueData: NSData.FromString (password) ); - var addCode = SecKeyChain.Add (record); + addCode = SecKeyChain.Add (record); success = (addCode == SecStatusCode.Success); } if (queryCode == SecStatusCode.Success && record is not null) { record.ValueData = NSData.FromString (password); - var updateCode = SecKeyChain.Update (searchRecord, record); + updateCode = SecKeyChain.Update (searchRecord, record); success = (updateCode == SecStatusCode.Success); } return success; diff --git a/tests/monotouch-test/UIKit/SegmentedControlTest.cs b/tests/monotouch-test/UIKit/SegmentedControlTest.cs index 37435e0c216c..a567efd3b0e1 100644 --- a/tests/monotouch-test/UIKit/SegmentedControlTest.cs +++ b/tests/monotouch-test/UIKit/SegmentedControlTest.cs @@ -7,6 +7,7 @@ using System.IO; using CoreGraphics; using Foundation; +using ObjCRuntime; using UIKit; using NUnit.Framework; @@ -107,6 +108,17 @@ public void CtorUIImage () Assert.That (sc.NumberOfSegments, Is.EqualTo ((nint) 1), "NumberOfSegments"); } } + + [Test] + public void TitleTextAttributes () + { + using var sc = new UISegmentedControl ("one", "two"); + sc.SetTitleTextAttributes (new UIStringAttributes () { ForegroundColor = UIColor.Gray }, UIControlState.Selected); + var attrib = sc.GetTitleTextAttributes (UIControlState.Selected); + Assert.AreEqual (UIColor.Gray, attrib?.ForegroundColor, "ForegroundColor"); + Assert.IsNotNull (attrib?.Dictionary, "Dictionary"); + Assert.AreNotEqual (NativeHandle.Zero, attrib.Dictionary.Handle, "Dictionary.Handle"); + } } } diff --git a/tests/monotouch-test/dotnet/shared.csproj b/tests/monotouch-test/dotnet/shared.csproj index 59339e82e4b7..19995733734e 100644 --- a/tests/monotouch-test/dotnet/shared.csproj +++ b/tests/monotouch-test/dotnet/shared.csproj @@ -261,9 +261,9 @@ - - + Condition="!Exists('$(TestLibrariesDirectory)/.libs/dotnet/macos/custom-type-assembly.dll')" > + + diff --git a/tests/mtouch/MonoNativeTests.cs b/tests/mtouch/MonoNativeTests.cs deleted file mode 100644 index f132c64667b3..000000000000 --- a/tests/mtouch/MonoNativeTests.cs +++ /dev/null @@ -1,271 +0,0 @@ -// -// MonoNativeTests.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; -using System.IO; -using System.Linq; -using NUnit.Framework; - -// using MTouchLinker = Xamarin.Tests.LinkerOption; -// using ExecutionHelper = Xamarin.Tests.ExecutionHelper; -// using MTouchRegistrar = Xamarin.Tests.RegistrarOption; - -namespace Xamarin { - using Tests; - using Utils; - - [TestFixture] - public class MonoNativeTests { - [Test] - public void TestDebugSymlink () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (); - mtouch.Debug = true; - mtouch.Linker = LinkerOption.DontLink; - mtouch.AssertExecute (MTouchAction.BuildSim, "build"); - - AssertSymlinked (mtouch.AppPath); - } - } - - [Test] - public void TestDebugLinkOut () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (); - mtouch.Debug = true; - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssertExecute (MTouchAction.BuildSim, "build"); - - AssertStaticLinked (mtouch); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_mono_native_initialize")); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_NetSecurityNative_ImportUserName")); - } - } - - [Test] - public void TestDeviceLinkOut () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (); - mtouch.Linker = LinkerOption.LinkSdk; - mtouch.AssertExecute (MTouchAction.BuildDev, "build"); - - AssertStaticLinked (mtouch); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_mono_native_initialize")); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_NetSecurityNative_ImportUserName")); - } - } - - [Test] - public void TestDebugLinkAll () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (code: MonoNativeInitialize); - mtouch.Debug = true; - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssertExecute (MTouchAction.BuildSim, "build"); - - AssertStaticLinked (mtouch); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Contain ("_mono_native_initialize")); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_NetSecurityNative_ImportUserName")); - } - } - - [Test] - public void TestDeviceLinkAll () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (code: MonoNativeInitialize); - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssertExecute (MTouchAction.BuildDev, "build"); - - AssertStaticLinked (mtouch); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Contain ("_mono_native_initialize")); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_NetSecurityNative_ImportUserName")); - } - } - - [Test] - [TestCase (Profile.iOS, "9.3", "libmono-native-compat.dylib", SdkVersions.MiniOS)] - [TestCase (Profile.iOS, "10.0", "libmono-native-unified.dylib", SdkVersions.MiniOS)] - [TestCase (Profile.tvOS, "9.0", "libmono-native-compat.dylib", SdkVersions.MinTVOS)] - [TestCase (Profile.tvOS, "10.0", "libmono-native-unified.dylib", SdkVersions.MinTVOS)] - [TestCase (Profile.watchOS, "2.0", "libmono-native-compat.dylib", SdkVersions.MinWatchOS)] - [TestCase (Profile.watchOS, "5.0", "libmono-native-unified.dylib", SdkVersions.MinWatchOS)] - public void TestDeviceDylib (Profile profile, string version, string mono_native_dylib, string min_version) - { - if (mono_native_dylib.Contains ("compat") && Version.Parse (min_version) > Version.Parse (version)) - Assert.Ignore ("No OS versions that require compat libmono-unified are supported anymore"); - if (Version.Parse (min_version) > Version.Parse (version)) - version = min_version; - - using (var mtouch = new MTouchTool ()) { - mtouch.Profile = profile; - if (profile == Profile.watchOS) { - mtouch.CreateTemporaryWatchKitExtension (code: MonoNativeWatchInitialize, extraCode: MonoNativeInitialize); - } else { - mtouch.CreateTemporaryApp (code: MonoNativeInitialize); - } - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssemblyBuildTargets.Add ("@all=dynamiclibrary"); - mtouch.TargetVer = version; - - mtouch.AssertExecute (MTouchAction.BuildDev, "build"); - - var files = Directory.EnumerateFiles (mtouch.AppPath, "libmono-native*", SearchOption.AllDirectories).Select (Path.GetFileName); - Assert.That (files.Count, Is.EqualTo (1), "One single libmono-native* library"); - Assert.That (files.First (), Is.EqualTo (mono_native_dylib)); - - var mono_native_path = Path.Combine (mtouch.AppPath, mono_native_dylib); - - var symbols = MTouch.GetNativeSymbols (mono_native_path); - var otool_dylib = ExecutionHelper.Execute ("otool", new [] { "-L", mono_native_path }, hide_output: true); - - Assert.That (symbols, Does.Contain ("_mono_native_initialize")); - Assert.That (otool_dylib, Does.Contain ($"@rpath/{mono_native_dylib}")); - Assert.That (otool_dylib.Replace (mono_native_path, ""), Does.Not.Contain ("/Users/")); - - if (profile == Profile.iOS) { - Assert.That (symbols, Does.Contain ("_NetSecurityNative_ImportUserName")); - Assert.That (otool_dylib, Does.Contain ("/System/Library/Frameworks/GSS.framework/GSS")); - } else { - Assert.That (symbols, Does.Not.Contain ("_NetSecurityNative_ImportUserName")); - Assert.That (otool_dylib, Does.Not.Contain ("/System/Library/Frameworks/GSS.framework/GSS")); - } - - var otool_exe = ExecutionHelper.Execute ("otool", new [] { "-L", mtouch.NativeExecutablePath }, hide_output: true); - Assert.That (otool_exe, Does.Not.Contain ("GSS")); - Assert.That (otool_exe, Does.Contain ($"@rpath/{mono_native_dylib}")); - } - } - - [Test] - public void TestDeviceFrameworkLinkOut () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (); - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssemblyBuildTargets.Add ("@all=framework"); - mtouch.TargetVer = SdkVersions.MiniOSVersion.Major >= 10 ? SdkVersions.MiniOS : "10.0"; - - mtouch.AssertExecute (MTouchAction.BuildDev, "build"); - - var files = Directory.EnumerateFiles (mtouch.AppPath, "libmono-native*", SearchOption.AllDirectories).Select (Path.GetFileName); - Assert.That (files.Count, Is.EqualTo (0), "No libmono-native* library"); - } - } - - [Test] - public void TestGss () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (code: MonoNativeGss); - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssertExecute (MTouchAction.BuildSim, "build"); - - AssertStaticLinked (mtouch); - var symbols = mtouch.NativeSymbolsInExecutable; - Assert.That (symbols, Does.Contain ("_mono_native_initialize")); - Assert.That (symbols, Does.Contain ("_NetSecurityNative_ImportUserName")); - - var otool_exe = ExecutionHelper.Execute ("otool", new [] { "-L", mtouch.NativeExecutablePath }, hide_output: true); - Assert.That (otool_exe, Does.Contain ("/System/Library/Frameworks/GSS.framework/GSS")); - } - } - - [Test] - public void TestGssTv () - { - using (var mtouch = new MTouchTool ()) { - mtouch.Profile = Profile.tvOS; - mtouch.CreateTemporaryApp (code: MonoNativeGss); - mtouch.Linker = LinkerOption.LinkAll; - - mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build"); - mtouch.AssertError (5214, "Native linking failed, undefined symbol: _NetSecurityNative_ImportUserName. This symbol was referenced by the managed member X.NetSecurityNative_ImportUserName. Please verify that all the necessary frameworks have been referenced and native libraries linked."); - } - } - - void AssertSymlinked (string path) - { - var files = Directory.EnumerateFiles (path, "libmono-native*", SearchOption.AllDirectories).Select (Path.GetFileName); - Assert.That (files.Count, Is.EqualTo (1), "One single libmono-native* library"); - Assert.That (files.First (), Is.EqualTo ("libmono-native.dylib"), "Found libmono-native.dylib"); - } - - void AssertStaticLinked (MTouchTool app) - { - var files = Directory.EnumerateFiles (app.AppPath, "libmono-native*", SearchOption.AllDirectories).Select (Path.GetFileName); - Assert.That (files.Count, Is.EqualTo (0), "No libmono-native* libraries"); - } - - string MonoNativeWatchInitialize => @" -using WatchKit; -public partial class NotificationController : WKUserNotificationInterfaceController -{ - protected NotificationController (System.IntPtr handle) : base (handle) { X.Main(); } -} -"; - - string MonoNativeInitialize => @" -class X { - [System.Runtime.InteropServices.DllImport (""System.Native"")] - extern static void mono_native_initialize (); - - public static void Main () - { - System.Console.WriteLine (typeof (ObjCRuntime.Runtime).ToString ()); - mono_native_initialize (); - } -} -"; - - string MonoNativeGss => @" -using System; - -class X { - [System.Runtime.InteropServices.DllImport (""System.Native"")] - extern static void mono_native_initialize (); - - [System.Runtime.InteropServices.DllImport (""System.Net.Security.Native"")] - extern static void NetSecurityNative_ImportUserName (IntPtr a, IntPtr b, int c, IntPtr d); - - static void Main () - { - // Reference Xamarin.iOS - var runtime = typeof (ObjCRuntime.Runtime).ToString (); - // Always false, but the linker does not know that, so the following code won't be linked out. - if (runtime.Equals (""XXX"")) { - mono_native_initialize (); - NetSecurityNative_ImportUserName (IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero); - } - } -} -"; - - } -} diff --git a/tests/mtouch/mtouchtests.csproj b/tests/mtouch/mtouchtests.csproj index feec07e1769c..c207827fbe0b 100644 --- a/tests/mtouch/mtouchtests.csproj +++ b/tests/mtouch/mtouchtests.csproj @@ -74,7 +74,6 @@ BundlerTool.cs - SdkVersions.cs diff --git a/tests/test-libraries/custom-type-assembly/Makefile b/tests/test-libraries/custom-type-assembly/Makefile index 29527c3b0295..31af087078fe 100644 --- a/tests/test-libraries/custom-type-assembly/Makefile +++ b/tests/test-libraries/custom-type-assembly/Makefile @@ -2,32 +2,19 @@ TOP=../../.. include $(TOP)/Make.config -.libs/macos/custom-type-assembly.dll: custom-type-assembly.cs Makefile | .libs/macos - $(Q_CSC) $(MAC_mobile_CSC) $< -out:$@ -r:$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/Xamarin.Mac/Xamarin.Mac.dll -target:library /nologo - .libs/dotnet/macos/custom-type-assembly.dll: bin/Debug/$(DOTNET_TFM)-macos/custom-type-assembly.dll | .libs/dotnet/macos $(Q) $(CP) $< $@ -.libs/macos .libs/dotnet/macos: +.libs/dotnet/macos: $(Q) mkdir -p $@ bin/Debug/$(DOTNET_TFM)-macos/custom-type-assembly.dll: custom-type-assembly.csproj custom-type-assembly.cs - $(Q) unset MSBUILD_EXE_PATH && $(DOTNET) build $< "/bl:$@.binlog" $(MSBUILD_VERBOSITY) + $(Q) unset MSBUILD_EXE_PATH && $(DOTNET) build $< "/bl:$@.binlog" $(DOTNET_BUILD_VERBOSITY) ifdef INCLUDE_MAC - -ifdef INCLUDE_XAMARIN_LEGACY -TARGETS += \ - .libs/macos/custom-type-assembly.dll \ - -endif - -ifdef ENABLE_DOTNET TARGETS += \ .libs/dotnet/macos/custom-type-assembly.dll \ -endif - endif # INCLUDE_MAC build-assembly: $(TARGETS) diff --git a/tests/xharness/Harness.cs b/tests/xharness/Harness.cs index 2d6f5b1bc2d0..7fb3f9118dc8 100644 --- a/tests/xharness/Harness.cs +++ b/tests/xharness/Harness.cs @@ -493,22 +493,6 @@ int AutoConfigureMac (bool generate_projects) }); } - var monoNativeInfo = new MonoNativeInfo (DevicePlatform.macOS, RootDirectory, Log); - var macTestProject = new MacTestProject (TestLabel.Mononative, monoNativeInfo.ProjectPath, targetFrameworkFlavor: MacFlavors.Modern | MacFlavors.Full) { - MonoNativeInfo = monoNativeInfo, - Name = monoNativeInfo.ProjectName, - Platform = "AnyCPU", - Ignore = !INCLUDE_XAMARIN_LEGACY, - - }; - MacTestProjects.Add (macTestProject); - - - // Generate test projects from templates (mono-native templates) - if (generate_projects) { - foreach (var mtp in MacTestProjects.Where (x => x.MonoNativeInfo is not null).Select (x => x.MonoNativeInfo)) - mtp.Convert (); - } // All test projects should be either Modern projects or NUnit/console executables at this point. // If we need to generate Full/System variations, we do that here. @@ -611,13 +595,6 @@ void AutoConfigureIOS () Configurations = new string [] { "Debug", "Release" }, }); - var monoNativeInfo = new MonoNativeInfo (DevicePlatform.iOS, RootDirectory, Log); - var iosTestProject = new iOSTestProject (TestLabel.Mononative, monoNativeInfo.ProjectPath) { - MonoNativeInfo = monoNativeInfo, - Name = monoNativeInfo.ProjectName, - }; - IOSTestProjects.Add (iosTestProject); - // add all the tests that are using the precompiled mono assemblies WatchOSContainerTemplate = Path.GetFullPath (Path.Combine (RootDirectory, "templates/WatchContainer")); WatchOSAppTemplate = Path.GetFullPath (Path.Combine (RootDirectory, "templates/WatchApp")); @@ -688,8 +665,6 @@ int Configure () // * dont link, link all, link sdk // * Each of these test projects can used to generate other platform variations (tvOS, watchOS, macOS full, etc), // if the the TestProject.GenerateVariations property is true. - // * For the mono-native template project, we generate a compat+unified version of the mono-native template project (in MonoNativeInfo.Convert). - // GenerateVariations is true for mono-native projects, which means we'll generate platform variations. int ConfigureIOS () { @@ -702,9 +677,6 @@ int ConfigureIOS () if (autoConf) AutoConfigureIOS (); - foreach (var monoNativeInfo in IOSTestProjects.Where (x => x.MonoNativeInfo is not null).Select (x => x.MonoNativeInfo)) - monoNativeInfo.Convert (); - foreach (var proj in IOSTestProjects.Where ((v) => v.GenerateVariations)) { var file = proj.Path; diff --git a/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs b/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs index ca268427dfb7..b0821bfb9aa2 100644 --- a/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs +++ b/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs @@ -30,8 +30,6 @@ public async Task> CreateAsync (Jenkins jenkins, IMlaunch } else { if (!project.SkipiOSVariation) ps.Add (new Tuple (project, TestPlatform.iOS_Unified, ignored)); - if (project.MonoNativeInfo is not null) - ps.Add (new Tuple (project, TestPlatform.iOS_TodayExtension64, ignored)); if (!project.SkiptvOSVariation) ps.Add (new Tuple (project.AsTvOSProject (), TestPlatform.tvOS, ignored)); if (!project.SkipwatchOSVariation) diff --git a/tests/xharness/Jenkins/TestData.cs b/tests/xharness/Jenkins/TestData.cs index 411f64cdac9f..423702dc0150 100644 --- a/tests/xharness/Jenkins/TestData.cs +++ b/tests/xharness/Jenkins/TestData.cs @@ -18,7 +18,6 @@ class TestData { public bool UseThumb; public bool UseLlvm; public bool? UseMonoRuntime; - public MonoNativeLinkMode MonoNativeLinkMode; public IEnumerable Candidates; public string XamMacArch; public string RuntimeIdentifier; diff --git a/tests/xharness/Jenkins/TestSelector.cs b/tests/xharness/Jenkins/TestSelector.cs index 3751141bc004..632734ef94cf 100644 --- a/tests/xharness/Jenkins/TestSelector.cs +++ b/tests/xharness/Jenkins/TestSelector.cs @@ -278,7 +278,6 @@ public void SelectTests (TestSelection selection) selection.SetEnabled (PlatformLabel.LegacyXamarin, false); selection.SetEnabled (PlatformLabel.watchOS, false); selection.SetEnabled (TestLabel.Mmp, false); - selection.SetEnabled (TestLabel.Mononative, false); selection.SetEnabled (TestLabel.Mtouch, false); selection.SetEnabled (TestLabel.Xammac, false); } diff --git a/tests/xharness/Jenkins/TestVariationsFactory.cs b/tests/xharness/Jenkins/TestVariationsFactory.cs index 15825b450eea..946116e9759e 100644 --- a/tests/xharness/Jenkins/TestVariationsFactory.cs +++ b/tests/xharness/Jenkins/TestVariationsFactory.cs @@ -68,22 +68,22 @@ IEnumerable GetTestData (RunTestTask test) /* we don't add --assembly-build-target=@all=staticobject because that's the default in all our test projects */ if (supports_debug && !test.TestProject.IsDotNetProject) { - yield return new TestData { Variation = "AssemblyBuildTarget: dylib (debug)", AppBundleExtraOptions = $"--assembly-build-target=@all=dynamiclibrary", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Dynamic, Ignored = ignore }; - yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (debug)", AppBundleExtraOptions = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, Ignored = ignore }; - yield return new TestData { Variation = "AssemblyBuildTarget: dylib (debug, profiling)", AppBundleExtraOptions = $"--assembly-build-target=@all=dynamiclibrary", Debug = true, Profiling = true, MonoNativeLinkMode = MonoNativeLinkMode.Dynamic, Ignored = ignore }; - yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (debug, profiling)", AppBundleExtraOptions = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject", Debug = true, Profiling = true, MonoNativeLinkMode = MonoNativeLinkMode.Static, Ignored = ignore }; + yield return new TestData { Variation = "AssemblyBuildTarget: dylib (debug)", AppBundleExtraOptions = $"--assembly-build-target=@all=dynamiclibrary", Debug = true, Profiling = false, Ignored = ignore }; + yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (debug)", AppBundleExtraOptions = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject", Debug = true, Profiling = false, Ignored = ignore }; + yield return new TestData { Variation = "AssemblyBuildTarget: dylib (debug, profiling)", AppBundleExtraOptions = $"--assembly-build-target=@all=dynamiclibrary", Debug = true, Profiling = true, Ignored = ignore }; + yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (debug, profiling)", AppBundleExtraOptions = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject", Debug = true, Profiling = true, Ignored = ignore }; } if (test.ProjectConfiguration.Contains ("Debug")) - yield return new TestData { Variation = "Release", Debug = false, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static }; + yield return new TestData { Variation = "Release", Debug = false, Profiling = false }; if (test.Platform == TestPlatform.iOS_Unified32 && !test.TestProject.IsDotNetProject) - yield return new TestData { Variation = "Release: UseThumb", Debug = false, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, UseThumb = true }; + yield return new TestData { Variation = "Release: UseThumb", Debug = false, Profiling = false, UseThumb = true }; // Disable this by default for tvOS/Release because the app ends up being too big (https://github.com/xamarin/maccore/issues/2282) var sdk_release_skip = test.Platform == TestPlatform.tvOS && test.TestName == "dont link"; sdk_release_skip = sdk_release_skip || test.TestProject.IsDotNetProject; if (!sdk_release_skip) - yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (release)", AppBundleExtraOptions = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject", Debug = false, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, }; + yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (release)", AppBundleExtraOptions = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject", Debug = false, Profiling = false, }; switch (test.TestName) { case "monotouch-test": @@ -94,7 +94,7 @@ IEnumerable GetTestData (RunTestTask test) yield return new TestData { Variation = "Release (all optimizations)", AppBundleExtraOptions = "--optimize:all", Registrar = "static", Debug = false, Profiling = false, Defines = "OPTIMIZEALL", Ignored = ignore }; if (supports_debug) { yield return new TestData { Variation = "Debug (all optimizations)", AppBundleExtraOptions = "--optimize:all", Registrar = "static", Debug = true, Profiling = false, Defines = "OPTIMIZEALL", Ignored = ignore }; - yield return new TestData { Variation = "Debug: SGenConc", AppBundleExtraOptions = "", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, EnableSGenConc = true, Ignored = ignore }; + yield return new TestData { Variation = "Debug: SGenConc", AppBundleExtraOptions = "", Debug = true, Profiling = false, EnableSGenConc = true, Ignored = ignore }; } if (supports_interpreter) { if (supports_debug) { @@ -113,7 +113,7 @@ IEnumerable GetTestData (RunTestTask test) break; case string name when name.StartsWith ("mscorlib", StringComparison.Ordinal): if (supports_debug) - yield return new TestData { Variation = "Debug: SGenConc", AppBundleExtraOptions = "", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, EnableSGenConc = true }; + yield return new TestData { Variation = "Debug: SGenConc", AppBundleExtraOptions = "", Debug = true, Profiling = false, EnableSGenConc = true }; if (supports_interpreter) { if (supports_debug) { yield return new TestData { Variation = "Debug (interpreter)", AppBundleExtraOptions = "--interpreter", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME", KnownFailure = new KnownIssue ("#1683", issueLink: "https://github.com/xamarin/maccore/issues/1683") }; @@ -282,12 +282,6 @@ public IEnumerable CreateTestVariations (IEnumerable tests, Func -// -// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; -using System.IO; -using System.Xml; - -using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; -using Microsoft.DotNet.XHarness.iOS.Shared.Hardware; - -namespace Xharness { - public enum MonoNativeLinkMode { - None, - Static, - Dynamic, - Symlink, - } - - public static class MonoNativeHelper { - public static void AddProjectDefines (XmlDocument project, MonoNativeLinkMode link) - { - switch (link) { - case MonoNativeLinkMode.Static: - project.AddTopLevelProperty ("MonoNativeMode", "MONO_NATIVE_STATIC"); - break; - case MonoNativeLinkMode.Dynamic: - project.AddTopLevelProperty ("MonoNativeMode", "MONO_NATIVE_DYNAMIC"); - break; - case MonoNativeLinkMode.Symlink: - project.AddTopLevelProperty ("MonoNativeMode", "MONO_NATIVE_SYMLINK"); - break; - default: - throw new Exception ($"Unknown MonoNativeLinkMode: {link}"); - } - } - - public static string GetMinimumOSVersion (DevicePlatform platform) - { - switch (platform) { - case DevicePlatform.iOS: - return Xamarin.SdkVersions.MiniOS; - case DevicePlatform.tvOS: - return Xamarin.SdkVersions.MinTVOS; - case DevicePlatform.watchOS: - return Xamarin.SdkVersions.LegacyMinWatchOS; - case DevicePlatform.macOS: - return Xamarin.SdkVersions.MinOSX; - default: - throw new Exception ($"Unknown DevicePlatform: {platform}"); - } - } - } - - public class MonoNativeInfo { - Action log; - public DevicePlatform DevicePlatform { get; set; } - string rootDirectory; - - public MonoNativeInfo (DevicePlatform platform, string rootDirectory, Action logAction = null) - { - DevicePlatform = platform; - this.log = logAction; - this.rootDirectory = rootDirectory ?? throw new ArgumentNullException (nameof (rootDirectory)); - } - - public string FlavorSuffix => "-unified"; - public string ProjectName => "mono-native" + FlavorSuffix; - public string ProjectPath => Path.Combine (rootDirectory, "mono-native", DevicePlatform.ToString (), FlavorSuffix.TrimStart ('-'), TemplateName + FlavorSuffix + ".csproj"); - string TemplateName => "mono-native"; - public string TemplatePath => Path.Combine (rootDirectory, "mono-native", DevicePlatform.ToString (), TemplateName + ".csproj.template"); - - public void Convert () - { - var inputProject = new XmlDocument (); - - var xml = File.ReadAllText (TemplatePath); - inputProject.LoadXmlWithoutNetworkAccess (xml); - inputProject.SetAssemblyName (inputProject.GetAssemblyName () + FlavorSuffix); - inputProject.AddAdditionalDefines ("MONO_NATIVE_UNIFIED"); - inputProject.ResolveAllPaths (TemplatePath); - - var template_info_plist = HarnessConfiguration.EvaluateRootTestsDirectory (inputProject.GetInfoPListInclude ().Replace ('\\', '/')); - var target_info_plist = Path.Combine (Path.GetDirectoryName (ProjectPath), "Info" + FlavorSuffix + ".plist"); - SetInfoPListMinimumOSVersion (template_info_plist, target_info_plist); - target_info_plist = HarnessConfiguration.InjectRootTestsDirectory (target_info_plist); - inputProject.FixInfoPListInclude (FlavorSuffix, newName: target_info_plist); - - inputProject.Save (ProjectPath, log); - } - - public XmlDocument SetInfoPListMinimumOSVersion (string template_plist, string target_plist) - { - var template_info_plist = template_plist; - var info_plist = new XmlDocument (); - info_plist.LoadWithoutNetworkAccess (template_info_plist); - SetInfoPListMinimumOSVersion (info_plist, MonoNativeHelper.GetMinimumOSVersion (DevicePlatform)); - info_plist.Save (target_plist, log); - return info_plist; - } - - public virtual void SetInfoPListMinimumOSVersion (XmlDocument info_plist, string version) - { - if (DevicePlatform == DevicePlatform.macOS) { - info_plist.SetMinimummacOSVersion (version); - } else { - info_plist.SetMinimumOSVersion (version); - } - } - } -} diff --git a/tests/xharness/Targets/TVOSTarget.cs b/tests/xharness/Targets/TVOSTarget.cs index c026021ad1d0..b3bf5c5de289 100644 --- a/tests/xharness/Targets/TVOSTarget.cs +++ b/tests/xharness/Targets/TVOSTarget.cs @@ -63,9 +63,7 @@ public override string DeviceArchitectures { protected override string GetMinimumOSVersion (string templateMinimumOSVersion) { - if (MonoNativeInfo is null) - return Xamarin.SdkVersions.MinTVOS; - return MonoNativeHelper.GetMinimumOSVersion (DevicePlatform.tvOS); + return Xamarin.SdkVersions.MinTVOS; } protected override int [] UIDeviceFamily { diff --git a/tests/xharness/Targets/Target.cs b/tests/xharness/Targets/Target.cs index 47b845f9857c..3d62d717fcc1 100644 --- a/tests/xharness/Targets/Target.cs +++ b/tests/xharness/Targets/Target.cs @@ -235,9 +235,6 @@ public void Execute () templateName = Path.GetFileNameWithoutExtension (templateName); templateName = Path.GetFileNameWithoutExtension (templateName); - if (templateName.Equals ("mono-native-mac", StringComparison.Ordinal)) - templateName = "mono-native"; - if (!ShouldSkipProjectGeneration) { inputProject = new XmlDocument (); inputProject.LoadWithoutNetworkAccess (TemplateProjectPath); diff --git a/tests/xharness/Targets/TodayExtensionTarget.cs b/tests/xharness/Targets/TodayExtensionTarget.cs index ae4e6867c7a5..262f053b466f 100644 --- a/tests/xharness/Targets/TodayExtensionTarget.cs +++ b/tests/xharness/Targets/TodayExtensionTarget.cs @@ -129,9 +129,7 @@ protected override void ExecuteInternal () protected override string GetMinimumOSVersion (string templateMinimumOSVersion) { - if (MonoNativeInfo is null) - return templateMinimumOSVersion; - return MonoNativeHelper.GetMinimumOSVersion (DevicePlatform.iOS); + return templateMinimumOSVersion; } public override IEnumerable GetRelatedProjects () diff --git a/tests/xharness/Targets/UnifiedTarget.cs b/tests/xharness/Targets/UnifiedTarget.cs index a782a2063f53..e5d6c138abda 100644 --- a/tests/xharness/Targets/UnifiedTarget.cs +++ b/tests/xharness/Targets/UnifiedTarget.cs @@ -63,9 +63,7 @@ public override string DeviceArchitectures { protected override string GetMinimumOSVersion (string templateMinimumOSVersion) { - if (MonoNativeInfo is null) - return templateMinimumOSVersion; - return MonoNativeHelper.GetMinimumOSVersion (DevicePlatform.iOS); + return templateMinimumOSVersion; } protected override int [] UIDeviceFamily { diff --git a/tests/xharness/Targets/WatchOSTarget.cs b/tests/xharness/Targets/WatchOSTarget.cs index 19d9df59a371..b1490c0df9da 100644 --- a/tests/xharness/Targets/WatchOSTarget.cs +++ b/tests/xharness/Targets/WatchOSTarget.cs @@ -217,9 +217,7 @@ protected override void ExecuteInternal () protected override string GetMinimumOSVersion (string templateMinimumOSVersion) { - if (MonoNativeInfo is null) - return templateMinimumOSVersion; - return MonoNativeHelper.GetMinimumOSVersion (DevicePlatform.watchOS); + return templateMinimumOSVersion; } public override string Suffix { diff --git a/tests/xharness/Targets/iOSTarget.cs b/tests/xharness/Targets/iOSTarget.cs index a06b3242996d..208c88a815d3 100644 --- a/tests/xharness/Targets/iOSTarget.cs +++ b/tests/xharness/Targets/iOSTarget.cs @@ -8,8 +8,6 @@ namespace Xharness.Targets { public abstract class iOSTarget : Target { public iOSTestProject TestProject; - public MonoNativeInfo MonoNativeInfo => TestProject.MonoNativeInfo; - protected override void PostProcessExecutableProject () { base.PostProcessExecutableProject (); diff --git a/tests/xharness/TestLabel.cs b/tests/xharness/TestLabel.cs index 61e73d0e976c..de55a4774f0f 100644 --- a/tests/xharness/TestLabel.cs +++ b/tests/xharness/TestLabel.cs @@ -55,8 +55,7 @@ public enum TestLabel : Int64 { MacBindingProject = 1 << 17, [Label ("mmp")] Mmp = 1 << 18, - [Label ("mononative")] - Mononative = 1 << 19, + // 1 << 19 is unused [Label ("monotouch")] Monotouch = 1 << 20, [Label ("msbuild")] diff --git a/tests/xharness/TestProject.cs b/tests/xharness/TestProject.cs index caceaa93c253..a645531746c4 100644 --- a/tests/xharness/TestProject.cs +++ b/tests/xharness/TestProject.cs @@ -37,9 +37,6 @@ public class TestProject { public IEnumerable? ProjectReferences; - // Optional - public MonoNativeInfo? MonoNativeInfo { get; set; } - public TestProject (TestLabel label, string path, bool isExecutableProject = true) { Label = label; diff --git a/tests/xharness/iOSTestProject.cs b/tests/xharness/iOSTestProject.cs index 85ad3e3526f7..6d8a9cf2c214 100644 --- a/tests/xharness/iOSTestProject.cs +++ b/tests/xharness/iOSTestProject.cs @@ -19,10 +19,7 @@ public iOSTestProject (TestLabel label, string path, bool isExecutableProject = public bool IsSupported (DevicePlatform devicePlatform, string productVersion) { - if (MonoNativeInfo is null) - return true; - var min_version = MonoNativeHelper.GetMinimumOSVersion (devicePlatform); - return Version.Parse (productVersion) >= Version.Parse (min_version); + return true; } public override TestProject Clone () diff --git a/tests/xharness/xharness.csproj b/tests/xharness/xharness.csproj index 27ef8e5ea82a..1fb000b19799 100644 --- a/tests/xharness/xharness.csproj +++ b/tests/xharness/xharness.csproj @@ -105,7 +105,6 @@ - diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore index 8e3b0a4f0476..2739f5efab4c 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore @@ -172,7 +172,6 @@ !missing-null-allowed! 'Foundation.NSDictionary UIKit.UIDocument::GetFileAttributesToWrite(Foundation.NSUrl,UIKit.UIDocumentSaveOperation,Foundation.NSError&)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSDictionary UIKit.UIMotionEffect::ComputeKeyPathsAndRelativeValues(UIKit.UIOffset)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSDictionary UIKit.UISearchBar::_GetScopeBarButtonTitleTextAttributes(UIKit.UIControlState)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSDictionary UIKit.UISegmentedControl::_GetTitleTextAttributes(UIKit.UIControlState)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSIndexPath UIKit.UICollectionViewFocusUpdateContext::get_NextFocusedIndexPath()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSIndexPath UIKit.UICollectionViewFocusUpdateContext::get_PreviouslyFocusedIndexPath()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSIndexPath UIKit.UITableViewDelegate::WillDeselectRow(UIKit.UITableView,Foundation.NSIndexPath)' is missing an [NullAllowed] on return type @@ -284,7 +283,6 @@ !missing-null-allowed! 'System.Void UIKit.UISearchBar::_SetScopeBarButtonTitle(Foundation.NSDictionary,UIKit.UIControlState)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISearchTextField::set_TokenBackgroundColor(UIKit.UIColor)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::.ctor(Foundation.NSArray)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void UIKit.UISegmentedControl::_SetTitleTextAttributes(Foundation.NSDictionary,UIKit.UIControlState)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::InsertSegment(System.String,System.IntPtr,System.Boolean)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::InsertSegment(UIKit.UIImage,System.IntPtr,System.Boolean)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::SetImage(UIKit.UIImage,System.IntPtr)' is missing an [NullAllowed] on parameter #0 diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-AppKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-AppKit.ignore index 6f9811c32731..d8151a01de31 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-AppKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-AppKit.ignore @@ -16,3 +16,6 @@ !missing-field! NSTypeIdentifierTransitInformationText not bound !missing-protocol! NSAnimatablePropertyContainer not bound !missing-selector! NSTouchBar::itemIdentifiers not bound + +# NSToolbarItemVisibilityPriority is a collection of constants we've bound as an enum. +!unknown-native-enum! NSToolbarItemVisibilityPriority bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-Vision.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-Vision.ignore index 4fca98ac62c5..022cd97667f7 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-Vision.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-Vision.ignore @@ -1,8 +1,3 @@ -# note: framework not available on watchOS - -## we do not expose internal framework versions -!missing-field! VNVisionVersionNumber not bound - ## called indirectly (there's a required native layer for them) !missing-pinvoke! VNImagePointForFaceLandmarkPoint is not bound !missing-pinvoke! VNNormalizedFaceBoundingBoxPointForLandmarkPoint is not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-PassKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/iOS-PassKit.ignore index a4d141ea5e35..1be18a80705a 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-PassKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-PassKit.ignore @@ -6,6 +6,3 @@ # needed to allow our WeakDelegate wrap !extra-null-allowed! 'System.Void PassKit.PKPayLaterView::set_WeakDelegate(Foundation.NSObject)' has a extraneous [NullAllowed] on parameter #0 - -# https://github.com/xamarin/xamarin-macios/issues/19271 -!missing-pinvoke! PKPayLaterValidateAmount is not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore index cc11a9f0362c..5539be8aa49c 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore @@ -176,7 +176,6 @@ !missing-null-allowed! 'Foundation.NSDictionary UIKit.UIDocument::GetFileAttributesToWrite(Foundation.NSUrl,UIKit.UIDocumentSaveOperation,Foundation.NSError&)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSDictionary UIKit.UIMotionEffect::ComputeKeyPathsAndRelativeValues(UIKit.UIOffset)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSDictionary UIKit.UISearchBar::_GetScopeBarButtonTitleTextAttributes(UIKit.UIControlState)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSDictionary UIKit.UISegmentedControl::_GetTitleTextAttributes(UIKit.UIControlState)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSIndexPath UIKit.UICollectionViewFocusUpdateContext::get_NextFocusedIndexPath()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSIndexPath UIKit.UICollectionViewFocusUpdateContext::get_PreviouslyFocusedIndexPath()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSIndexPath UIKit.UITableViewDelegate::WillDeselectRow(UIKit.UITableView,Foundation.NSIndexPath)' is missing an [NullAllowed] on return type @@ -288,7 +287,6 @@ !missing-null-allowed! 'System.Void UIKit.UISearchBar::_SetScopeBarButtonTitle(Foundation.NSDictionary,UIKit.UIControlState)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISearchTextField::set_TokenBackgroundColor(UIKit.UIColor)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::.ctor(Foundation.NSArray)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void UIKit.UISegmentedControl::_SetTitleTextAttributes(Foundation.NSDictionary,UIKit.UIControlState)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::InsertSegment(System.String,System.IntPtr,System.Boolean)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::InsertSegment(UIKit.UIImage,System.IntPtr,System.Boolean)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::SetImage(UIKit.UIImage,System.IntPtr)' is missing an [NullAllowed] on parameter #0 diff --git a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-UIKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-UIKit.ignore index ddb894e0504e..dfbf47f14611 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-UIKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-UIKit.ignore @@ -196,7 +196,6 @@ !missing-null-allowed! 'Foundation.NSDictionary UIKit.UICollectionViewLayoutInvalidationContext::get_InvalidatedSupplementaryIndexPaths()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSDictionary UIKit.UIMotionEffect::ComputeKeyPathsAndRelativeValues(UIKit.UIOffset)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSDictionary UIKit.UISearchBar::_GetScopeBarButtonTitleTextAttributes(UIKit.UIControlState)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSDictionary UIKit.UISegmentedControl::_GetTitleTextAttributes(UIKit.UIControlState)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSIndexPath UIKit.UICollectionViewFocusUpdateContext::get_NextFocusedIndexPath()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSIndexPath UIKit.UICollectionViewFocusUpdateContext::get_PreviouslyFocusedIndexPath()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSIndexPath UIKit.UITableViewDelegate::WillDeselectRow(UIKit.UITableView,Foundation.NSIndexPath)' is missing an [NullAllowed] on return type @@ -265,7 +264,6 @@ !missing-null-allowed! 'System.Void UIKit.UIScrollViewDelegate::ZoomingStarted(UIKit.UIScrollView,UIKit.UIView)' is missing an [NullAllowed] on parameter #1 !missing-null-allowed! 'System.Void UIKit.UISearchBar::_SetScopeBarButtonTitle(Foundation.NSDictionary,UIKit.UIControlState)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::.ctor(Foundation.NSArray)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.Void UIKit.UISegmentedControl::_SetTitleTextAttributes(Foundation.NSDictionary,UIKit.UIControlState)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::InsertSegment(System.String,System.IntPtr,System.Boolean)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::InsertSegment(UIKit.UIImage,System.IntPtr,System.Boolean)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.Void UIKit.UISegmentedControl::SetImage(UIKit.UIImage,System.IntPtr)' is missing an [NullAllowed] on parameter #0 diff --git a/tools/devops/Makefile b/tools/devops/Makefile index 74771d5c78d6..873bc40bfc4b 100644 --- a/tools/devops/Makefile +++ b/tools/devops/Makefile @@ -1,44 +1,13 @@ TOP=../.. include $(TOP)/Make.config -device-tests-provisioning.csx: device-tests-provisioning.csx.in Makefile $(TOP)/Make.config - $(Q_GEN) sed \ - -e 's#@XCODE_XIP_NAME@#$(notdir $(XCODE_URL))#g' \ - -e 's#@MONO_PACKAGE@#$(MIN_MONO_URL)#g' \ - -e 's#@MIN_SHARPIE_URL@#$(MIN_SHARPIE_URL)#g' \ - -e 's#@INCLUDE_MAC@#$(INCLUDE_MAC)#g' \ - -e 's#@INCLUDE_IOS@#$(INCLUDE_IOS)#g' \ - -e 's#@INCLUDE_TVOS@#$(INCLUDE_TVOS)#g' \ - -e 's#@INCLUDE_WATCH@#$(INCLUDE_WATCH)#g' \ - $< > $@; - @echo "Generated $@:" - @cat $@ - -build-provisioning.csx: build-provisioning.csx.in Makefile $(TOP)/Make.config +provision-shared.csx: provision-shared.in.csx Makefile $(TOP)/Make.config $(Q_GEN) sed \ -e 's#@XCODE_XIP_NAME@#$(notdir $(XCODE_URL))#g' \ + -e 's#@XCODE_ROOT_PATH@#$(XCODE_DEVELOPER_ROOT)#g' \ -e 's#@MONO_PACKAGE@#$(MIN_MONO_URL)#g' \ -e 's#@MIN_SHARPIE_URL@#$(MIN_SHARPIE_URL)#g' \ - $< > $@; - @echo "Generated $@:" - @cat $@ - -mac-tests-provisioning.csx: mac-tests-provisioning.csx.in Makefile $(TOP)/Make.config - $(Q_GEN) sed \ - -e 's#@MONO_PACKAGE@#$(MIN_MONO_URL)#g' \ - -e 's#@INCLUDE_MAC@#$(INCLUDE_MAC)#g' \ - -e 's#@INCLUDE_IOS@#$(INCLUDE_IOS)#g' \ - $< > $@; - @echo "Generated $@:" - @cat $@ - -provision-xcode.csx: provision-xcode.csx.in Makefile $(TOP)/Make.config - $(Q_GEN) sed \ - -e 's#@XCODE_XIP_NAME@#$(notdir $(XCODE_URL))#g' \ - -e 's#@XCODE_ROOT_PATH@#$(XCODE_DEVELOPER_ROOT)#g' \ - $< > $@; - @echo "Generated $@:" - @cat $@ + $< > $@ LocProject.json: LocProject.json.in Makefile $(TOP)/Make.config $(Q_GEN) sed \ @@ -65,4 +34,4 @@ print-variable: print-variable-value-to-file: @echo $($(VARIABLE)) > "$(FILE)" -provisioning: build-provisioning.csx device-tests-provisioning.csx provision-xcode.csx +provisioning: provision-shared.csx diff --git a/tools/devops/automation/run-post-ci-build-macos-tests.yml b/tools/devops/automation/run-post-ci-build-macos-tests.yml index bbdb367de5d7..da312f9e6997 100644 --- a/tools/devops/automation/run-post-ci-build-macos-tests.yml +++ b/tools/devops/automation/run-post-ci-build-macos-tests.yml @@ -9,7 +9,7 @@ pr: none resources: pipelines: - pipeline: macios - source: xamarin-macios-ci + source: \Xamarin\Mac-iOS\ci pipelines\xamarin-macios-ci trigger: stages: - build_macos_tests diff --git a/tools/devops/automation/run-post-ci-build-tests.yml b/tools/devops/automation/run-post-ci-build-tests.yml index 5ffbfa0917f6..af8677d8b4e6 100644 --- a/tools/devops/automation/run-post-ci-build-tests.yml +++ b/tools/devops/automation/run-post-ci-build-tests.yml @@ -4,12 +4,11 @@ trigger: none pr: none - # we cannot use a template in a pipeline context resources: pipelines: - pipeline: macios - source: xamarin-macios-ci + source: \Xamarin\Mac-iOS\ci pipelines\xamarin-macios-ci trigger: stages: - build_packages diff --git a/tools/devops/automation/run-post-pr-build-macos-tests.yml b/tools/devops/automation/run-post-pr-build-macos-tests.yml index e324fe5d8b3e..fdda5ca9e088 100644 --- a/tools/devops/automation/run-post-pr-build-macos-tests.yml +++ b/tools/devops/automation/run-post-pr-build-macos-tests.yml @@ -8,7 +8,7 @@ pr: none resources: pipelines: - pipeline: macios - source: xamarin-macios-pr + source: \Xamarin\Mac-iOS\pr pipelines\xamarin-macios-pr trigger: stages: - build_macos_tests diff --git a/tools/devops/automation/run-post-pr-build-tests.yml b/tools/devops/automation/run-post-pr-build-tests.yml index 45a676699994..16bdd59d45bd 100644 --- a/tools/devops/automation/run-post-pr-build-tests.yml +++ b/tools/devops/automation/run-post-pr-build-tests.yml @@ -8,7 +8,7 @@ pr: none resources: pipelines: - pipeline: macios - source: xamarin-macios-pr + source: \Xamarin\Mac-iOS\pr pipelines\xamarin-macios-pr trigger: stages: - build_packages diff --git a/tools/devops/automation/scripts/GitHub.psm1 b/tools/devops/automation/scripts/GitHub.psm1 index db3636044d8c..69774dc33b32 100644 --- a/tools/devops/automation/scripts/GitHub.psm1 +++ b/tools/devops/automation/scripts/GitHub.psm1 @@ -294,7 +294,8 @@ class GitHubComments { } [void] WriteCommentFooter( - [object] $stringBuilder + [object] $stringBuilder, + [string] $commentId ) { $targetUrl = Get-TargetUrl $stringBuilder.AppendLine("[Pipeline]($targetUrl) on Agent $Env:TESTS_BOT") # Env:TESTS_BOT is added by the pipeline as a variable coming from the execute tests job @@ -308,12 +309,20 @@ class GitHubComments { $hashUrl= "https://github.com/$($this.Org)/$($this.Repo)/commit/$($this.Hash)" $hashSource = " [CI build]" } - $ciComment = "[comment]: <> (This is a comment added by Azure DevOps)" + $ciComment = $this.GetCommentIdentifier($commentId) $stringBuilder.AppendLine("Hash: [$($this.Hash)]($hashUrl) $hashSource") $stringBuilder.AppendLine("") $stringBuilder.AppendLine($ciComment) } + [string] GetCommentIdentifier([string] $commentId) + { + $sanitizedId = $commentId + $sanitizedId = $sanitizedId.Replace("(","_").Replace(")","_").Replace("[","_").Replace("]","_") + $sanitizedId = $sanitizedId.Replace("{","_").Replace("}","_").Replace("<","_").Replace(">","_") + return "[comment]: <> (This is a comment added by Azure DevOps, id: $sanitizedId)" + } + [string] GetCommentUrl() { # if the build was due to PR, we want to write the comment in the PR rather than in the commit if ([GitHubComments]::IsPR()) { @@ -360,11 +369,46 @@ class GitHubComments { return $request } + [void] HideComments( + [string] $commentId + ) { + if (!$commentId) { + Write-Host "Not hiding comments, because no comment id provided" + return + } + + if (![GitHubComments]::IsPR()) { + Write-Host "Not hiding comments, because we're not in a pull request" + return + } + + $prId = "$Env:BUILD_SOURCEBRANCH".Replace("refs/pull/", "").Replace("/merge", "") + $prComments = $this.GetCommentsForPR($prId) + + $botComments = [System.Collections.ArrayList]@() + $commentToHide = $this.GetCommentIdentifier($commentId) + + foreach ($c in $prComments) { + if ($c.Author -eq "vs-mobiletools-engineering-service2") { + if ($c.Body.Contains($CommentToHide)) { + $botComments.Add($c) + } + } + } + + Write-Host "Hiding $($botComments.Count) comments for PR #$prId with comment id '$commentId'" + + $this.MinimizeComments($botComments) + } + [object] NewCommentFromObject( [string] $commentTitle, [string] $commentEmoji, - [object] $commentObject + [object] $commentObject, + [string] $commentId ) { + $this.HideComments($commentId) + # build the message, which will be sent to github, users can use markdown $msg = [System.Text.StringBuilder]::new() @@ -376,7 +420,7 @@ class GitHubComments { $msg.AppendLine() # footer - $this.WriteCommentFooter($msg) + $this.WriteCommentFooter($msg, $commentId) return $this.NewComment($msg) } @@ -384,8 +428,11 @@ class GitHubComments { [object] NewCommentFromFile( [string] $commentTitle, [string] $commentEmoji, - [string] $filePath + [string] $filePath, + [string] $commentId ) { + $this.HideComments($commentId) + # build the message, which will be sent to github, users can use markdown $msg = [System.Text.StringBuilder]::new() @@ -404,7 +451,7 @@ class GitHubComments { $msg.AppendLine() # footer - $this.WriteCommentFooter($msg) + $this.WriteCommentFooter($msg, $commentId) return $this.NewComment($msg) } @@ -412,8 +459,11 @@ class GitHubComments { [object] NewCommentFromMessage( [string] $commentTitle, [string] $commentEmoji, - [string] $content + [string] $content, + [string] $commentId ) { + $this.HideComments($commentId) + $msg = [System.Text.StringBuilder]::new() # header @@ -424,7 +474,7 @@ class GitHubComments { $msg.AppendLine() # footer - $this.WriteCommentFooter($msg) + $this.WriteCommentFooter($msg, $commentId) return $this.NewComment($msg) } diff --git a/tools/devops/automation/scripts/clean_past_comments.ps1 b/tools/devops/automation/scripts/clean_past_comments.ps1 deleted file mode 100644 index c24e1be430ce..000000000000 --- a/tools/devops/automation/scripts/clean_past_comments.ps1 +++ /dev/null @@ -1,36 +0,0 @@ -param -( - - [Parameter(Mandatory)] - [String] - $GithubToken, - - [Parameter(Mandatory)] - [String] - $RepositoryUri, - - [Parameter(Mandatory)] - [String] - $SourceBranch, - - [Parameter(Mandatory)] - [String] - $CommentToHide -) - -Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY/xamarin-macios/tools/devops/automation/scripts/MaciosCI.psd1 - -$comments = New-GitHubCommentsObjectFromUrl -Url "$RepositoryUri" -Token $GithubToken - -$prId = "$SourceBranch".Replace("refs/pull/", "").Replace("/merge", "") -$prComments = $comments.GetCommentsForPR($prId) - -$botComments = [System.Collections.ArrayList]@() -foreach ($c in $prComments) { - if ($c.Author -eq "vs-mobiletools-engineering-service2") { - if ($c.Body.Contains($CommentToHide)) { - $botComments.Add($c) - } - } -} -$comments.MinimizeComments($botComments) diff --git a/tools/devops/automation/scripts/show_env.ps1 b/tools/devops/automation/scripts/show_env.ps1 index 2a265dd21563..7852d1ad7c7a 100644 --- a/tools/devops/automation/scripts/show_env.ps1 +++ b/tools/devops/automation/scripts/show_env.ps1 @@ -15,6 +15,20 @@ gci env: | format-table -autosize | Out-String -Width 8192 gci env: | format-table -autosize -wrap if ($IsMacOS) { + Write-Host "" + Write-Host "## System profile" + Write-Host "" system_profiler SPSoftwareDataType SPHardwareDataType SPDeveloperToolsDataType + + Write-Host "" + Write-Host "## Network configuration" + Write-Host "" + ifconfig | grep 'inet ' + + + Write-Host "" + Write-Host "## Top processes" + Write-Host "" + top -l 1 -o TIME } diff --git a/tools/devops/automation/scripts/undo_github_merge.ps1 b/tools/devops/automation/scripts/undo_github_merge.ps1 index 32befd505352..af8e54f627a9 100644 --- a/tools/devops/automation/scripts/undo_github_merge.ps1 +++ b/tools/devops/automation/scripts/undo_github_merge.ps1 @@ -11,8 +11,11 @@ param if($IsPr.ToLower() -eq "true") { Write-Host "Working on a PR, Undoing the github merge with main." - git config remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*' - git fetch origin + $refspec="+refs/pull/$Env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/*:refs/remotes/origin/pull/$Env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/*" + + Write-Host "Refspec: $refspec" + + git fetch origin "$refspec" $branch="$SourceBranch".Replace("merge", "head") $branch=$branch.Replace("refs", "origin") diff --git a/tools/devops/automation/templates/api-diff-stage.yml b/tools/devops/automation/templates/api-diff-stage.yml index 081a1f58e172..3fb0a7a00cb9 100644 --- a/tools/devops/automation/templates/api-diff-stage.yml +++ b/tools/devops/automation/templates/api-diff-stage.yml @@ -33,18 +33,6 @@ parameters: stages: -- ${{ if parameters.isPR }}: - - stage: clean - displayName: 'Clean up' - dependsOn: [] - jobs: - - job: - displayName: 'Clean comments' - pool: - vmImage: windows-latest - steps: - - template: ./common/clean.yml - - stage: configure_build displayName: 'Configure' jobs: diff --git a/tools/devops/automation/templates/build/api-diff-process-results.yml b/tools/devops/automation/templates/build/api-diff-process-results.yml index a73bcb9e572f..c8b3bf3cc8bb 100644 --- a/tools/devops/automation/templates/build/api-diff-process-results.yml +++ b/tools/devops/automation/templates/build/api-diff-process-results.yml @@ -84,7 +84,7 @@ steps: $converted = $inputContents + "`n`nUnable to convert markdown: $_`n`n" } $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH - $result = $githubComments.NewCommentFromMessage("", "", $converted) + $result = $githubComments.NewCommentFromMessage("", "", $converted, "api diff") displayName: 'Publish GitHub comment for change detection' timeoutInMinutes: 10 continueOnError: true # don't let any failures here stop us diff --git a/tools/devops/automation/templates/build/build.yml b/tools/devops/automation/templates/build/build.yml index 7838afd4894c..a2648822460e 100644 --- a/tools/devops/automation/templates/build/build.yml +++ b/tools/devops/automation/templates/build/build.yml @@ -64,18 +64,8 @@ steps: MacDeveloper: $(mac-developer) HostedMacKeychainPassword: ${{ parameters.keyringPass }} - - task: xamops.azdevex.provisionator-task.provisionator@2 - displayName: 'Provision Brew components' - inputs: - provisioning_script: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/provision-brew-packages.csx - provisioning_extra_args: '-vvvv' - github_token: ${{ parameters.gitHubToken }} - timeoutInMinutes: 30 - enabled: true - continueOnError: true # brew installation can be temperamental, and things usually work even if the installation fail. - - bash: | - make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops build-provisioning.csx + make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops provisioning displayName: 'Generate provisionator files.' - task: xamops.azdevex.provisionator-task.provisionator@2 @@ -205,7 +195,7 @@ steps: - pwsh: | Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1 $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) -Hash $Env:COMMENT_HASH - $githubComments.NewCommentFromMessage("Build failed", ":fire:", "Build failed for the job '$(System.JobDisplayName)'") + $githubComments.NewCommentFromMessage("Build failed", ":fire:", "Build failed for the job '$(System.JobDisplayName)'", "build") condition: failed() displayName: 'Report build failure' env: diff --git a/tools/devops/automation/templates/common/clean.yml b/tools/devops/automation/templates/common/clean.yml deleted file mode 100644 index ea5849595778..000000000000 --- a/tools/devops/automation/templates/common/clean.yml +++ /dev/null @@ -1,36 +0,0 @@ -# Perform gihub cleaning steps - -parameters: -- name: commentToHide - type: string - default: '[comment]: <> (This is a comment added by Azure DevOps)' - -- name: checkoutCode - type: boolean - default: true - -- name: repositoryAlias - type: string - default: self - -- name: commit - type: string - default: HEAD - -steps: - -- ${{ if parameters.checkoutCode }}: - - template: checkout.yml - parameters: - isPR: false # always use the latests version of the script - repositoryAlias: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} - -- pwsh: >- - ./clean_past_comments.ps1 - -GithubToken "$(GitHub.Token)" - -RepositoryUri "$(Build.Repository.Uri)" - -SourceBranch "$(Build.SourceBranch)" - -CommentToHide "${{ parameters.commentToHide }}" - displayName: Clear past comments - workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts diff --git a/tools/devops/automation/templates/mac/build.yml b/tools/devops/automation/templates/mac/build.yml index 00e08489a799..504c68d79372 100644 --- a/tools/devops/automation/templates/mac/build.yml +++ b/tools/devops/automation/templates/mac/build.yml @@ -213,10 +213,10 @@ steps: $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) -Hash $Env:COMMENT_HASH if (Test-Path -Path "$Env:GITHUB_FAILURE_COMMENT_FILE" -PathType Leaf) { - $githubComments.NewCommentFromFile("Tests on macOS ${{ parameters.statusContext }} failed", ":x:", "$Env:GITHUB_FAILURE_COMMENT_FILE") + $githubComments.NewCommentFromFile("Tests on macOS ${{ parameters.statusContext }} failed", ":x:", "$Env:GITHUB_FAILURE_COMMENT_FILE", "macOS ${{ parameters.statusContext }}") } else { $message = ":white_check_mark: **All** tests on macOS ${{ parameters.statusContext }} passed." - $githubComments.NewCommentFromMessage("Tests on macOS ${{ parameters.statusContext }} passed", ":computer:", $message) + $githubComments.NewCommentFromMessage("Tests on macOS ${{ parameters.statusContext }} passed", ":computer:", $message, "macOS ${{ parameters.statusContext }}") } displayName: 'Report results to GitHub' timeoutInMinutes: 5 diff --git a/tools/devops/automation/templates/main-stage.yml b/tools/devops/automation/templates/main-stage.yml index 47009cd3be4d..fe218dcc51e9 100644 --- a/tools/devops/automation/templates/main-stage.yml +++ b/tools/devops/automation/templates/main-stage.yml @@ -202,21 +202,6 @@ stages: commit: ${{ parameters.commit }} stageDisplayNamePrefix: ${{ parameters.stageDisplayNamePrefix }} - - ${{ if parameters.isPR }}: - - stage: clean - displayName: '${{ parameters.stageDisplayNamePrefix }}Clean up' - dependsOn: [] - jobs: - - job: - displayName: 'Clean comments' - pool: - name: AzurePipelines-EO - demands: - - ImageOverride -equals 1ESPT-Windows2022 - - steps: - - template: ./common/clean.yml - - stage: configure_build displayName: '${{ parameters.stageDisplayNamePrefix }}Configure' dependsOn: ${{ parameters.dependsOn }} diff --git a/tools/devops/automation/templates/sign-and-notarized/artifact-github-comment.yml b/tools/devops/automation/templates/sign-and-notarized/artifact-github-comment.yml index ca16f53215e2..75a7a6ae8731 100644 --- a/tools/devops/automation/templates/sign-and-notarized/artifact-github-comment.yml +++ b/tools/devops/automation/templates/sign-and-notarized/artifact-github-comment.yml @@ -29,7 +29,7 @@ steps: Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1 $artifact = New-ArtifactsFromJsonFile -Path "$Env:ARTIFACTS_JSON_PATH" $gihubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH - $result = $gihubComments.NewCommentFromObject("Artifacts", ":books:", $artifact) + $result = $gihubComments.NewCommentFromObject("Artifacts", ":books:", $artifact, "artifacts") Write-Host $result env: GITHUB_TOKEN: $(GitHub.Token) diff --git a/tools/devops/automation/templates/tests-stage.yml b/tools/devops/automation/templates/tests-stage.yml index e54a23ee9cd7..8916e575cf35 100644 --- a/tools/devops/automation/templates/tests-stage.yml +++ b/tools/devops/automation/templates/tests-stage.yml @@ -163,18 +163,6 @@ parameters: stages: -- ${{ if parameters.isPR }}: - - stage: clean - displayName: '${{ parameters.stageDisplayNamePrefix }}Clean up' - dependsOn: [] - jobs: - - job: - displayName: 'Clean comments' - pool: - vmImage: windows-latest - steps: - - template: ./common/clean.yml - - stage: configure_build displayName: '${{ parameters.stageDisplayNamePrefix }}Configure' dependsOn: ${{ parameters.dependsOn }} diff --git a/tools/devops/automation/templates/tests/build.yml b/tools/devops/automation/templates/tests/build.yml index dd8b8158bf5f..e8b12d92a345 100644 --- a/tools/devops/automation/templates/tests/build.yml +++ b/tools/devops/automation/templates/tests/build.yml @@ -220,7 +220,7 @@ steps: timeoutInMinutes: 5 - bash: | - make -C $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/ device-tests-provisioning.csx + make -C $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/ provisioning displayName: 'Generate Provisionator csx file' # Executed ONLY if we want to clear the provisionator cache. @@ -234,19 +234,7 @@ steps: - task: xamops.azdevex.provisionator-task.provisionator@2 displayName: 'Provision dependencies' inputs: - provisioning_script: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/device-tests-provisioning.csx - provisioning_extra_args: '-vvvv' - github_token: ${{ parameters.gitHubToken }} - timeoutInMinutes: 250 - -- bash: | - make -C $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/ mac-tests-provisioning.csx - displayName: 'Generate Provisionator csx file for macOS' - -- task: xamops.azdevex.provisionator-task.provisionator@2 - displayName: 'Provision Xamarin.Mac' - inputs: - provisioning_script: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/mac-tests-provisioning.csx + provisioning_script: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/build-provisioning.csx provisioning_extra_args: '-vvvv' github_token: ${{ parameters.gitHubToken }} timeoutInMinutes: 250 diff --git a/tools/devops/automation/templates/tests/publish-html.yml b/tools/devops/automation/templates/tests/publish-html.yml index 7b0926fad01b..79d44e48d23f 100644 --- a/tools/devops/automation/templates/tests/publish-html.yml +++ b/tools/devops/automation/templates/tests/publish-html.yml @@ -49,12 +49,6 @@ steps: - template: download-artifacts.yml -- ${{ if parameters.isPR }}: - - template: ../common/clean.yml - parameters: - commentToHide: '[comment]: <> (This is a test result report added by Azure DevOps)' - checkoutCode: false # we already execute the 'clean.yml' template elsewhere in this job, and running 'checkout' again is useless (it also leads to duplicate step names which Azure DevOps doesn't like). - - pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 displayName: 'Show Environment' @@ -83,7 +77,7 @@ steps: } $gihubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH -Debug - $result = $gihubComments.NewCommentFromObject("Test results", $emoji, $parallelResults) + $result = $gihubComments.NewCommentFromObject("Test results", $emoji, $parallelResults, "test results") } catch { Write-Host "##vso[task.complete result=Failed;]Failed to compute test summaries: $_" New-GitHubComment -Header "Failed to compute test summaries on $Env:CONTEXT" -Emoji ":fire:" -Description "Failed to compute test summaries: $_." diff --git a/tools/devops/automation/templates/tests/publish-results.yml b/tools/devops/automation/templates/tests/publish-results.yml index 02729046d4a2..a02fa11d5911 100644 --- a/tools/devops/automation/templates/tests/publish-results.yml +++ b/tools/devops/automation/templates/tests/publish-results.yml @@ -119,7 +119,7 @@ stages: $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH -Debug $sb = [System.Text.StringBuilder]::new() $sb.AppendLine("All tests have been skipped because the label 'skip-all-tests' was set.") - $result = $githubComments.NewCommentFromMessage("Test results", ":seedling:", $sb.ToString()) + $result = $githubComments.NewCommentFromMessage("Test results", ":seedling:", $sb.ToString(), "test results") displayName: 'Set comment' env: CONTEXT: ${{ parameters.statusContext }} diff --git a/tools/devops/automation/templates/windows/build.yml b/tools/devops/automation/templates/windows/build.yml index 6f83e39da959..c8c39389992f 100644 --- a/tools/devops/automation/templates/windows/build.yml +++ b/tools/devops/automation/templates/windows/build.yml @@ -342,13 +342,13 @@ steps: $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) -Hash $Env:COMMENT_HASH if (Test-Path -Path "$Env:GITHUB_FAILURE_COMMENT_FILE" -PathType Leaf) { - $githubComments.NewCommentFromFile("${{ parameters.statusContext }} failed", ":x:", "$Env:GITHUB_FAILURE_COMMENT_FILE") + $githubComments.NewCommentFromFile("${{ parameters.statusContext }} failed", ":x:", "$Env:GITHUB_FAILURE_COMMENT_FILE", "windows tests") } elseif ("$($Env:AGENT_JOBSTATUS)" -ne "Succeeded") { $message = ":x: $($Env:AGENT_JOBSTATUS) :x:" - $githubComments.NewCommentFromMessage("${{ parameters.statusContext }} failed", ":x:", $message) + $githubComments.NewCommentFromMessage("${{ parameters.statusContext }} failed", ":x:", $message, "windows tests") } else { $message = ":white_check_mark: **All** ${{ parameters.statusContext }} passed." - $githubComments.NewCommentFromMessage("${{ parameters.statusContext }} passed", ":computer:", $message) + $githubComments.NewCommentFromMessage("${{ parameters.statusContext }} passed", ":computer:", $message, "windows tests") } displayName: 'Report results to GitHub' timeoutInMinutes: 5 diff --git a/tools/devops/automation/templates/windows/reserve-mac.yml b/tools/devops/automation/templates/windows/reserve-mac.yml index afbd6e7dc216..9c8710d9b619 100644 --- a/tools/devops/automation/templates/windows/reserve-mac.yml +++ b/tools/devops/automation/templates/windows/reserve-mac.yml @@ -85,7 +85,7 @@ steps: $vsts.Agents.SetEnabled($pool, $agent, $False) displayName: "Disable macOS bot from pool" -- bash: make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops provision-xcode.csx +- bash: make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops provisioning displayName: 'Generate Xcode provisioning csx file' - task: xamops.azdevex.provisionator-task.provisionator@2 diff --git a/tools/devops/build-provisioning.csx b/tools/devops/build-provisioning.csx new file mode 100644 index 000000000000..de6a84226d26 --- /dev/null +++ b/tools/devops/build-provisioning.csx @@ -0,0 +1,8 @@ +#load "provision-shared.csx" + +if (!ProvisionXcode ()) + return 1; +ProvisionMono (); +ProvisionSharpie (); +ProvisionBrewPackages (); +SetDefaultXcodeInVSMac (); diff --git a/tools/devops/build-provisioning.csx.in b/tools/devops/build-provisioning.csx.in deleted file mode 100644 index 2fba863a6961..000000000000 --- a/tools/devops/build-provisioning.csx.in +++ /dev/null @@ -1,38 +0,0 @@ -#r "_provisionator/provisionator.dll" - -using System.IO; -using System.Reflection; -using System.Linq; - -using static Xamarin.Provisioning.ProvisioningScript; - -// Provision Xcode using the xip name declared in Make.config -Xcode ("@XCODE_XIP_NAME@").XcodeSelect (allowUntrusted: true); - -// provisionator knows how to deal with this items -Item ("@MONO_PACKAGE@"); -Item ("@MIN_SHARPIE_URL@"); - -var appleSdkOverride = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "Library", "Preferences", "Xamarin", "Settings.plist"); -Item ("Override Apple SDK Settings") - .Action (item => { - DeleteSafe (appleSdkOverride); - CreateSetting (appleSdkOverride, "AppleSdkRoot", GetSelectedXcodePath ()); - Console.WriteLine ($"New iOS SDK Location: {GetSettingValue (appleSdkOverride, "AppleSdkRoot")}"); - }); - -void DeleteSafe (string file) -{ - if (File.Exists (file)) - File.Delete (file); -} - -void CreateSetting (string settingFile, string key, string value) -{ - Exec ("defaults", "write", settingFile, key, value); -} - -string GetSettingValue (string settingFile, string keyName) -{ - return Exec ("defaults", "read", settingFile, keyName).FirstOrDefault (); -} diff --git a/tools/devops/device-tests-provisioning.csx.in b/tools/devops/device-tests-provisioning.csx.in deleted file mode 100644 index 1834b99bbe52..000000000000 --- a/tools/devops/device-tests-provisioning.csx.in +++ /dev/null @@ -1,15 +0,0 @@ -#r "_provisionator/provisionator.dll" - -using System.IO; -using System.Reflection; -using System.Linq; - -using static Xamarin.Provisioning.ProvisioningScript; - -// Provision Xcode using the xip name declared in Make.config -Xcode ("@XCODE_XIP_NAME@").XcodeSelect (allowUntrusted: true); - -Item ("@MONO_PACKAGE@"); -Item ("@MIN_SHARPIE_URL@"); - -BrewPackages ("p7zip"); diff --git a/tools/devops/mac-tests-provisioning.csx.in b/tools/devops/mac-tests-provisioning.csx.in deleted file mode 100644 index 7bbea84ce87e..000000000000 --- a/tools/devops/mac-tests-provisioning.csx.in +++ /dev/null @@ -1,34 +0,0 @@ -#r "_provisionator/provisionator.dll" - -using System.IO; -using System.Reflection; -using System.Linq; - -using static Xamarin.Provisioning.ProvisioningScript; - -BrewPackages ("p7zip"); - -var appleSdkOverride = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), "Library", "Preferences", "Xamarin", "Settings.plist"); -Item ("Override Apple SDK Settings") - .Condition (item => !File.Exists (appleSdkOverride) || GetSettingValue (appleSdkOverride, "AppleSdkRoot") != GetSelectedXcodePath ()) - .Action (item => { - DeleteSafe (appleSdkOverride); - CreateSetting (appleSdkOverride, "AppleSdkRoot", GetSelectedXcodePath ()); - Console.WriteLine ($"New VSMac iOS SDK Location: {GetSelectedXcodePath ()}"); - }); - -void DeleteSafe (string file) -{ - if (File.Exists (file)) - File.Delete (file); -} - -void CreateSetting (string settingFile, string key, string value) -{ - Exec ("defaults", "write", settingFile, key, value); -} - -string GetSettingValue (string settingFile, string keyName) -{ - return Exec ("defaults", "read", settingFile, keyName).FirstOrDefault (); -} diff --git a/tools/devops/provision-brew-packages.csx b/tools/devops/provision-brew-packages.csx index 291ec5e294cd..1b0789b311f6 100644 --- a/tools/devops/provision-brew-packages.csx +++ b/tools/devops/provision-brew-packages.csx @@ -1,9 +1,3 @@ -BrewPackages ( - "shellcheck", - "yamllint", - "cmake", - "p7zip", - "msitools", - "wget", - "azure-cli" - ); +#load "provision-shared.csx" + +ProvisionBrewPackages (); diff --git a/tools/devops/provision-shared.csx b/tools/devops/provision-shared.csx deleted file mode 100644 index f01699237aee..000000000000 --- a/tools/devops/provision-shared.csx +++ /dev/null @@ -1,103 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -using Newtonsoft.Json.Linq; - -using Xamarin.Provisioning; -using Xamarin.Provisioning.Model; -using Xamarin.Provisioning.IO; - -var commit = Environment.GetEnvironmentVariable ("BUILD_SOURCEVERSION"); -var provision_from_commit = Environment.GetEnvironmentVariable ("PROVISION_FROM_COMMIT") ?? commit; - -// Looks for a variable either in the environment, or in current repo's Make.config. -// Returns null if the variable couldn't be found. -IEnumerable make_config = null; -string FindConfigurationVariable (string variable, string hash = "HEAD") -{ - var value = Environment.GetEnvironmentVariable (variable); - if (!string.IsNullOrEmpty (value)) - return value; - - if (make_config == null) { - try { - make_config = Exec ("git", "show", $"{hash}:Make.config"); - } catch { - Console.WriteLine ("Could not find a Make.config"); - return null; - } - } - foreach (var line in make_config) { - if (line.StartsWith (variable + "=", StringComparison.Ordinal)) - return line.Substring (variable.Length + 1); - } - - return null; -} - -string FindVariable (string variable) -{ - var value = FindConfigurationVariable (variable, provision_from_commit); - if (!string.IsNullOrEmpty (value)) - return value; - - throw new Exception ($"Could not find {variable} in environment nor in the commit's ({commit}) manifest."); -} - -void ExecVerbose (string filename, params string[] args) -{ - Console.WriteLine ($"{filename} {string.Join (" ", args)}"); - Exec (filename, args); -} - -bool IsAtLeastVersion(string actualVer, string minVer) -{ - if (actualVer.Equals(minVer, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - - var actualVerChars = actualVer.ToCharArray(); - var minVerChars = minVer.ToCharArray(); - - var length = Math.Min (minVerChars.Length, actualVerChars.Length); - - var i = 0; - while (i < length) - { - if (actualVerChars[i] > minVerChars[i]) - { - return true; - } - else if (minVerChars[i] > actualVerChars[i]) - { - return false; - } - i++; - } - - if (actualVerChars.Length == minVerChars.Length) - { - return true; - } - - return actualVerChars.Length > minVerChars.Length; -} - -void RemoveXcodeSymlinks (string xcodePath) -{ - Console.WriteLine ($"Checkig if '{xcodePath}' is a symlink..."); - var resolvedPath = Symlink.Resolve (xcodePath); - Console.WriteLine ($"Path resolved: '{resolvedPath}'"); - if (resolvedPath is string) { - Console.WriteLine ($"Removing '{xcodePath}' symlink."); - Symlink.Delete (xcodePath); - Console.WriteLine ($"Renaming '{resolvedPath}' into '{xcodePath}'"); - ElevatedExec ("/bin/mv", resolvedPath, xcodePath); - } else - Console.WriteLine ($"'{xcodePath}' is not a symlink."); -} diff --git a/tools/devops/provision-shared.in.csx b/tools/devops/provision-shared.in.csx new file mode 100644 index 000000000000..53816241322a --- /dev/null +++ b/tools/devops/provision-shared.in.csx @@ -0,0 +1,118 @@ +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +using Newtonsoft.Json.Linq; + +using Xamarin.Provisioning; +using Xamarin.Provisioning.Model; +using Xamarin.Provisioning.IO; + +var commit = Environment.GetEnvironmentVariable ("BUILD_SOURCEVERSION"); +var provision_from_commit = Environment.GetEnvironmentVariable ("PROVISION_FROM_COMMIT") ?? commit; + +void RemoveXcodeSymlinks (string xcodePath) +{ + Console.WriteLine ($"Checking if '{xcodePath}' is a symlink..."); + var resolvedPath = Symlink.Resolve (xcodePath); + Console.WriteLine ($"Path resolved: '{resolvedPath}'"); + if (resolvedPath is string) { + Console.WriteLine ($"Removing '{xcodePath}' symlink."); + Symlink.Delete (xcodePath); + Console.WriteLine ($"Renaming '{resolvedPath}' into '{xcodePath}'"); + ElevatedExec ("/bin/mv", resolvedPath, xcodePath); + } else + Console.WriteLine ($"'{xcodePath}' is not a symlink."); +} + +void ListXcodes () +{ + Console.WriteLine ($"Xcodes:"); + var lines = Exec ("bash", "-c", "ls -lad /Applications/Xcode*"); + foreach (var line in lines) + Console.WriteLine ($"\t{line}"); +} + +// Provision Xcode using the xip name declared in Make.config +// +// Overrides: +// * The current commit can be overridden by setting the PROVISION_FROM_COMMIT variable. +bool ProvisionXcode () +{ + + if (string.IsNullOrEmpty (provision_from_commit)) { + Console.Error.WriteLine ($"Either BUILD_SOURCEVERSION or PROVISION_FROM_COMMIT must be set."); + Environment.Exit (1); + return false; + } + + ListXcodes (); + + // Provision Xcode + Console.WriteLine ($"Provisioning Xcode from {provision_from_commit}..."); + + // Let's turn symlink into an actual path + var reqXcode = Path.GetDirectoryName (Path.GetDirectoryName ("@XCODE_ROOT_PATH@")); + RemoveXcodeSymlinks (reqXcode); + + // Provision Xcode using the xip name declared in Make.config + Xcode ("@XCODE_XIP_NAME@").XcodeSelect (allowUntrusted: true); + + LogInstalledXcodes (); + return true; +} + +void ProvisionBrewPackages () +{ + BrewPackages ( + "shellcheck", + "yamllint", + "cmake", + "p7zip", + "msitools", + "wget", + "azure-cli" + ); +} + +void SetDefaultXcodeInVSMac () +{ + var appleSdkOverride = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), "Library", "Preferences", "Xamarin", "Settings.plist"); + Item ("Override Apple SDK Settings") + .Condition (item => !File.Exists (appleSdkOverride) || GetSettingValue (appleSdkOverride, "AppleSdkRoot") != GetSelectedXcodePath ()) + .Action (item => { + DeleteSafe (appleSdkOverride); + CreateSetting (appleSdkOverride, "AppleSdkRoot", GetSelectedXcodePath ()); + Console.WriteLine ($"New VSMac iOS SDK Location: {GetSelectedXcodePath ()}"); + }); + +} + +void DeleteSafe (string file) +{ + if (File.Exists (file)) + File.Delete (file); +} + +void CreateSetting (string settingFile, string key, string value) +{ + Exec ("defaults", "write", settingFile, key, value); +} + +string GetSettingValue (string settingFile, string keyName) +{ + return Exec ("defaults", "read", settingFile, keyName).FirstOrDefault (); +} + +void ProvisionMono () +{ + Item ("@MONO_PACKAGE@"); +} + +void ProvisionSharpie () +{ + Item ("@MIN_SHARPIE_URL@"); +} diff --git a/tools/devops/provision-xcode.csx b/tools/devops/provision-xcode.csx new file mode 100644 index 000000000000..4a4785ea7462 --- /dev/null +++ b/tools/devops/provision-xcode.csx @@ -0,0 +1,4 @@ +#load "provision-shared.csx" + +if (ProvisionXcode ()) + return 1; diff --git a/tools/devops/provision-xcode.csx.in b/tools/devops/provision-xcode.csx.in deleted file mode 100644 index ea30ad8f6ec8..000000000000 --- a/tools/devops/provision-xcode.csx.in +++ /dev/null @@ -1,34 +0,0 @@ -#load "provision-shared.csx" - -// Provision Xcode -// -// Overrides: -// * The current commit can be overridden by setting the PROVISION_FROM_COMMIT variable. - -void ListXcodes () -{ - Console.WriteLine ($"Xcodes:"); - var lines = Exec ("bash", "-c", "ls -lad /Applications/Xcode*"); - foreach (var line in lines) - Console.WriteLine ($"\t{line}"); -} - -if (string.IsNullOrEmpty (provision_from_commit)) { - Console.Error.WriteLine ($"Either BUILD_SOURCEVERSION or PROVISION_FROM_COMMIT must be set."); - Environment.Exit (1); - return 1; -} - -ListXcodes (); - -// Provision Xcode -Console.WriteLine ($"Provisioning Xcode from {provision_from_commit}..."); - -// Let's turn symlink into an actual path -var reqXcode = Path.GetDirectoryName (Path.GetDirectoryName ("@XCODE_ROOT_PATH@")); -RemoveXcodeSymlinks (reqXcode); - -// Provision Xcode using the xip name declared in Make.config -Xcode ("@XCODE_XIP_NAME@").XcodeSelect (allowUntrusted: true); - -LogInstalledXcodes ();