diff --git a/Make.config b/Make.config index 3ed95673e316..478e831f158c 100644 --- a/Make.config +++ b/Make.config @@ -275,10 +275,18 @@ MIN_TVOS_SIMULATOR_VERSION=16.0 # These are the simulator package ids for the versions above EXTRA_SIMULATORS=iOS:MIN_IOS_SIMULATOR_VERSION tvOS:MIN_TVOS_SIMULATOR_VERSION +ifeq ($(ONLY_SHARPIE),) +ifneq ($(filter $(CURRENT_BRANCH),release/sharpie release-test/only-sharpie),) +ONLY_SHARPIE=1 +endif +endif + +ifndef ONLY_SHARPIE INCLUDE_IOS=1 INCLUDE_MAC=1 INCLUDE_TVOS=1 INCLUDE_MACCATALYST=1 +endif INCLUDE_SIMULATOR=1 INCLUDE_DEVICE=1 @@ -350,6 +358,8 @@ else $(error "The variable XCODE_IS_STABLE is not set!") endif $(Q) printf "\t\t$(TRACKING_DOTNET_RUNTIME_SEPARATELY)\n" >> $@.tmp + $(Q) printf "\t\t$(CURRENT_BRANCH)\n" >> $@.tmp + $(Q) printf "\t\t$(CURRENT_HASH_LONG)\n" >> $@.tmp $(Q) printf "\t\n" >> $@.tmp $(Q) printf "\n" >> $@.tmp $(Q) mv $@.tmp $@ diff --git a/Makefile b/Makefile index aa000f2ee604..c3ad7716de0d 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,13 @@ ifndef IS_LINUX SUBDIRS += runtime endif -SUBDIRS += src msbuild tools +SUBDIRS += src + +ifndef ONLY_SHARPIE +SUBDIRS += msbuild +endif + +SUBDIRS += tools ifndef IS_LINUX SUBDIRS += dotnet diff --git a/NuGet.config b/NuGet.config index 04c62d048c9f..430d02d0e165 100644 --- a/NuGet.config +++ b/NuGet.config @@ -10,8 +10,11 @@ + + + diff --git a/configure b/configure index 1c6d64b9c36d..4a126a2a5bd1 100755 --- a/configure +++ b/configure @@ -25,6 +25,8 @@ Usage: configure [options] --enable-xamarin --disable-xamarin Enable/disable additional Xamarin-specific parts of the build. + --only-sharpie Only build Objective-Sharpie. This is on by default for the branch 'release/sharpie', and disabled otherwise. + --custom-dotnet=[dotnet/runtime] Use a locally built version of dotnet/runtime. Pass the path to an already build checkout of dotnet/runtime. See docs/CORECLR.md for detailed instructions about how to build dotnet/runtime from source. --ignore-unknown-params alters the default behavior to not return an non-zero exit code when an unknown parameter is provided. @@ -134,6 +136,14 @@ while test "x$1" != x; do echo "INCLUDE_SIMULATOR=" >> "$CONFIGURED_FILE" shift ;; + --only-sharpie) + echo "ONLY_SHARPIE=1" >> "$CONFIGURED_FILE" + echo "INCLUDE_MAC=" >> $CONFIGURED_FILE + echo "INCLUDE_IOS=" >> $CONFIGURED_FILE + echo "INCLUDE_TVOS=" >> $CONFIGURED_FILE + echo "INCLUDE_MACCATALYST=" >> $CONFIGURED_FILE + shift + ;; --ignore-unknown-params) echo "ignoring unknown parameters" IGNORE_UNKNOWN_PARAMS=true diff --git a/dotnet/Makefile b/dotnet/Makefile index c033336a82dc..a807fe5d4ccf 100644 --- a/dotnet/Makefile +++ b/dotnet/Makefile @@ -136,7 +136,15 @@ Microsoft.$1.Sdk/targets/Microsoft.$1.Sdk.Versions.props: targets/Microsoft.$1.S endef $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call VersionsTemplate,$(platform),$(shell echo $(platform) | tr a-z A-Z),$(DOTNET_$(shell echo $(platform) | tr a-z A-Z)_RUNTIME_IDENTIFIERS),$(shell echo $(DOTNET_$(shell echo $(platform) | tr a-z A-Z)_RUNTIME_IDENTIFIERS) | tr ' ' ';'),$(DOTNET_$(shell echo $(platform) | tr a-z A-Z)_RUNTIME_IDENTIFIERS_NO_ARCH)))) +# When building only sharpie, generate iOS version props so setup-publish-bar-manifest works for DARC +ifdef ONLY_SHARPIE +$(eval $(call VersionsTemplate,iOS,IOS,,,ios)) +endif + version-props: $(foreach platform,$(DOTNET_PLATFORMS),targets/Microsoft.$(platform).Sdk.Versions.props) +ifdef ONLY_SHARPIE +version-props: targets/Microsoft.iOS.Sdk.Versions.props +endif setup-publish-bar-manifest: version-props echo \#\#vso[task.setvariable variable=PrereleaseIdentifier]$(NUGET_PRERELEASE_IDENTIFIER) @@ -466,7 +474,9 @@ NUGET_SOURCES:=$(shell grep https://pkgs.dev.azure.com $(TOP)/NuGet.config | sed $(foreach platform,$(DOTNET_PLATFORMS),$(shell echo $(platform) | tr A-Z a-z)) $(Q) touch $@ +ifndef ONLY_SHARPIE TARGETS += .stamp-install-workloads +endif TARGETS += $(WORKLOAD_TARGETS) $(WINDOWS_PACKAGE_TARGETS) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.props b/dotnet/targets/Xamarin.Shared.Sdk.props index 0c3526f2f0e2..ebe2a060567e 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.props +++ b/dotnet/targets/Xamarin.Shared.Sdk.props @@ -15,8 +15,8 @@ <_MobilePropsPath>$(_MobilePropsDir)$(MSBuildProjectName).mobile.props - - + + diff --git a/eng/Version.Details.props b/eng/Version.Details.props index f3032eab7ddc..7574d37ab76d 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -18,15 +18,15 @@ This file should be imported by eng/Versions.props 11.0.100-preview.3.26153.109 26.0.11017 - 26.2.10219 + 26.2.10218 26.0.11017 - 26.2.10219 + 26.2.10218 26.0.11017 - 26.2.10219 + 26.2.10218 26.0.11017 - 26.2.10219 + 26.2.10218 - 10.0.0-prerelease.25516.4 + 11.0.0-prerelease.26117.1 diff --git a/scripts/create-windows-html-report/create-windows-html-report.cs b/scripts/create-windows-html-report/create-windows-html-report.cs index f17faa30308c..34e734a1b65b 100644 --- a/scripts/create-windows-html-report/create-windows-html-report.cs +++ b/scripts/create-windows-html-report/create-windows-html-report.cs @@ -85,6 +85,10 @@ public static int Main (string [] args) var indexContents = new StringBuilder (); var summaryContents = new StringBuilder (); + var allFailedTests = new List<(string TrxName, TrxParser.TrxTestResult Test)> (); + var failedTrxNames = new List (); + var passedTrxCount = 0; + var failedTrxCount = 0; indexContents.AppendLine ($""); indexContents.AppendLine ($""); @@ -123,9 +127,12 @@ public static int Main (string [] args) var name = trx.Name; var path = trx.TestResults; var messageLines = new List (); + var trxSucceeded = true; - if (TrxParser.TryParseTrxFile (path, out var failedTests, out var outcome, out allTestsSucceeded, out var ex)) { + if (TrxParser.TryParseTrxFile (path, out var failedTests, out var outcome, out trxSucceeded, out var ex)) { if (failedTests?.Any () == true) { + foreach (var ft in failedTests) + allFailedTests.Add ((name, ft)); messageLines.Add ("
    "); foreach (var ft in failedTests) { var testName = ft.Name; @@ -152,7 +159,15 @@ public static int Main (string [] args) outcome = "Failed to parse test results"; if (ex is not null) messageLines.Add ($"
    {FormatHtml (ex.ToString ())}
    "); + trxSucceeded = false; + } + + if (!trxSucceeded) { allTestsSucceeded = false; + failedTrxNames.Add (name); + failedTrxCount++; + } else { + passedTrxCount++; } try { @@ -194,7 +209,23 @@ public static int Main (string [] args) if (allTestsSucceeded) { summaryContents.AppendLine ($"# :tada: All {trxFiles.Length} tests passed :tada:"); } else { - summaryContents.AppendLine ($"# :tada: All {trxFiles.Length} tests passed :tada:"); + summaryContents.AppendLine ("# Test results"); + summaryContents.AppendLine ("
    "); + summaryContents.AppendLine ($"{failedTrxCount} tests failed, {passedTrxCount} tests passed."); + summaryContents.AppendLine (); + summaryContents.AppendLine ("## Failed tests"); + summaryContents.AppendLine (); + if (allFailedTests.Any ()) { + foreach (var (trxName, test) in allFailedTests) { + var msg = string.IsNullOrEmpty (test.Message) ? "" : $": {test.Message.Split ('\n') [0]}"; + summaryContents.AppendLine ($" * {trxName}/{test.Name}: {test.Outcome}{msg}"); + } + } else { + foreach (var trxName in failedTrxNames) { + summaryContents.AppendLine ($" * {trxName}: Failed"); + } + } + summaryContents.AppendLine ("
    "); } Directory.CreateDirectory (outputDirectory); diff --git a/scripts/generate-vs-workload/generate-vs-workload.cs b/scripts/generate-vs-workload/generate-vs-workload.cs index 6d198f727181..9b02fd6ea6bf 100755 --- a/scripts/generate-vs-workload/generate-vs-workload.cs +++ b/scripts/generate-vs-workload/generate-vs-workload.cs @@ -62,7 +62,14 @@ writer.WriteLine ($" {allPlatforms}.{tfm}.{xcodeName}"); // Find the iOS version, otherwise use the version of the first platform listed. var iOSPlatform = platforms.Where (v => v.Item1 == "iOS"); - var manifestBuildVersion = iOSPlatform.Any () ? iOSPlatform.First ().Item2 : platforms.First ().Item2; + string manifestBuildVersion; + if (iOSPlatform.Any ()) { + manifestBuildVersion = iOSPlatform.First ().Item2; + } else if (platforms.Any ()) { + manifestBuildVersion = platforms.First ().Item2; + } else { + manifestBuildVersion = "0.0.1"; // happens when building only sharpie + } writer.WriteLine ($" {manifestBuildVersion}"); writer.WriteLine ($" true"); writer.WriteLine ($" false"); diff --git a/src/AddressBook/ABAddressBook.cs b/src/AddressBook/ABAddressBook.cs index df69a55807a3..5fde5ef1b33a 100644 --- a/src/AddressBook/ABAddressBook.cs +++ b/src/AddressBook/ABAddressBook.cs @@ -535,7 +535,7 @@ public ABGroup [] GetGroups (ABRecord source) if (label is null) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (label)); - string? result = CFString.FromHandle (ABAddressBookCopyLocalizedLabel (label.Handle)); + string? result = CFString.FromHandle (ABAddressBookCopyLocalizedLabel (label.Handle), true); GC.KeepAlive (label); return result; } @@ -754,7 +754,7 @@ public ABPerson [] GetPeopleWithName (string name) var h = ABAddressBookCopyDefaultSource (GetCheckedHandle ()); if (h == IntPtr.Zero) return null; - return new ABSource (h, this); + return new ABSource (h, true) { AddressBook = this }; } [DllImport (Constants.AddressBookLibrary)] diff --git a/src/AddressBook/ABMultiValue.cs b/src/AddressBook/ABMultiValue.cs index e6008b052e77..0bb23505893c 100644 --- a/src/AddressBook/ABMultiValue.cs +++ b/src/AddressBook/ABMultiValue.cs @@ -212,7 +212,7 @@ public T Value { public NSString? Label { get { AssertValid (); - return Runtime.GetNSObject (ABMultiValue.CopyLabelAtIndex (self.Handle, index)); + return Runtime.GetNSObject (ABMultiValue.CopyLabelAtIndex (self.Handle, index), true); } set { if (IsReadOnly) @@ -319,7 +319,7 @@ public ABPropertyType PropertyType { /// public T [] GetValues () { - return NSArray.ArrayFromHandle (ABMultiValue.CopyArrayOfAllValues (Handle), toManaged) + return NSArray.ArrayFromHandle (ABMultiValue.CopyArrayOfAllValues (Handle), toManaged, releaseHandle: true) ?? Array.Empty (); } diff --git a/src/AddressBook/ABPerson.cs b/src/AddressBook/ABPerson.cs index b9abcd6d0563..a25688241a3e 100644 --- a/src/AddressBook/ABPerson.cs +++ b/src/AddressBook/ABPerson.cs @@ -920,7 +920,7 @@ public int CompareTo (ABPerson other, ABPersonSortBy ordering) /// public static string? LocalizedPropertyName (ABPersonProperty property) { - return CFString.FromHandle (ABPersonCopyLocalizedPropertyName (ABPersonPropertyId.ToId (property))); + return CFString.FromHandle (ABPersonCopyLocalizedPropertyName (ABPersonPropertyId.ToId (property)), true); } /// A value that corresponds to one of the low-level kABPersonProperty fields. @@ -946,7 +946,7 @@ public int CompareTo (ABPerson other, ABPersonSortBy ordering) /// public static string? LocalizedPropertyName (int propertyId) { - return CFString.FromHandle (ABPersonCopyLocalizedPropertyName (propertyId)); + return CFString.FromHandle (ABPersonCopyLocalizedPropertyName (propertyId), true); } [DllImport (Constants.AddressBookLibrary)] @@ -1014,7 +1014,7 @@ public static ABPropertyType GetPropertyType (int propertyId) /// /// public NSData? Image { - get { return Runtime.GetNSObject (ABPersonCopyImageData (Handle)); } + get { return Runtime.GetNSObject (ABPersonCopyImageData (Handle), true); } set { IntPtr error; unsafe { @@ -1744,7 +1744,7 @@ public void SetRelatedNames (ABMultiValue? value) public ABPerson? []? GetLinkedPeople () { var linked = ABPersonCopyArrayOfAllLinkedPeople (Handle); - return NSArray.ArrayFromHandle (linked, l => new ABPerson (l, null)); + return NSArray.ArrayFromHandle (linked, l => new ABPerson (l, null), releaseHandle: true); } [DllImport (Constants.AddressBookLibrary)] @@ -1756,7 +1756,7 @@ public void SetRelatedNames (ABMultiValue? value) /// To be added. public NSData? GetImage (ABPersonImageFormat format) { - return Runtime.GetNSObject (ABPersonCopyImageDataWithFormat (Handle, (nint) (long) format)); + return Runtime.GetNSObject (ABPersonCopyImageDataWithFormat (Handle, (nint) (long) format), true); } [DllImport (Constants.AddressBookLibrary)] @@ -1799,7 +1799,7 @@ public void SetRelatedNames (ABMultiValue? value) GC.KeepAlive (source); GC.KeepAlive (vCardData); - return NSArray.ArrayFromHandle (res, l => new ABPerson (l, null)); + return NSArray.ArrayFromHandle (res, l => new ABPerson (l, null), releaseHandle: true); } } diff --git a/src/AddressBook/ABRecord.cs b/src/AddressBook/ABRecord.cs index c579db02c202..3dfbceeb0488 100644 --- a/src/AddressBook/ABRecord.cs +++ b/src/AddressBook/ABRecord.cs @@ -182,7 +182,7 @@ public ABRecordType Type { /// public override string? ToString () { - return CFString.FromHandle (ABRecordCopyCompositeName (Handle)); + return CFString.FromHandle (ABRecordCopyCompositeName (Handle), true); } // TODO: Should SetValue/CopyValue/RemoveValue be public? @@ -238,12 +238,12 @@ internal void RemoveValue (int property) where T : NSObject { IntPtr value = CopyValue (id); - return (T?) Runtime.GetNSObject (value); + return (T?) Runtime.GetNSObject (value, true); } internal string? PropertyToString (int id) { - return CFString.FromHandle (CopyValue (id)); + return CFString.FromHandle (CopyValue (id), true); } } } diff --git a/src/CFNetwork/CFHTTPMessage.cs b/src/CFNetwork/CFHTTPMessage.cs index 730a9de9699a..aa763a3dc113 100644 --- a/src/CFNetwork/CFHTTPMessage.cs +++ b/src/CFNetwork/CFHTTPMessage.cs @@ -219,7 +219,7 @@ public bool AppendBytes (byte [] bytes, nint count) public NSDictionary? GetAllHeaderFields () { - return Runtime.GetNSObject (CFHTTPMessageCopyAllHeaderFields (GetCheckedHandle ())); + return Runtime.GetNSObject (CFHTTPMessageCopyAllHeaderFields (GetCheckedHandle ()), true); } #region Authentication diff --git a/src/CoreFoundation/CFBundle.cs b/src/CoreFoundation/CFBundle.cs index 52d4df1293c5..27754c0cc9f8 100644 --- a/src/CoreFoundation/CFBundle.cs +++ b/src/CoreFoundation/CFBundle.cs @@ -743,8 +743,7 @@ public NSDictionary? LocalInfoDictionary { { if (url is null) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url)); - // follow the create rule, no need to retain - NSDictionary? result = Runtime.GetNSObject (CFBundleCopyInfoDictionaryForURL (url.Handle)); + var result = Runtime.GetNSObject (CFBundleCopyInfoDictionaryForURL (url.Handle), true); GC.KeepAlive (url); return result; } diff --git a/src/CoreFoundation/CFType.cs b/src/CoreFoundation/CFType.cs index bf6525055de1..c8350843524f 100644 --- a/src/CoreFoundation/CFType.cs +++ b/src/CoreFoundation/CFType.cs @@ -50,7 +50,7 @@ internal CFType (NativeHandle handle, bool owns) if (handle == IntPtr.Zero) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handle)); - return CFString.FromHandle (CFCopyDescription (handle)); + return CFString.FromHandle (CFCopyDescription (handle), true); } [DllImport (Constants.CoreFoundationLibrary)] diff --git a/src/CoreGraphics/CGEvent.cs b/src/CoreGraphics/CGEvent.cs index a5e7359d87b6..45f70851886a 100644 --- a/src/CoreGraphics/CGEvent.cs +++ b/src/CoreGraphics/CGEvent.cs @@ -294,7 +294,7 @@ public CGEvent Copy () /// To be added. public NSData? ToData () { - return Runtime.GetNSObject (CGEventCreateData (IntPtr.Zero, Handle)); + return Runtime.GetNSObject (CGEventCreateData (IntPtr.Zero, Handle), true); } [DllImport (Constants.ApplicationServicesCoreGraphicsLibrary)] diff --git a/src/CoreMedia/CMTime.cs b/src/CoreMedia/CMTime.cs index 7ee1ea21ed88..9a4dfee63670 100644 --- a/src/CoreMedia/CMTime.cs +++ b/src/CoreMedia/CMTime.cs @@ -486,7 +486,7 @@ public NSDictionary ToDictionary () /// To be added. public string? Description { get { - return CFString.FromHandle (CMTimeCopyDescription (IntPtr.Zero, this)); + return CFString.FromHandle (CMTimeCopyDescription (IntPtr.Zero, this), true); } } diff --git a/src/CoreText/CTFont.cs b/src/CoreText/CTFont.cs index e1840a5d1f3b..f56ce336fc6f 100644 --- a/src/CoreText/CTFont.cs +++ b/src/CoreText/CTFont.cs @@ -2953,7 +2953,7 @@ public CTFontDescriptor GetFontDescriptor () { if (attribute is null) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (attribute)); - var result = Runtime.GetNSObject (CTFontCopyAttribute (Handle, attribute.Handle)); + var result = Runtime.GetNSObject (CTFontCopyAttribute (Handle, attribute.Handle), true); GC.KeepAlive (attribute); return result; } diff --git a/src/CoreVideo/CVPixelFormatDescription.cs b/src/CoreVideo/CVPixelFormatDescription.cs index 03f5f6b27bcf..88737257967d 100644 --- a/src/CoreVideo/CVPixelFormatDescription.cs +++ b/src/CoreVideo/CVPixelFormatDescription.cs @@ -304,7 +304,7 @@ public static CVPixelFormatType [] AllPixelFormatTypes { /// The pixel format to create a description of. public static NSDictionary? Create (CVPixelFormatType pixelFormat) { - return Runtime.GetNSObject (CVPixelFormatDescriptionCreateWithPixelFormatType (IntPtr.Zero, (int) pixelFormat)); + return Runtime.GetNSObject (CVPixelFormatDescriptionCreateWithPixelFormatType (IntPtr.Zero, (int) pixelFormat), true); } /// Create a description of the specified pixel format. diff --git a/src/MobileCoreServices/UTType.cs b/src/MobileCoreServices/UTType.cs index 8c5092977a26..df32e5d710c8 100644 --- a/src/MobileCoreServices/UTType.cs +++ b/src/MobileCoreServices/UTType.cs @@ -110,7 +110,7 @@ public static bool IsDeclared (string utType) var a = CFString.CreateNative (tagClass); var b = CFString.CreateNative (tag); var c = CFString.CreateNative (conformingToUti); - var ret = CFString.FromHandle (UTTypeCreatePreferredIdentifierForTag (a, b, c)); + var ret = CFString.FromHandle (UTTypeCreatePreferredIdentifierForTag (a, b, c), true); CFString.ReleaseNative (a); CFString.ReleaseNative (b); CFString.ReleaseNative (c); @@ -136,7 +136,7 @@ public static bool IsDeclared (string utType) var a = CFString.CreateNative (tagClass); var b = CFString.CreateNative (tag); var c = CFString.CreateNative (conformingToUti); - var ret = CFArray.StringArrayFromHandle (UTTypeCreateAllIdentifiersForTag (a, b, c)); + var ret = CFArray.StringArrayFromHandle (UTTypeCreateAllIdentifiersForTag (a, b, c), true); CFString.ReleaseNative (a); CFString.ReleaseNative (b); CFString.ReleaseNative (c); @@ -174,7 +174,7 @@ public static bool IsDeclared (string utType) var a = CFString.CreateNative (uti); var b = CFString.CreateNative (tagClass); - var ret = CFArray.StringArrayFromHandle (UTTypeCopyAllTagsWithClass (a, b)); + var ret = CFArray.StringArrayFromHandle (UTTypeCopyAllTagsWithClass (a, b), true); CFString.ReleaseNative (a); CFString.ReleaseNative (b); return ret; @@ -216,7 +216,7 @@ public static bool ConformsTo (string uti, string conformsToUti) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (uti)); var a = CFString.CreateNative (uti); - var ret = CFString.FromHandle (UTTypeCopyDescription (a)); + var ret = CFString.FromHandle (UTTypeCopyDescription (a), true); CFString.ReleaseNative (a); return ret; } @@ -238,7 +238,7 @@ public static bool ConformsTo (string uti, string conformsToUti) var a = CFString.CreateNative (uti); var b = CFString.CreateNative (tagClass); - var ret = CFString.FromHandle (UTTypeCopyPreferredTagWithClass (a, b)); + var ret = CFString.FromHandle (UTTypeCopyPreferredTagWithClass (a, b), true); CFString.ReleaseNative (a); CFString.ReleaseNative (b); return ret; @@ -257,7 +257,7 @@ public static bool ConformsTo (string uti, string conformsToUti) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (uti)); var a = CFString.CreateNative (uti); - var ret = Runtime.GetNSObject (UTTypeCopyDeclaration (a)); + var ret = Runtime.GetNSObject (UTTypeCopyDeclaration (a), true); CFString.ReleaseNative (a); return ret; } @@ -271,7 +271,7 @@ public static bool ConformsTo (string uti, string conformsToUti) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (uti)); var a = CFString.CreateNative (uti); - var ret = Runtime.GetNSObject (UTTypeCopyDeclaringBundleURL (a)); + var ret = Runtime.GetNSObject (UTTypeCopyDeclaringBundleURL (a), true); CFString.ReleaseNative (a); return ret; } diff --git a/src/foundation.cs b/src/foundation.cs index faa0a23a04c4..82b269696645 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -14034,6 +14034,7 @@ partial interface NSBundle { [Export ("bundleWithPath:")] [Static] + [return: NullAllowed] NSBundle FromPath (string path); [DesignatedInitializer] @@ -14046,6 +14047,7 @@ partial interface NSBundle { [Export ("bundleWithIdentifier:")] [Static] + [return: NullAllowed] NSBundle FromIdentifier (string str); #if !XAMCORE_5_0 @@ -14090,48 +14092,62 @@ partial interface NSBundle { string BundlePath { get; } [Export ("resourcePath")] + [NullAllowed] string ResourcePath { get; } [Export ("executablePath")] + [NullAllowed] string ExecutablePath { get; } [Export ("pathForAuxiliaryExecutable:")] + [return: NullAllowed] string PathForAuxiliaryExecutable (string s); [Export ("privateFrameworksPath")] + [NullAllowed] string PrivateFrameworksPath { get; } [Export ("sharedFrameworksPath")] + [NullAllowed] string SharedFrameworksPath { get; } [Export ("sharedSupportPath")] + [NullAllowed] string SharedSupportPath { get; } [Export ("builtInPlugInsPath")] + [NullAllowed] string BuiltinPluginsPath { get; } [Export ("bundleIdentifier")] + [NullAllowed] string BundleIdentifier { get; } [Export ("classNamed:")] + [return: NullAllowed] Class ClassNamed (string className); [Export ("principalClass")] + [NullAllowed] Class PrincipalClass { get; } [Export ("pathForResource:ofType:inDirectory:")] [Static] - string PathForResourceAbsolute (string name, [NullAllowed] string ofType, string bundleDirectory); + [return: NullAllowed] + string PathForResourceAbsolute ([NullAllowed] string name, [NullAllowed] string ofType, string bundleDirectory); [Export ("pathForResource:ofType:")] - string PathForResource (string name, [NullAllowed] string ofType); + [return: NullAllowed] + string PathForResource ([NullAllowed] string name, [NullAllowed] string ofType); [Export ("pathForResource:ofType:inDirectory:")] - string PathForResource (string name, [NullAllowed] string ofType, [NullAllowed] string subpath); + [return: NullAllowed] + string PathForResource ([NullAllowed] string name, [NullAllowed] string ofType, [NullAllowed] string subpath); [Export ("pathForResource:ofType:inDirectory:forLocalization:")] - string PathForResource (string name, [NullAllowed] string ofType, string subpath, string localizationName); + [return: NullAllowed] + string PathForResource ([NullAllowed] string name, [NullAllowed] string ofType, [NullAllowed] string subpath, [NullAllowed] string localizationName); /// Get a localized version of the string for the specified key in the specified table. /// The key to lookup @@ -14142,12 +14158,15 @@ partial interface NSBundle { NSString GetLocalizedString ([NullAllowed] NSString key, [NullAllowed] NSString value, [NullAllowed] NSString table); [Export ("objectForInfoDictionaryKey:")] + [return: NullAllowed] NSObject ObjectForInfoDictionary (string key); [Export ("developmentLocalization")] + [NullAllowed] string DevelopmentLocalization { get; } [Export ("infoDictionary")] + [NullAllowed] NSDictionary InfoDictionary { get; } // Additions from AppKit @@ -14185,6 +14204,7 @@ partial interface NSBundle { [NoMacCatalyst] [NoTV] [Export ("pathForImageResource:")] + [return: NullAllowed] string PathForImageResource (string resource); /// To be added. @@ -14195,6 +14215,7 @@ partial interface NSBundle { [NoMacCatalyst] [NoTV] [Export ("pathForSoundResource:")] + [return: NullAllowed] string PathForSoundResource (string resource); /// To be added. @@ -14205,6 +14226,7 @@ partial interface NSBundle { [NoMacCatalyst] [NoTV] [Export ("URLForImageResource:")] + [return: NullAllowed] NSUrl GetUrlForImageResource (string resource); /// To be added. @@ -14215,6 +14237,7 @@ partial interface NSBundle { [NoMacCatalyst] [NoTV] [Export ("contextHelpForKey:")] + [return: NullAllowed] NSAttributedString GetContextHelp (string key); // http://developer.apple.com/library/ios/#documentation/uikit/reference/NSBundle_UIKitAdditions/Introduction/Introduction.html @@ -14233,36 +14256,45 @@ partial interface NSBundle { [NoMac] [MacCatalyst (13, 1)] [Export ("loadNibNamed:owner:options:")] + [return: NullAllowed] NSArray LoadNib (string nibName, [NullAllowed] NSObject owner, [NullAllowed] NSDictionary options); [Export ("bundleURL")] NSUrl BundleUrl { get; } [Export ("resourceURL")] + [NullAllowed] NSUrl ResourceUrl { get; } [Export ("executableURL")] + [NullAllowed] NSUrl ExecutableUrl { get; } [Export ("URLForAuxiliaryExecutable:")] + [return: NullAllowed] NSUrl UrlForAuxiliaryExecutable (string executable); [Export ("privateFrameworksURL")] + [NullAllowed] NSUrl PrivateFrameworksUrl { get; } [Export ("sharedFrameworksURL")] + [NullAllowed] NSUrl SharedFrameworksUrl { get; } [Export ("sharedSupportURL")] + [NullAllowed] NSUrl SharedSupportUrl { get; } [Export ("builtInPlugInsURL")] + [NullAllowed] NSUrl BuiltInPluginsUrl { get; } [Export ("initWithURL:")] NativeHandle Constructor (NSUrl url); [Static, Export ("bundleWithURL:")] + [return: NullAllowed] NSBundle FromUrl (NSUrl url); [Export ("preferredLocalizations")] @@ -14272,37 +14304,45 @@ partial interface NSBundle { string [] Localizations { get; } [Export ("appStoreReceiptURL")] + [NullAllowed] NSUrl AppStoreReceiptUrl { get; } [Export ("pathsForResourcesOfType:inDirectory:")] - string [] PathsForResources (string fileExtension, [NullAllowed] string subDirectory); + string [] PathsForResources ([NullAllowed] string fileExtension, [NullAllowed] string subDirectory); [Export ("pathsForResourcesOfType:inDirectory:forLocalization:")] - string [] PathsForResources (string fileExtension, [NullAllowed] string subDirectory, [NullAllowed] string localizationName); + string [] PathsForResources ([NullAllowed] string fileExtension, [NullAllowed] string subDirectory, [NullAllowed] string localizationName); [Static, Export ("pathsForResourcesOfType:inDirectory:")] - string [] GetPathsForResources (string fileExtension, string bundlePath); + string [] GetPathsForResources ([NullAllowed] string fileExtension, string bundlePath); [Static, Export ("URLForResource:withExtension:subdirectory:inBundleWithURL:")] - NSUrl GetUrlForResource (string name, string fileExtension, [NullAllowed] string subdirectory, NSUrl bundleURL); + [return: NullAllowed] + NSUrl GetUrlForResource ([NullAllowed] string name, [NullAllowed] string fileExtension, [NullAllowed] string subdirectory, NSUrl bundleURL); [Static, Export ("URLsForResourcesWithExtension:subdirectory:inBundleWithURL:")] - NSUrl [] GetUrlsForResourcesWithExtension (string fileExtension, [NullAllowed] string subdirectory, NSUrl bundleURL); + [return: NullAllowed] + NSUrl [] GetUrlsForResourcesWithExtension ([NullAllowed] string fileExtension, [NullAllowed] string subdirectory, NSUrl bundleURL); [Export ("URLForResource:withExtension:")] - NSUrl GetUrlForResource (string name, string fileExtension); + [return: NullAllowed] + NSUrl GetUrlForResource ([NullAllowed] string name, [NullAllowed] string fileExtension); [Export ("URLForResource:withExtension:subdirectory:")] - NSUrl GetUrlForResource (string name, string fileExtension, [NullAllowed] string subdirectory); + [return: NullAllowed] + NSUrl GetUrlForResource ([NullAllowed] string name, [NullAllowed] string fileExtension, [NullAllowed] string subdirectory); [Export ("URLForResource:withExtension:subdirectory:localization:")] - NSUrl GetUrlForResource (string name, string fileExtension, [NullAllowed] string subdirectory, [NullAllowed] string localizationName); + [return: NullAllowed] + NSUrl GetUrlForResource ([NullAllowed] string name, [NullAllowed] string fileExtension, [NullAllowed] string subdirectory, [NullAllowed] string localizationName); [Export ("URLsForResourcesWithExtension:subdirectory:")] - NSUrl [] GetUrlsForResourcesWithExtension (string fileExtension, [NullAllowed] string subdirectory); + [return: NullAllowed] + NSUrl [] GetUrlsForResourcesWithExtension ([NullAllowed] string fileExtension, [NullAllowed] string subdirectory); [Export ("URLsForResourcesWithExtension:subdirectory:localization:")] - NSUrl [] GetUrlsForResourcesWithExtension (string fileExtension, [NullAllowed] string subdirectory, [NullAllowed] string localizationName); + [return: NullAllowed] + NSUrl [] GetUrlsForResourcesWithExtension ([NullAllowed] string fileExtension, [NullAllowed] string subdirectory, [NullAllowed] string localizationName); [NoMac] [MacCatalyst (13, 1)] @@ -19530,6 +19570,7 @@ partial interface NSBundle { [NoMacCatalyst] [NoTV] [Export ("imageForResource:")] + [return: NullAllowed] NSImage ImageForResource (string name); } diff --git a/tests/Makefile b/tests/Makefile index 3b606359c523..3651dc51502b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -3,9 +3,11 @@ TOP = .. include $(TOP)/Make.config # Skip test-libraries on Linux (requires native compilation with Xcode/clang) +ifndef ONLY_SHARPIE ifndef IS_LINUX SUBDIRS=test-libraries endif +endif SUBDIRS += dotnet include $(TOP)/mk/rules.mk @@ -195,12 +197,16 @@ verify-system-vsmac-xcode-match: if [[ "$$SYSTEM_XCODE" != "$$VSMAC_XCODE" ]]; then echo "Error: the system's Xcode ($$SYSTEM_XCODE) does not match the Xcode selected in Visual Studio for Mac ($$VSMAC_XCODE). This will make tests fail in non-trivial ways, so please make sure both match the expected Xcode ($(shell dirname $(shell dirname $(XCODE_DEVELOPER_ROOT))))."; exit 1; fi package-test-libraries.zip: +ifndef ONLY_SHARPIE $(Q) $(MAKE) all -C test-libraries $(Q) $(MAKE) all -C test-libraries/custom-type-assembly build-assembly +endif $(Q_GEN) rm -f "$@" "$@.tmp" $(Q_GEN) cd $(TOP) && zip -9r --symlinks $(abspath $@).tmp ./tests/test-libraries +ifndef ONLY_SHARPIE $(Q_GEN) cd $(TOP) && find tests -regex 'tests/test-libraries/custom-type-assembly/.libs/.*dll' -exec zip -9r --symlinks $(abspath $@).tmp {} + $(Q_GEN) cd $(TOP) && git ls-files -o -- 'tests/bindings-test/*.generated.cs' | zip -9r --symlinks $(abspath $@).tmp -@ +endif $(Q) mv "$@".tmp "$@" build-all: diff --git a/tests/monotouch-test/AddressBook/AddressBookTest.cs b/tests/monotouch-test/AddressBook/AddressBookTest.cs index 4bd8e66706a4..b08aa4670c46 100644 --- a/tests/monotouch-test/AddressBook/AddressBookTest.cs +++ b/tests/monotouch-test/AddressBook/AddressBookTest.cs @@ -58,6 +58,16 @@ public void GetSource () // GetSource(0) is not reliable across device/simulator and iOS versions Assert.Null (ab.GetSource (Int32.MaxValue), "MaxValue"); } + + [Test] + public void LocalizedLabel () + { + TestRuntime.CheckAddressBookPermission (); + var label = ABPersonPhoneLabel.Mobile; + var result = ABAddressBook.LocalizedLabel (label); + Assert.NotNull (result, "result"); + Assert.That (result.Length, Is.GreaterThan (0), "Length"); + } } } diff --git a/tests/monotouch-test/AddressBook/PersonTest.cs b/tests/monotouch-test/AddressBook/PersonTest.cs index 0ed91d0e7b81..c34b5568bbce 100644 --- a/tests/monotouch-test/AddressBook/PersonTest.cs +++ b/tests/monotouch-test/AddressBook/PersonTest.cs @@ -11,6 +11,7 @@ using UIKit; using AddressBook; +using Foundation; using Xamarin.Utils; namespace MonoTouchFixtures.AddressBook { @@ -62,6 +63,113 @@ public void UpdateAddressLine () Assert.IsTrue (ab.HasUnsavedChanges); ab.Save (); } + + [Test] + public void LocalizedPropertyName () + { + TestRuntime.CheckAddressBookPermission (); + var name = ABPerson.LocalizedPropertyName (ABPersonProperty.FirstName); + Assert.NotNull (name, "name"); + Assert.That (name.Length, Is.GreaterThan (0), "Length"); + } + + [Test] + public void LocalizedPropertyName_Int () + { + TestRuntime.CheckAddressBookPermission (); + // Use the underlying integer ID for ABPersonProperty.LastName (1) + var name = ABPerson.LocalizedPropertyName (1); + Assert.NotNull (name, "name"); + Assert.That (name.Length, Is.GreaterThan (0), "Length"); + } + + [Test] + public void PersonToString () + { + TestRuntime.CheckAddressBookPermission (); + using (var person = new ABPerson ()) { + person.FirstName = "Test"; + person.LastName = "Person"; + var str = person.ToString (); + Assert.NotNull (str, "ToString"); + } + } + + [Test] + public void GetImage_NoImage () + { + TestRuntime.CheckAddressBookPermission (); + using (var person = new ABPerson ()) { + Assert.IsFalse (person.HasImage, "HasImage"); + Assert.IsNull (person.Image, "Image"); + Assert.IsNull (person.GetImage (ABPersonImageFormat.Thumbnail), "GetImage"); + } + } + + [Test] + public void GetLinkedPeople () + { + TestRuntime.CheckAddressBookPermission (); + using (var person = new ABPerson ()) { + var linked = person.GetLinkedPeople (); + // A new person not in the address book may return null or empty + Assert.IsTrue (linked is null || linked.Length >= 0, "GetLinkedPeople"); + } + } + + [Test] + public void CreateFromVCard () + { + TestRuntime.CheckAddressBookPermission (); + var vcard = "BEGIN:VCARD\nVERSION:3.0\nFN:Test Person\nN:Person;Test;;;\nEND:VCARD\n"; + using (var data = NSData.FromString (vcard)) { + var people = ABPerson.CreateFromVCard (null, data); + Assert.NotNull (people, "people"); + Assert.That (people.Length, Is.GreaterThan (0), "Length"); + } + } + + [Test] + public void PropertyToString_FirstName () + { + TestRuntime.CheckAddressBookPermission (); + using (var person = new ABPerson ()) { + person.FirstName = "TestFirst"; + Assert.AreEqual ("TestFirst", person.FirstName, "FirstName"); + } + } + + [Test] + public void MultiValueLabel () + { + TestRuntime.CheckAddressBookPermission (); + using (var person = new ABPerson ()) { + var phones = new ABMutableStringMultiValue (); + phones.Add ("555-1234", ABPersonPhoneLabel.Mobile); + person.SetPhones (phones); + + var allPhones = person.GetPhones (); + Assert.That (allPhones.Count, Is.GreaterThan (0), "Count"); + Assert.NotNull (allPhones [0].Label, "Label"); + } + } + + [Test] + public void MultiValueGetValues () + { + TestRuntime.CheckAddressBookPermission (); + using (var person = new ABPerson ()) { + var phones = new ABMutableStringMultiValue (); + phones.Add ("555-1234", ABPersonPhoneLabel.Mobile); + phones.Add ("555-5678", ABPersonPhoneLabel.Main); + person.SetPhones (phones); + + var allPhones = person.GetPhones (); + var values = allPhones.GetValues (); + Assert.NotNull (values, "values"); + Assert.That (values.Length, Is.EqualTo (2), "Length"); + } + } } } diff --git a/tests/monotouch-test/CoreFoundation/BundleTest.cs b/tests/monotouch-test/CoreFoundation/BundleTest.cs index 85024aa0ba3c..69246f32ae6e 100644 --- a/tests/monotouch-test/CoreFoundation/BundleTest.cs +++ b/tests/monotouch-test/CoreFoundation/BundleTest.cs @@ -330,6 +330,16 @@ public void TestGetInfoDictionaryNull () Assert.Throws (() => CFBundle.GetInfoDictionary (null)); } + [Test] + public void TestGetInfoDictionary () + { + var main = CFBundle.GetMain (); + Assert.NotNull (main.Url, "Url"); + var dict = CFBundle.GetInfoDictionary (main.Url); + Assert.NotNull (dict, "GetInfoDictionary"); + Assert.That (dict.Count, Is.GreaterThan ((nuint) 0), "Count"); + } + [Test] public void GetLocalizedString () { diff --git a/tests/monotouch-test/CoreGraphics/CGEventTests.cs b/tests/monotouch-test/CoreGraphics/CGEventTests.cs index 0472e7b7bf78..a1ba48dee301 100644 --- a/tests/monotouch-test/CoreGraphics/CGEventTests.cs +++ b/tests/monotouch-test/CoreGraphics/CGEventTests.cs @@ -118,6 +118,15 @@ public void PostToPSN () [DllImport ("/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices")] static extern int GetProcessForPID (int pid, out IntPtr psn); + + [Test] + public void ToData () + { + using var evt = new CGEvent (null, CGScrollEventUnit.Pixel, 0); + using var data = evt.ToData (); + Assert.NotNull (data, "data"); + Assert.That (data.Length, Is.GreaterThan ((nuint) 0), "Length"); + } #endif // __MACOS__ || __MACCATALYST__ } } diff --git a/tests/monotouch-test/CoreServices/HttpMessageTest.cs b/tests/monotouch-test/CoreServices/HttpMessageTest.cs index fe73ce19ab8f..825d1cba566b 100644 --- a/tests/monotouch-test/CoreServices/HttpMessageTest.cs +++ b/tests/monotouch-test/CoreServices/HttpMessageTest.cs @@ -62,6 +62,17 @@ public void CreateRequest10 () } } + [Test] + public void GetAllHeaderFields () + { + using (var m = CFHTTPMessage.CreateRequest (NetworkResources.XamarinUri, "GET", new Version (1, 1))) { + m.SetHeaderFieldValue ("X-Test", "value"); + var headers = m.GetAllHeaderFields (); + Assert.NotNull (headers, "headers"); + Assert.That (headers.Count, Is.GreaterThan ((nuint) 0), "Count"); + } + } + [Test] public void CreateResponseAuth () { diff --git a/tests/monotouch-test/CoreText/FontTest.cs b/tests/monotouch-test/CoreText/FontTest.cs index 3d90d0211117..ed4513a373d6 100644 --- a/tests/monotouch-test/CoreText/FontTest.cs +++ b/tests/monotouch-test/CoreText/FontTest.cs @@ -153,6 +153,16 @@ public void GetTypographicBoundsForAdaptiveImageProvider () Assert.AreEqual (0, provider.Count, "#Count"); } + [Test] + public void GetAttribute () + { + using (var font = new CTFont ("HoeflerText-Regular", 10, CTFontOptions.Default)) { + using (var name = font.GetAttribute (CTFontDescriptorAttributeKey.Name)) { + Assert.NotNull (name, "Name"); + } + } + } + class AdaptiveImageProvider : NSObject, ICTAdaptiveImageProviding { public int Count; public CGImage? GetImage (CGSize proposedSize, nfloat scaleFactor, out CGPoint imageOffset, out CGSize imageSize) diff --git a/tests/monotouch-test/MobileCoreServices/UTTypeTest.cs b/tests/monotouch-test/MobileCoreServices/UTTypeTest.cs index 3b0eef7a9a9e..7bb9e3783c20 100644 --- a/tests/monotouch-test/MobileCoreServices/UTTypeTest.cs +++ b/tests/monotouch-test/MobileCoreServices/UTTypeTest.cs @@ -167,5 +167,35 @@ public void Equals () Assert.False (UTType.Equals (UTType.PDF, null), "PDF-null"); Assert.True (UTType.Equals (UTType.PDF, UTType.PDF), "PDF-PDF"); } + + [Test] + public void CreateAllIdentifiers () + { + TestRuntime.AssertIfSimulatorThenARM64 (); + + var result = UTType.CreateAllIdentifiers (UTType.TagClassFilenameExtension, "pdf", null); + Assert.NotNull (result, "result"); + Assert.That (result.Length, Is.GreaterThan (0), "Length"); + } + + [Test] + public void CopyAllTags () + { + TestRuntime.AssertIfSimulatorThenARM64 (); + + var result = UTType.CopyAllTags (UTType.PDF, UTType.TagClassFilenameExtension); + Assert.NotNull (result, "result"); + Assert.That (result.Length, Is.GreaterThan (0), "Length"); + } + + [Test] + public void GetDescription () + { + TestRuntime.AssertIfSimulatorThenARM64 (); + + var result = UTType.GetDescription (UTType.PDF); + Assert.NotNull (result, "result"); + Assert.That (result.Length, Is.GreaterThan (0), "Length"); + } } } diff --git a/tests/sharpie/Sharpie.Bind.Tests/ObjectiveCClass.cs b/tests/sharpie/Sharpie.Bind.Tests/ObjectiveCClass.cs index 839e682c8404..3ef19a810e1b 100644 --- a/tests/sharpie/Sharpie.Bind.Tests/ObjectiveCClass.cs +++ b/tests/sharpie/Sharpie.Bind.Tests/ObjectiveCClass.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using Xamarin; +using Xamarin.Tests; using Xamarin.Utils; namespace Sharpie.Bind.Tests; @@ -24,6 +25,7 @@ public void ErrorNoNSObject () File.WriteAllText (tmpfile, code); binder.SourceFile = tmpfile; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); var bindings = binder.BindInOrOut (); @@ -48,6 +50,7 @@ @interface MyClass { binder.SplitDocuments = false; binder.SourceFile = tmpfile; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); var bindings = binder.BindInOrOut (); @@ -86,6 +89,7 @@ @interface MyClass { binder.SplitDocuments = false; binder.SourceFramework = frameworkDir; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); var bindings = binder.BindInOrOut (); @@ -127,6 +131,7 @@ @interface Widget { binder.SplitDocuments = false; binder.SourceFramework = frameworkDir; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); var bindings = binder.BindInOrOut (); @@ -169,6 +174,7 @@ @interface MyClass { binder.SourceFramework = frameworkDir; binder.Namespace = "CustomNamespace"; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); var bindings = binder.BindInOrOut (); @@ -202,6 +208,7 @@ public void BindFramework_ErrorBothSourceFileAndFramework () binder.SourceFile = tmpfile; binder.SourceFramework = frameworkDir; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); var bindings = binder.BindInOrOut (); @@ -217,6 +224,7 @@ public void BindFramework_ErrorNonExistentFramework () var frameworkDir = Path.Combine (tmpdir, "NonExistent.framework"); binder.SourceFramework = frameworkDir; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); var bindings = binder.BindInOrOut (); @@ -233,6 +241,7 @@ public void BindFramework_ErrorNoUmbrellaHeaderOrModuleMap () Directory.CreateDirectory (frameworkDir); binder.SourceFramework = frameworkDir; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); var bindings = binder.BindInOrOut (); @@ -274,6 +283,7 @@ @interface MyClass { binder.SplitDocuments = false; binder.SourceFramework = frameworkDir; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.MacOSX); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (ApplePlatform.MacOSX); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); // Don't set binder.Sdk - it should be read from the Info.plist @@ -328,6 +338,7 @@ @interface MyClass { binder.SplitDocuments = false; binder.SourceFramework = frameworkDir; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.MacOSX); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (ApplePlatform.MacOSX); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); var bindings = binder.BindInOrOut (); @@ -368,6 +379,7 @@ umbrella header "ModKit.h" binder.SplitDocuments = false; binder.SourceFramework = frameworkDir; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); // Do NOT manually set ClangArguments with -F — it should be auto-added. @@ -410,6 +422,7 @@ @interface MyClass { File.WriteAllText (tmpfile, code); binder.SourceFile = tmpfile; binder.OutputDirectory = tmpdir; + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); var bindings = binder.BindInOrOut (); diff --git a/tests/sharpie/Sharpie.Bind.Tests/OnDiskTests.cs b/tests/sharpie/Sharpie.Bind.Tests/OnDiskTests.cs index f663fb33052a..be0db1ff8e84 100644 --- a/tests/sharpie/Sharpie.Bind.Tests/OnDiskTests.cs +++ b/tests/sharpie/Sharpie.Bind.Tests/OnDiskTests.cs @@ -6,6 +6,7 @@ using ClangSharp.Interop; using NUnit.Framework.Constraints; using Xamarin; +using Xamarin.Tests; namespace Sharpie.Bind.Tests; @@ -150,6 +151,7 @@ void ParseBindTestImpl (string path, string variant, string bindArguments) binder.ClangArguments.AddRange (clangArguments); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); var result = binder.BindInOrOut (); var tmpdir = Cache.CreateTemporaryDirectory (); diff --git a/tests/sharpie/Sharpie.Bind.Tests/SdkDbTest.cs b/tests/sharpie/Sharpie.Bind.Tests/SdkDbTest.cs index 9f6332daa2ed..043499ac6a29 100644 --- a/tests/sharpie/Sharpie.Bind.Tests/SdkDbTest.cs +++ b/tests/sharpie/Sharpie.Bind.Tests/SdkDbTest.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using Xamarin; +using Xamarin.Tests; namespace Sharpie.Bind.Tests; @@ -70,6 +71,7 @@ public void TestSdkPath (bool usingModules, string sdk, string []? excludedFrame binder.Sdk = sdk; binder.OutputDirectory = tmpdir; binder.PlatformAssembly = Extensions.GetPlatformAssemblyPath (binder.Platform); + Configuration.IgnoreIfIgnoredPlatform (binder.Platform); binder.ClangResourceDirectory = Extensions.GetClangResourceDirectory (); var rv = binder.BindInOrOut (); rv.AssertSuccess (null); diff --git a/tests/test-libraries/Makefile b/tests/test-libraries/Makefile index 360da4b46c7d..732e37721796 100644 --- a/tests/test-libraries/Makefile +++ b/tests/test-libraries/Makefile @@ -332,6 +332,7 @@ endef $(foreach rid,$(DOTNET_RUNTIME_IDENTIFIERS),$(eval $(call SwiftTest2AddDependency,$(rid)))) # create an xcframework of frameworks +ifneq ($(XCFRAMEWORK_PLATFORMS),) define TestFrameworkXCFramework $(1)_XCFRAMEWORKS += $$(foreach xcframeworkPlatform,$$(XCFRAMEWORK_PLATFORMS),.libs/$$(xcframeworkPlatform)/$(1).framework) $(1)_XCTARGETS += $$(foreach xcframeworkPlatform,$$(XCFRAMEWORK_PLATFORMS),.libs/$$(xcframeworkPlatform)/$(1).framework.stamp) @@ -363,7 +364,9 @@ all-local:: .libs/$(1).xcframework endef $(eval $(call TestLibraryXCFramework,libtest)) $(eval $(call TestLibraryXCFramework,libtest2)) +endif # XCFRAMEWORK_PLATFORMS +ifneq ($(XCFRAMEWORK_PLATFORMS),) define ZippedXcframework .libs/$(1).xcframework.zip: .libs/$(1).xcframework $$(Q_ZIP) cd .libs && $(ZIP) -r "$$(notdir $$@)" "$$(notdir $$<)" @@ -379,6 +382,7 @@ define ZippedXcframeworkPlatformSpecific all-local:: .libs/$(3)/$(1).xcframework.zip endef $(foreach platform,$(DOTNET_PLATFORMS),$(foreach testFramework,$(TEST_FRAMEWORKS),$(eval $(call ZippedXcframeworkPlatformSpecific,$(testFramework),$(platform),$(shell echo $(platform) | tr 'A-Z' 'a-z'))))) +endif # XCFRAMEWORK_PLATFORMS include $(TOP)/mk/rules.mk diff --git a/tests/test-libraries/frameworks/Makefile b/tests/test-libraries/frameworks/Makefile index 56fa6b5fcee9..6d16358a3d6f 100644 --- a/tests/test-libraries/frameworks/Makefile +++ b/tests/test-libraries/frameworks/Makefile @@ -192,6 +192,7 @@ endef # 3: runtime identifier $(foreach name,$(NAMES),$(foreach platform,$(DOTNET_PLATFORMS),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(eval $(call FrameworkTemplate,$(name),$(DOTNET_$(rid)_SDK_PLATFORM),$(rid),$(shell echo $(name) | tr '.' '_')))))) +ifneq ($(DOTNET_PLATFORMS),) define XCTemplate .libs/$(3)/$(1).framework.stamp: $$(foreach rid,$$($(3)_XC_RUNTIMEIDENTIFIERS),.libs/$$(rid)/$(1).framework.stamp) | .libs/$(3) $$(Q) rm -Rf .libs/$(3)/$(1).framework @@ -229,6 +230,7 @@ $(foreach name,$(NAMES),$(eval $(call XCFrameworkTemplate,$(name)))) zip: $(ZIPPED_TARGETS) all-local:: $(ZIPPED_TARGETS) +endif # DOTNET_PLATFORMS define PlugInTemplate diff --git a/tests/test-libraries/nugets/Makefile b/tests/test-libraries/nugets/Makefile index 66792ab973f3..41032e37a8a8 100644 --- a/tests/test-libraries/nugets/Makefile +++ b/tests/test-libraries/nugets/Makefile @@ -1,8 +1,12 @@ TOP=../../.. + +include $(TOP)/Make.config + +ifneq ($(DOTNET_PLATFORMS),) SUBDIRS = \ FrameworksInRuntimesNativeDirectory \ DynamicLibrariesInRuntimesNativeDirectory \ XCFrameworkWithStaticLibraryInRuntimesNativeDirectory \ XCFrameworkWithSymlinks \ -include $(TOP)/Make.config +endif diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore index e815630e7b2b..fc6cd3acc842 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore @@ -142,7 +142,6 @@ !extra-null-allowed! 'UIKit.UIView UIKit.UIScreen::SnapshotView(System.Boolean)' has a extraneous [NullAllowed] on return type # Initial result from new rule missing-null-allowed -!missing-null-allowed! 'Foundation.NSArray Foundation.NSBundle::LoadNib(System.String,Foundation.NSObject,Foundation.NSDictionary)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSAttributedString UIKit.UIPickerViewDelegate::GetAttributedTitle(UIKit.UIPickerView,System.IntPtr,System.IntPtr)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSProgress UIKit.UIDocument::get_Progress()' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.Boolean UIKit.UIManagedDocument::ConfigurePersistentStoreCoordinator(Foundation.NSUrl,System.String,System.String,Foundation.NSDictionary,Foundation.NSError)' is missing an [NullAllowed] on parameter #2 diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-Foundation.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-Foundation.ignore index d285ab995faf..de328141b7b0 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-Foundation.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-Foundation.ignore @@ -913,9 +913,6 @@ !missing-null-allowed! 'Foundation.INSUrlProtocolClient Foundation.NSUrlProtocol::get_Client()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSAttributedString Foundation.NSFormatter::GetAttributedString(Foundation.NSObject,Foundation.NSDictionary`2)' is missing an [NullAllowed] on parameter #1 !missing-null-allowed! 'Foundation.NSAttributedString Foundation.NSFormatter::GetAttributedString(Foundation.NSObject,Foundation.NSDictionary`2)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSBundle Foundation.NSBundle::FromIdentifier(System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSBundle Foundation.NSBundle::FromPath(System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSBundle Foundation.NSBundle::FromUrl(Foundation.NSUrl)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSCachedUrlResponse Foundation.NSUrlCache::CachedResponseForRequest(Foundation.NSUrlRequest)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSCachedUrlResponse Foundation.NSUrlProtocol::get_CachedResponse()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSData Foundation.NSData::FromFile(System.String)' is missing an [NullAllowed] on return type @@ -951,7 +948,6 @@ !missing-null-allowed! 'Foundation.NSDecimalNumber Foundation.NSDecimalNumber::Multiply(Foundation.NSDecimalNumber,Foundation.NSObject)' is missing an [NullAllowed] on parameter #1 !missing-null-allowed! 'Foundation.NSDecimalNumber Foundation.NSDecimalNumber::Rounding(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'Foundation.NSDecimalNumber Foundation.NSDecimalNumber::Subtract(Foundation.NSDecimalNumber,Foundation.NSObject)' is missing an [NullAllowed] on parameter #1 -!missing-null-allowed! 'Foundation.NSDictionary Foundation.NSBundle::get_InfoDictionary()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSDictionary Foundation.NSCachedUrlResponse::get_UserInfo()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSDictionary Foundation.NSDirectoryEnumerator::get_DirectoryAttributes()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSDictionary Foundation.NSDirectoryEnumerator::get_FileAttributes()' is missing an [NullAllowed] on return type @@ -998,7 +994,6 @@ !missing-null-allowed! 'Foundation.NSNumber[] Foundation.NSHttpCookie::get_PortList()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSObject Foundation.NSAttributedString::GetAttribute(System.String,System.IntPtr,Foundation.NSRange&)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSObject Foundation.NSAttributedString::GetAttribute(System.String,System.IntPtr,Foundation.NSRange&,Foundation.NSRange)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSObject Foundation.NSBundle::ObjectForInfoDictionary(System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSObject Foundation.NSCache::ObjectForKey(Foundation.NSObject)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSObject Foundation.NSEnumerator::NextObject()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSObject Foundation.NSException::get_UserInfo()' is missing an [NullAllowed] on return type @@ -1035,26 +1030,6 @@ !missing-null-allowed! 'Foundation.NSTimeZone Foundation.NSTimeZone::FromName(System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSTimeZone Foundation.NSTimeZone::FromName(System.String,Foundation.NSData)' is missing an [NullAllowed] on parameter #1 !missing-null-allowed! 'Foundation.NSTimeZone Foundation.NSTimeZone::FromName(System.String,Foundation.NSData)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::get_AppStoreReceiptUrl()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::get_BuiltInPluginsUrl()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::get_ExecutableUrl()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::get_PrivateFrameworksUrl()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::get_ResourceUrl()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::get_SharedFrameworksUrl()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::get_SharedSupportUrl()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String)' is missing an [NullAllowed] on parameter #1 -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String,System.String)' is missing an [NullAllowed] on parameter #1 -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String,System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String,System.String,Foundation.NSUrl)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String,System.String,Foundation.NSUrl)' is missing an [NullAllowed] on parameter #1 -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String,System.String,Foundation.NSUrl)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String,System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String,System.String,System.String)' is missing an [NullAllowed] on parameter #1 -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForResource(System.String,System.String,System.String,System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::UrlForAuxiliaryExecutable(System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrl Foundation.NSFileManager::GetContainerUrl(System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrl Foundation.NSFileManager::GetUrl(Foundation.NSSearchPathDirectory,Foundation.NSSearchPathDomain,Foundation.NSUrl,System.Boolean,Foundation.NSError&)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrl Foundation.NSFileManager::GetUrlForPublishingUbiquitousItem(Foundation.NSUrl,Foundation.NSDate&,Foundation.NSError&)' is missing an [NullAllowed] on return type @@ -1078,12 +1053,6 @@ !missing-null-allowed! 'Foundation.NSUrl Foundation.NSUrlRequest::get_MainDocumentURL()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrl Foundation.NSUrlRequest::get_Url()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrl Foundation.NSUrlResponse::get_Url()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl[] Foundation.NSBundle::GetUrlsForResourcesWithExtension(System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'Foundation.NSUrl[] Foundation.NSBundle::GetUrlsForResourcesWithExtension(System.String,System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl[] Foundation.NSBundle::GetUrlsForResourcesWithExtension(System.String,System.String,Foundation.NSUrl)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'Foundation.NSUrl[] Foundation.NSBundle::GetUrlsForResourcesWithExtension(System.String,System.String,Foundation.NSUrl)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl[] Foundation.NSBundle::GetUrlsForResourcesWithExtension(System.String,System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'Foundation.NSUrl[] Foundation.NSBundle::GetUrlsForResourcesWithExtension(System.String,System.String,System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrl[] Foundation.NSFileManager::GetDirectoryContent(Foundation.NSUrl,Foundation.NSArray,Foundation.NSDirectoryEnumerationOptions,Foundation.NSError&)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrl[] Foundation.NSFileManager::GetMountedVolumes(Foundation.NSArray,Foundation.NSVolumeEnumerationOptions)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrlComponents Foundation.NSUrlComponents::FromString(System.String)' is missing an [NullAllowed] on return type @@ -1095,8 +1064,6 @@ !missing-null-allowed! 'Foundation.NSUrlSessionUploadTask Foundation.NSUrlSession::CreateUploadTask(Foundation.NSUrlRequest,Foundation.NSData,Foundation.NSUrlSessionResponse)' is missing an [NullAllowed] on parameter #1 !missing-null-allowed! 'Foundation.NSValue Foundation.NSValue::ValueFromNonretainedObject(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'Foundation.NSXpcConnection Foundation.NSXpcConnection::get_CurrentConnection()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'ObjCRuntime.Class Foundation.NSBundle::ClassNamed(System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'ObjCRuntime.Class Foundation.NSBundle::get_PrincipalClass()' is missing an [NullAllowed] on return type !missing-null-allowed! 'ObjCRuntime.Class Foundation.NSKeyedUnarchiverDelegate::CannotDecodeClass(Foundation.NSKeyedUnarchiver,System.String,System.String[])' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.Boolean Foundation.NSFileManager::CreateFile(System.String,Foundation.NSData,Foundation.NSDictionary)' is missing an [NullAllowed] on parameter #1 !missing-null-allowed! 'System.Boolean Foundation.NSPredicate::EvaluateWithObject(Foundation.NSObject)' is missing an [NullAllowed] on parameter #0 @@ -1104,25 +1071,6 @@ !missing-null-allowed! 'System.Boolean Foundation.NSPredicate::EvaluateWithObject(Foundation.NSObject,Foundation.NSDictionary)' is missing an [NullAllowed] on parameter #1 !missing-null-allowed! 'System.Boolean Foundation.NSUrl::SetResourceValue(Foundation.NSObject,Foundation.NSString,Foundation.NSError&)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.UIntPtr Foundation.NSString::DetectStringEncoding(Foundation.NSData,Foundation.NSDictionary,System.String&,System.Boolean&)' is missing an [NullAllowed] on parameter #1 -!missing-null-allowed! 'System.String Foundation.NSBundle::get_BuiltinPluginsPath()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::get_BundleIdentifier()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::get_DevelopmentLocalization()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::get_ExecutablePath()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::get_PrivateFrameworksPath()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::get_ResourcePath()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::get_SharedFrameworksPath()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::get_SharedSupportPath()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForAuxiliaryExecutable(System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForResource(System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForResource(System.String,System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForResource(System.String,System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForResource(System.String,System.String,System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForResource(System.String,System.String,System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForResource(System.String,System.String,System.String,System.String)' is missing an [NullAllowed] on parameter #2 -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForResource(System.String,System.String,System.String,System.String)' is missing an [NullAllowed] on parameter #3 -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForResource(System.String,System.String,System.String,System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForResourceAbsolute(System.String,System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForResourceAbsolute(System.String,System.String,System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.String Foundation.NSDate::DescriptionWithLocale(Foundation.NSLocale)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.String Foundation.NSDateComponentsFormatter::LocalizedStringFromDateComponents(Foundation.NSDateComponents,Foundation.NSDateComponentsFormatterUnitsStyle)' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.String Foundation.NSDateComponentsFormatter::StringForObjectValue(Foundation.NSObject)' is missing an [NullAllowed] on return type @@ -1167,9 +1115,6 @@ !missing-null-allowed! 'System.String Foundation.NSUrlResponse::get_SuggestedFilename()' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.String Foundation.NSUrlResponse::get_TextEncodingName()' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.String Foundation.NSXpcConnection::get_ServiceName()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String[] Foundation.NSBundle::GetPathsForResources(System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.String[] Foundation.NSBundle::PathsForResources(System.String,System.String)' is missing an [NullAllowed] on parameter #0 -!missing-null-allowed! 'System.String[] Foundation.NSBundle::PathsForResources(System.String,System.String,System.String)' is missing an [NullAllowed] on parameter #0 !missing-null-allowed! 'System.String[] Foundation.NSError::get_LocalizedRecoveryOptions()' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.String[] Foundation.NSFileManager::ComponentsToDisplay(System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.String[] Foundation.NSFileManager::GetDirectoryContent(System.String,Foundation.NSError&)' is missing an [NullAllowed] on return type diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore index 9d5864e86cad..aba256ee0a23 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore @@ -146,7 +146,6 @@ !extra-null-allowed! 'UIKit.UIView UIKit.UIScreen::SnapshotView(System.Boolean)' has a extraneous [NullAllowed] on return type # Initial result from new rule missing-null-allowed -!missing-null-allowed! 'Foundation.NSArray Foundation.NSBundle::LoadNib(System.String,Foundation.NSObject,Foundation.NSDictionary)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSAttributedString UIKit.UIPickerViewDelegate::GetAttributedTitle(UIKit.UIPickerView,System.IntPtr,System.IntPtr)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSProgress UIKit.UIDocument::get_Progress()' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.Boolean UIKit.UIManagedDocument::ConfigurePersistentStoreCoordinator(Foundation.NSUrl,System.String,System.String,Foundation.NSDictionary,Foundation.NSError)' is missing an [NullAllowed] on parameter #2 diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore index e275a38d4b9f..9a3f3b3cbe9e 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore @@ -291,7 +291,6 @@ !missing-null-allowed! 'AppKit.NSImage AppKit.NSSharingServiceDelegate::TransitionImageForShareItem(AppKit.NSSharingService,AppKit.INSPasteboardWriting,CoreGraphics.CGRect)' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSImage AppKit.NSTableView::GetIndicatorImage(AppKit.NSTableColumn)' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSImage AppKit.NSWorkspace::IconForFiles(System.String[])' is missing an [NullAllowed] on return type -!missing-null-allowed! 'AppKit.NSImage Foundation.NSBundle::ImageForResource(System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSImageRep AppKit.NSImage::BestRepresentation(CoreGraphics.CGRect,AppKit.NSGraphicsContext,Foundation.NSDictionary)' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSImageRep AppKit.NSImageRep::ImageRepFromFile(System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'AppKit.NSImageRep AppKit.NSImageRep::ImageRepFromPasteboard(AppKit.NSPasteboard)' is missing an [NullAllowed] on return type @@ -415,7 +414,6 @@ !missing-null-allowed! 'Foundation.NSArray AppKit.NSWindow::WindowNumbersWithOptions(AppKit.NSWindowNumberListOptions)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSArray[] AppKit.NSFontManager::AvailableMembersOfFontFamily(System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSAttributedString AppKit.NSHelpManager::Context(Foundation.NSObject)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSAttributedString Foundation.NSBundle::GetContextHelp(System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSBundle AppKit.NSViewController::get_NibBundle()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSData AppKit.NSColorSpace::get_ICCProfileData()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSData AppKit.NSDocument::GetAsData(System.String,Foundation.NSError&)' is missing an [NullAllowed] on return type @@ -513,7 +511,6 @@ !missing-null-allowed! 'Foundation.NSUrl AppKit.NSWorkspace::DesktopImageUrl(AppKit.NSScreen)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrl AppKit.NSWorkspace::UrlForApplication(Foundation.NSUrl)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrl AppKit.NSWorkspace::UrlForApplication(System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'Foundation.NSUrl Foundation.NSBundle::GetUrlForImageResource(System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrl[] AppKit.NSDocumentController::UrlsFromRunningOpenPanel()' is missing an [NullAllowed] on return type !missing-null-allowed! 'Foundation.NSUrl[] AppKit.NSSharingService::get_AttachmentFileUrls()' is missing an [NullAllowed] on return type !missing-null-allowed! 'ObjCRuntime.Class AppKit.NSDocumentController::DocumentClassForType(System.String)' is missing an [NullAllowed] on return type @@ -609,8 +606,6 @@ !missing-null-allowed! 'System.String AppKit.NSViewController::get_NibName()' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.String AppKit.NSWindowController::get_WindowNibName()' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.String AppKit.NSWindowController::get_WindowNibPath()' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForImageResource(System.String)' is missing an [NullAllowed] on return type -!missing-null-allowed! 'System.String Foundation.NSBundle::PathForSoundResource(System.String)' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.String[] AppKit.NSFontManager::AvailableFontNamesWithTraits(AppKit.NSFontTraitMask)' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.String[] AppKit.NSPasteboard::get_Types()' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.String[] AppKit.NSSpellChecker::CompletionsForPartialWordRange(Foundation.NSRange,System.String,System.String,System.IntPtr)' is missing an [NullAllowed] on return type diff --git a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-UIKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-UIKit.ignore index 62183597a9dd..de00349fbb7a 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-UIKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-UIKit.ignore @@ -178,7 +178,6 @@ !extra-null-allowed! 'UIKit.UIView UIKit.UIScreen::SnapshotView(System.Boolean)' has a extraneous [NullAllowed] on return type # Initial result from new rule missing-null-allowed -!missing-null-allowed! 'Foundation.NSArray Foundation.NSBundle::LoadNib(System.String,Foundation.NSObject,Foundation.NSDictionary)' is missing an [NullAllowed] on return type !missing-null-allowed! 'System.Boolean UIKit.UIScrollView::TouchesShouldBegin(Foundation.NSSet,UIKit.UIEvent,UIKit.UIView)' is missing an [NullAllowed] on parameter #1 !missing-null-allowed! 'System.Boolean UIKit.UISplitViewControllerDelegate::EventShowDetailViewController(UIKit.UISplitViewController,UIKit.UIViewController,Foundation.NSObject)' is missing an [NullAllowed] on parameter #2 !missing-null-allowed! 'System.Boolean UIKit.UISplitViewControllerDelegate::EventShowViewController(UIKit.UISplitViewController,UIKit.UIViewController,Foundation.NSObject)' is missing an [NullAllowed] on parameter #2 diff --git a/tools/devops/automation/build-pipeline.yml b/tools/devops/automation/build-pipeline.yml index 8d6144a93a56..97824c8abe3b 100644 --- a/tools/devops/automation/build-pipeline.yml +++ b/tools/devops/automation/build-pipeline.yml @@ -74,6 +74,7 @@ trigger: - refs/heads/locfiles/* - refs/heads/copilot/* - refs/heads/dependabot/* + - refs/heads/merge/* paths: exclude: diff --git a/tools/devops/automation/build-pull-request.yml b/tools/devops/automation/build-pull-request.yml index 4250b5c5f5ac..66cb04b28378 100644 --- a/tools/devops/automation/build-pull-request.yml +++ b/tools/devops/automation/build-pull-request.yml @@ -60,6 +60,7 @@ trigger: - refs/heads/locfiles/* - refs/heads/copilot/* - refs/heads/dependabot/* + - refs/heads/merge/* pr: autoCancel: true diff --git a/tools/devops/automation/scripts/Governance.psm1 b/tools/devops/automation/scripts/Governance.psm1 index 3e9db8fee726..450a2ee1a574 100644 --- a/tools/devops/automation/scripts/Governance.psm1 +++ b/tools/devops/automation/scripts/Governance.psm1 @@ -44,7 +44,7 @@ function Get-APIScanConfiguration { $EnabledPlatforms ) - $arrEnabledPlatforms = -split $EnabledPlatforms + $arrEnabledPlatforms = @(-split $EnabledPlatforms | Where-Object { $_ }) $config = [APIScanConfiguration]::new($arrEnabledPlatforms) return $config.Create() } diff --git a/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 b/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 index 574f3c5b9ec2..2fca912bec5b 100644 --- a/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 +++ b/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 @@ -217,8 +217,31 @@ Describe 'Get-TestConfiguration' { It 'succeeds when no dotnet platforms enabled' { $EnabledPlatforms = "" + $TestConfigurationsWithSharpie = @" +[ + { + "label": "cecil", + "splitByPlatforms": "false", + "testPrefix": "test-prefix_", + "testStage": "simulator", + }, + { + "label": "sharpie", + "splitByPlatforms": "false", + "supportsNoPlatforms": "true", + "testPrefix": "simulator_tests", + }, + { + "label": "dotnettests", + "splitByPlatforms": "true", + "needsMultiplePlatforms": "true", + "testPrefix": "test-prefix_", + } +] +"@ + $config = Get-TestConfiguration ` - -TestConfigurations $TestConfigurations ` + -TestConfigurations $TestConfigurationsWithSharpie ` -SupportedPlatforms $SupportedPlatforms ` -EnabledPlatforms $EnabledPlatforms ` -TestsLabels "extra-test-labels" ` @@ -226,13 +249,13 @@ Describe 'Get-TestConfiguration' { Write-Host $config $config | Should -Be @" { - "cecil": { - "LABEL": "cecil", - "TESTS_LABELS": "extra-test-labels,run-cecil-tests", - "TEST_STAGE": "simulator", - "LABEL_WITH_PLATFORM": "cecil", - "STATUS_CONTEXT": "status-context - cecil", - "TEST_PREFIX": "test-prefix_cecil", + "sharpie": { + "LABEL": "sharpie", + "TESTS_LABELS": "extra-test-labels,run-sharpie-tests", + "TEST_STAGE": "simulator_tests", + "LABEL_WITH_PLATFORM": "sharpie", + "STATUS_CONTEXT": "status-context - sharpie", + "TEST_PREFIX": "simulator_testssharpie", "TEST_PLATFORM": "" } } @@ -335,4 +358,75 @@ Describe 'Get-TestConfiguration' { "@ } + Context 'macOS tests excluded when platforms disabled' { + It "excludes mac tests when neither macOS nor MacCatalyst is enabled" { + $macTestConfigs = @" +[ + { + "label": "cecil", + "splitByPlatforms": "false", + "testPrefix": "simulator_tests" + }, + { + "label": "mac_monterey", + "displayName": "Tests on macOS Monterey (12)", + "splitByPlatforms": "false", + "testPrefix": "mac_12_m1", + "testStage": "mac_12_m1", + "isMacTest": true + } +] +"@ + $supportedPlatforms = @" +[ + { "platform": "iOS" }, + { "platform": "tvOS" } +] +"@ + # Only tvOS enabled — no macOS or MacCatalyst + $result = Get-TestConfiguration ` + -TestConfigurations $macTestConfigs ` + -SupportedPlatforms $supportedPlatforms ` + -EnabledPlatforms "tvOS" ` + -TestsLabels "test-labels" ` + -StatusContext "ctx" ` + -StageFilter "" + + $parsed = $result | ConvertFrom-Json + # cecil should be present, mac_monterey should not + $parsed.cecil | Should -Not -BeNullOrEmpty + $parsed.PSObject.Properties.Name | Should -Not -Contain "mac_monterey" + } + + It "includes mac tests when macOS is enabled" { + $macTestConfigs = @" +[ + { + "label": "mac_monterey", + "displayName": "Tests on macOS Monterey (12)", + "splitByPlatforms": "false", + "testPrefix": "mac_12_m1", + "testStage": "mac_12_m1", + "isMacTest": true + } +] +"@ + $supportedPlatforms = @" +[ + { "platform": "macOS" } +] +"@ + $result = Get-TestConfiguration ` + -TestConfigurations $macTestConfigs ` + -SupportedPlatforms $supportedPlatforms ` + -EnabledPlatforms "macOS" ` + -TestsLabels "test-labels" ` + -StatusContext "ctx" ` + -StageFilter "" + + $parsed = $result | ConvertFrom-Json + $parsed.mac_monterey | Should -Not -BeNullOrEmpty + } + } + } diff --git a/tools/devops/automation/scripts/TestConfiguration.psm1 b/tools/devops/automation/scripts/TestConfiguration.psm1 index 148db8f7e1eb..ccd57ca19f7e 100644 --- a/tools/devops/automation/scripts/TestConfiguration.psm1 +++ b/tools/devops/automation/scripts/TestConfiguration.psm1 @@ -42,6 +42,15 @@ class TestConfiguration { Write-Host "Test $label with testStage '$testStage' is included, because there's no stage filter set" } + # Skip macOS tests if neither macOS nor MacCatalyst platforms are enabled + if ($config.isMacTest -eq "true" -or $config.isMacTest -eq $true) { + $hasMacPlatform = ($this.enabledPlatforms -contains "macOS") -or ($this.enabledPlatforms -contains "MacCatalyst") + if (-not $hasMacPlatform) { + Write-Host "Skipping mac test $label - neither macOS nor MacCatalyst platforms are enabled" + continue + } + } + $vars = [ordered]@{} # set common variables $vars["LABEL"] = $label @@ -95,6 +104,10 @@ class TestConfiguration { $rv[$platformLabel] = $platformVars } } else { + if ($this.enabledPlatforms.Length -eq 0 -and $config.supportsNoPlatforms -ne "true" -and $config.supportsNoPlatforms -ne $true) { + Write-Host "No enabled platforms, skipping test $label (supportsNoPlatforms=$($config.supportsNoPlatforms))" + continue + } # set non-platform specific variables $vars["LABEL_WITH_PLATFORM"] = "$label" $vars["STATUS_CONTEXT"] = "$($this.statusContext) - $($label)" diff --git a/tools/devops/automation/scripts/TestResults.Tests.ps1 b/tools/devops/automation/scripts/TestResults.Tests.ps1 index 6178bd86a398..1a27744780c7 100644 --- a/tools/devops/automation/scripts/TestResults.Tests.ps1 +++ b/tools/devops/automation/scripts/TestResults.Tests.ps1 @@ -908,8 +908,8 @@ Describe "TestResults tests" { ### :x: dotnettests tests (MacCatalyst) -5 tests failed, 6 tests passed.
    +5 tests failed, 6 tests passed.
    @@ -1002,9 +1002,9 @@ Describe "TestResults tests" { ### :x: dotnettests tests (MacCatalyst) -1 tests failed, 0 tests passed.
    -# :tada: All 5 tests passed :tada: +1 tests failed, 0 tests passed. +Test results reported success, but the tests job failed.
    [Html Report (VSDrops)](vsdropsIndex/testStagedotnettests_maccatalyst-1/;/tests/vsdrops_index.html) [Download](/_apis/build/builds//artifacts?artifactName=HtmlReport-testStagedotnettests_maccatalyst-1&api-version=6.0&`$format=zip) diff --git a/tools/devops/automation/scripts/TestResults.psm1 b/tools/devops/automation/scripts/TestResults.psm1 index 1e3693b374d2..97c23e6031be 100644 --- a/tools/devops/automation/scripts/TestResults.psm1 +++ b/tools/devops/automation/scripts/TestResults.psm1 @@ -447,17 +447,21 @@ class ParallelTestsResults { $resultLines = @("Test has no summary file.") } - if ($addSummary) { - $stringBuilder.AppendLine("$($result.Failed) tests failed, $($result.Passed) tests passed.") - } if ($addDetails) { $stringBuilder.AppendLine("
    ") } - if ($startLine -eq -1) { - $startLine = 0 + if ($addSummary) { + $stringBuilder.AppendLine("$($result.Failed) tests failed, $($result.Passed) tests passed.") } - for ($i = $startLine; $i -lt $resultLines.Length; $i++) { - $stringBuilder.AppendLine($resultLines[$i]) + if ($startLine -eq -1) { + # No
    , , or ## Failed tests found in the file. + # The file likely has the success format (e.g. "# :tada: All N tests passed :tada:"), + # which would be misleading in a failure section. Show a job failure message instead. + $stringBuilder.AppendLine("Test results reported success, but the tests job failed.") + } else { + for ($i = $startLine; $i -lt $resultLines.Length; $i++) { + $stringBuilder.AppendLine($resultLines[$i]) + } } if ($addDetails) { $stringBuilder.AppendLine("
    ") diff --git a/tools/devops/automation/scripts/bash/build-nugets.sh b/tools/devops/automation/scripts/bash/build-nugets.sh index 2bd436c4cf08..d564e8416479 100755 --- a/tools/devops/automation/scripts/bash/build-nugets.sh +++ b/tools/devops/automation/scripts/bash/build-nugets.sh @@ -15,8 +15,13 @@ mkdir -p ../package/ rm -rf ../symbols/ mkdir -p ../symbols/ cp -c "$DOTNET_NUPKG_DIR"/*.nupkg ../package/ -cp -c dotnet/nupkgs/*.symbols.nupkg ../symbols/ -cp -c "$DOTNET_NUPKG_DIR"/vs-workload.props ../package/ +mv ../package/*.symbols.nupkg ../symbols/ +if compgen -G 'dotnet/nupkgs/*.symbols.nupkg' > /dev/null; then + cp -c dotnet/nupkgs/*.symbols.nupkg ../symbols/ +fi +if test -f "$DOTNET_NUPKG_DIR"/vs-workload.props; then + cp -c "$DOTNET_NUPKG_DIR"/vs-workload.props ../package/ +fi cp -c dotnet/Workloads/SignList.xml ../package/ cp -c dotnet/Workloads/SignList.targets ../package/ cp -c dotnet/Workloads/SignVerifyIgnore.txt ../package/ diff --git a/tools/devops/automation/scripts/bash/configure-decisions.sh b/tools/devops/automation/scripts/bash/configure-decisions.sh index 669cbc6d3f15..dac588bafaed 100755 --- a/tools/devops/automation/scripts/bash/configure-decisions.sh +++ b/tools/devops/automation/scripts/bash/configure-decisions.sh @@ -42,6 +42,9 @@ elif [[ "${LABELS_RUN_WINDOWS_TESTS:-}" == "True" ]]; then elif [[ "${LABELS_SKIP_ALL_TESTS:-}" == "True" ]]; then # All tests have been skipped RUN_WINDOWS_TESTS=false +elif [[ "${CONFIGURE_PLATFORMS_DOTNET_PLATFORMS:-}" == "" ]]; then + # No platforms enabled, don't run windows tests + RUN_WINDOWS_TESTS=false else # Otherwise run windows tests (we want to run windows tests if any platform is enabled) RUN_WINDOWS_TESTS=true diff --git a/tools/devops/automation/scripts/bash/install-workloads.sh b/tools/devops/automation/scripts/bash/install-workloads.sh index f4fbf59107c3..132d59c9b777 100755 --- a/tools/devops/automation/scripts/bash/install-workloads.sh +++ b/tools/devops/automation/scripts/bash/install-workloads.sh @@ -72,8 +72,8 @@ cat "$ROLLBACK_PATH" mkdir -p "$DOTNET_NUPKG_DIR" ls -R "$ARTIFACTS_PATH/${MACIOS_UPLOAD_PREFIX}not-signed-package" cp "$ARTIFACTS_PATH/${MACIOS_UPLOAD_PREFIX}not-signed-package/"*.nupkg "$DOTNET_NUPKG_DIR" -cp "$ARTIFACTS_PATH/${MACIOS_UPLOAD_PREFIX}not-signed-package/"*.pkg "$DOTNET_NUPKG_DIR" -cp "$ARTIFACTS_PATH/${MACIOS_UPLOAD_PREFIX}not-signed-package/"*.zip "$DOTNET_NUPKG_DIR" +cp "$ARTIFACTS_PATH/${MACIOS_UPLOAD_PREFIX}not-signed-package/"*.pkg "$DOTNET_NUPKG_DIR" 2>/dev/null || true +cp "$ARTIFACTS_PATH/${MACIOS_UPLOAD_PREFIX}not-signed-package/"*.zip "$DOTNET_NUPKG_DIR" 2>/dev/null || true ls -R "$DOTNET_NUPKG_DIR" NUGET_SOURCES=$(grep https://pkgs.dev.azure.com ./NuGet.config | sed -e 's/.*value="//' -e 's/".*//') diff --git a/tools/devops/automation/templates/api-diff-stage.yml b/tools/devops/automation/templates/api-diff-stage.yml index 8d2b5bf00ca8..a81ac79c8bda 100644 --- a/tools/devops/automation/templates/api-diff-stage.yml +++ b/tools/devops/automation/templates/api-diff-stage.yml @@ -55,6 +55,7 @@ stages: - stage: generate_api_diff displayName: 'API diff' dependsOn: [ configure_build ] + condition: and(succeeded(), ne(dependencies.configure_build.outputs['configure.configure_platforms.DOTNET_PLATFORMS'], '')) jobs: - template: ./build/api-diff-stage.yml parameters: diff --git a/tools/devops/automation/templates/common/configure.yml b/tools/devops/automation/templates/common/configure.yml index 52640c8375dc..c01ec28165c7 100644 --- a/tools/devops/automation/templates/common/configure.yml +++ b/tools/devops/automation/templates/common/configure.yml @@ -86,6 +86,7 @@ parameters: { label: sharpie, splitByPlatforms: false, + supportsNoPlatforms: true, testPrefix: 'simulator_tests', }, { @@ -253,9 +254,11 @@ steps: Write-Host "apiScanMatrix=$apiScanMatrix" if ($apiScanMatrix.length -gt 0) { $apiScanMatrix = $apiScanMatrix | ConvertFrom-Json | ConvertTo-Json -Compress + Edit-BuildConfiguration -ConfigKey APISCAN_MATRIX -ConfigValue $apiScanMatrix -ConfigFile $Env:CONFIG_PATH + } else { + $apiScanMatrix = "{}" } Write-Host "##vso[task.setvariable variable=APISCAN_MATRIX;isOutput=true]$apiScanMatrix" - Edit-BuildConfiguration -ConfigKey APISCAN_MATRIX -ConfigValue $apiScanMatrix -ConfigFile $Env:CONFIG_PATH name: apiscan_matrix displayName: 'Create APIScan matrix' diff --git a/tools/devops/automation/templates/governance/stage.yml b/tools/devops/automation/templates/governance/stage.yml index deb65f40dc7e..9211cd5c5924 100644 --- a/tools/devops/automation/templates/governance/stage.yml +++ b/tools/devops/automation/templates/governance/stage.yml @@ -27,6 +27,7 @@ stages: - stage: governance_checks displayName: '${{ parameters.stageDisplayNamePrefix }}API Scan' dependsOn: ${{ parameters.dependsOn }} + condition: and(succeeded(), ne(dependencies.configure_build.outputs['configure.configure_platforms.DOTNET_PLATFORMS'], '')) jobs: - job: apiscan diff --git a/tools/devops/automation/templates/mac/stage.yml b/tools/devops/automation/templates/mac/stage.yml index bbe10a52975f..a7fc6657df50 100644 --- a/tools/devops/automation/templates/mac/stage.yml +++ b/tools/devops/automation/templates/mac/stage.yml @@ -58,7 +58,7 @@ stages: dependsOn: - build_macos_tests - configure_build - condition: and(succeeded(), eq(stageDependencies.configure_build.outputs['configure.decisions.RUN_MAC_TESTS'], 'true')) + condition: and(succeeded(), eq(dependencies.configure_build.outputs['configure.decisions.RUN_MAC_TESTS'], 'true')) variables: GITHUB_FAILURE_COMMENT_FILE: $(System.DefaultWorkingDirectory)/github-comment-file.md diff --git a/tools/devops/automation/templates/release/vs-insertion-prep.yml b/tools/devops/automation/templates/release/vs-insertion-prep.yml index a9ecb69b8e1b..52e1315afd4d 100644 --- a/tools/devops/automation/templates/release/vs-insertion-prep.yml +++ b/tools/devops/automation/templates/release/vs-insertion-prep.yml @@ -79,6 +79,7 @@ stages: use1ESTemplate: true yamlResourceName: yaml-templates dependsOn: signing + condition: ne(stageDependencies.configure_build.configure.outputs['configure_platforms.DOTNET_PLATFORMS'], '') artifactName: '${{ parameters.uploadPrefix }}nuget-signed' propsArtifactName: ${{ parameters.uploadPrefix }}not-signed-package binlogsArtifactName: ${{ parameters.uploadPrefix }}nuget-msi-convert-binlogs @@ -119,12 +120,15 @@ stages: ), or( eq(dependencies.nuget_convert.result, 'Succeeded'), - eq(dependencies.nuget_convert.result, 'SucceededWithIssues') + eq(dependencies.nuget_convert.result, 'SucceededWithIssues'), + eq(dependencies.nuget_convert.result, 'Skipped') ) ) variables: - name: skipNugetSecurityAnalysis value: true + - name: DOTNET_PLATFORMS + value: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.DOTNET_PLATFORMS'] ] - name: INCLUDE_DOTNET_IOS value: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_DOTNET_IOS'] ] - name: INCLUDE_DOTNET_MACCATALYST @@ -160,17 +164,25 @@ stages: artifactName: not-signed-package-symbols downloadPath: $(Build.StagingDirectory)\symbols + - powershell: | + $buildNumber = "$(Build.BuildNumber)" + Write-Host "##vso[task.setvariable variable=ReleaseDropPrefix]$buildNumber" + displayName: Set fallback ReleaseDropPrefix + condition: and(succeeded(), eq(variables['DOTNET_PLATFORMS'], '')) + - task: DownloadPipelineArtifact@2 inputs: artifactName: DropMetadata-shipping-nugets downloadPath: $(Build.StagingDirectory)\metadata displayName: Download nugets drop metadata + condition: and(succeeded(), ne(variables['DOTNET_PLATFORMS'], '')) - powershell: | $jsonContent = Get-Content -Path "$(Build.StagingDirectory)\metadata\VSTSDrop.json" -Raw | ConvertFrom-Json $dropPrefix = $jsonContent.VstsDropBuildArtifact.VstsDropUrl -replace 'https://devdiv.artifacts.visualstudio.com/DefaultCollection/_apis/drop/drops/' -replace '/nugets' Write-Host "##vso[task.setvariable variable=ReleaseDropPrefix]$dropPrefix" displayName: Set variable ReleaseDropPrefix + condition: and(succeeded(), ne(variables['DOTNET_PLATFORMS'], '')) # Download nugets drop created by nuget-msi-convert/job/v4.yml and publish to maestro - task: ms-vscs-artifact.build-tasks.artifactDropDownloadTask-1.artifactDropDownloadTask@1 @@ -179,6 +191,15 @@ stages: dropServiceURI: https://devdiv.artifacts.visualstudio.com/DefaultCollection buildNumber: $(ReleaseDropPrefix)/nugets destinationPath: $(Build.StagingDirectory)\nuget-signed + condition: and(succeeded(), ne(variables['DOTNET_PLATFORMS'], '')) + + # Download signed nugets from pipeline artifact when nuget-msi-convert was skipped + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: '${{ parameters.uploadPrefix }}nuget-signed' + downloadPath: $(Build.StagingDirectory)\nuget-signed + displayName: Download signed nugets from pipeline artifact + condition: and(succeeded(), eq(variables['DOTNET_PLATFORMS'], '')) - script: make -C $(Build.SourcesDirectory)/dotnet setup-publish-bar-manifest displayName: make setup-publish-bar-manifest @@ -194,6 +215,9 @@ stages: exit 0; } } + # Fallback to iOS when no platforms are configured (e.g. ONLY_SHARPIE) + Write-Host "No platform variable was set, defaulting MaestroProjectPlatformName to 'iOS'" + Write-Host "##vso[task.setvariable variable=MaestroProjectPlatformName]iOS" displayName: Set maestro project variable - task: AzureCLI@2 diff --git a/tools/devops/automation/templates/tests-stage.yml b/tools/devops/automation/templates/tests-stage.yml index 21914a4f4fc2..3b0af283aa23 100644 --- a/tools/devops/automation/templates/tests-stage.yml +++ b/tools/devops/automation/templates/tests-stage.yml @@ -168,6 +168,7 @@ stages: - stage: build_macos_tests displayName: '${{ parameters.stageDisplayNamePrefix }}Build macOS tests' dependsOn: [configure_build] + condition: and(succeeded(), ne(dependencies.configure_build.outputs['configure.configure_platforms.DOTNET_PLATFORMS'], '')) jobs: - template: ./build/build-mac-tests-stage.yml parameters: diff --git a/tools/sharpie/Makefile b/tools/sharpie/Makefile index f67363bb2827..99ef2c5e587d 100644 --- a/tools/sharpie/Makefile +++ b/tools/sharpie/Makefile @@ -23,12 +23,12 @@ SHARPIE_BIND_TOOL_NUPKG=Sharpie.Bind.Tool/bin/Release/$(SHARPIE_BIND_TOOL_NUPKG_ pack: $(SHARPIE_BIND_TOOL_NUPKG) $(SHARPIE_BIND_TOOL_NUPKG): $(Sharpie.Bind_dependencies) - $(Q_BUILD) $(DOTNET) pack Sharpie.Bind.Tool/Sharpie.Bind.Tool.csproj "/p:Version=$(SHARPIE_VERSION)" $(DOTNET_PACK_VERBOSITY) -bl:$@.binlog + $(Q_BUILD) $(DOTNET) pack Sharpie.Bind.Tool/Sharpie.Bind.Tool.csproj "/p:Version=$(SHARPIE_VERSION)" "/p:CurrentBranch=$(CURRENT_BRANCH)" "/p:CurrentHash=$(CURRENT_HASH_LONG)" $(DOTNET_PACK_VERBOSITY) -bl:$@.binlog all-local:: $(DOTNET_NUPKG_DIR)/$(SHARPIE_BIND_TOOL_NUPKG_NAME) $(DOTNET_NUPKG_DIR)/$(SHARPIE_BIND_TOOL_NUPKG_NAME): $(SHARPIE_BIND_TOOL_NUPKG) $(Q) mkdir -p $(dir $@) - $(Q) $(CP) $< $@ + $(Q) $(CP) $(dir $<)/*.nupkg $(dir $@) run-tests: $(Sharpie.Bind_dependencies) $(Q_BUILD) $(DOTNET) test $(TOP)/tests/sharpie/Sharpie.Bind.Tests/Sharpie.Bind.Tests.csproj --logger "console;verbosity=detailed" $(DOTNET_BUILD_VERBOSITY) -bl:$@.binlog diff --git a/tools/sharpie/Sharpie.Bind.Tool/Sharpie.Bind.Tool.csproj b/tools/sharpie/Sharpie.Bind.Tool/Sharpie.Bind.Tool.csproj index ce9a63328354..c58024873200 100644 --- a/tools/sharpie/Sharpie.Bind.Tool/Sharpie.Bind.Tool.csproj +++ b/tools/sharpie/Sharpie.Bind.Tool/Sharpie.Bind.Tool.csproj @@ -13,6 +13,7 @@ osx-arm64 true sharpie + true $(NETCoreSdkRuntimeIdentifier) @@ -20,8 +21,18 @@ true major + https://github.com/dotnet/macios + $(CurrentBranch) + $(CurrentHash) + + Microsoft + microsoft,dotnetframework + © Microsoft Corporation. All rights reserved. README.md LICENSE + Icon.png + https://github.com/dotnet/macios + true @@ -33,6 +44,7 @@ +