Skip to content

Commit

Permalink
Merge branch 'main' into attribute_super_convert_type_mass_smash_2
Browse files Browse the repository at this point in the history
  • Loading branch information
chamons authored Mar 14, 2022
2 parents 1c36da1 + c055c10 commit 92e446d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions msbuild/Xamarin.Shared/Xamarin.Shared.props
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,17 @@ Copyright (C) 2020 Microsoft. All rights reserved.
<!-- default to 'false' -->
<NoSymbolStrip Condition="'$(NoSymbolStrip)' == '' And '$(_PlatformName)' != 'macOS'">$(MtouchNoSymbolStrip)</NoSymbolStrip>
<NoSymbolStrip Condition="'$(NoSymbolStrip)' == '' And ('$(_PlatformName)' == 'macOS' Or '$(_PlatformName)' == 'MacCatalyst')">true</NoSymbolStrip>
<!-- Disable stripping for simulator builds by default -->
<NoSymbolStrip Condition="'$(NoSymbolStrip)' == '' And ('$(_PlatformName)' == 'iOS' Or '$(_PlatformName)' == 'tvOS' Or '$(_PlatformName)' == 'watchOS') And '$(ComputedPlatform)' != 'iPhone'">true</NoSymbolStrip>
<NoSymbolStrip Condition="'$(NoSymbolStrip)' == ''">false</NoSymbolStrip>

<!-- NoDSymUtil -->
<!-- Xamarin.Mac never had an equivalent for MtouchNoDSymUtil and never produced them -> now, produce them by default when archiving -->
<NoDSymUtil Condition="'$(NoDSymUtil)' == '' And '$(_PlatformName)' != 'macOS'">$(MtouchNoDSymUtil)</NoDSymUtil>
<!-- Disable dsymutil on desktop unless archiving -->
<NoDSymUtil Condition="'$(NoDSymUtil)' == '' And ('$(_PlatformName)' == 'macOS' Or '$(_PlatformName)' == 'MacCatalyst') And '$(ArchiveOnBuild)' != 'true'">true</NoDSymUtil>
<!-- Disable dsymutil for simulator builds by default -->
<NoDSymUtil Condition="'$(NoDSymUtil)' == '' And ('$(_PlatformName)' == 'iOS' Or '$(_PlatformName)' == 'tvOS' Or '$(_PlatformName)' == 'watchOS') And '$(ComputedPlatform)' != 'iPhone'">true</NoDSymUtil>
<NoDSymUtil Condition="'$(NoDSymUtil)' == ''">false</NoDSymUtil>

<!-- DeviceSpecificIntermediateOutputPath -->
Expand Down
2 changes: 1 addition & 1 deletion src/generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,7 @@ bool GetNativeEnumToManagedExpression (Type enumType, out string preExpression,
// in question actually has that value at least). Same goes for Int32.MinValue/Int64.MinValue.
// var isDefined = enumType.IsEnumDefined (maxValue);
var definedMaxField = enumType.GetFields ().Where (v => v.IsLiteral).FirstOrDefault (isMaxDefinedFunc);
if (definedMaxField != null) {
if (definedMaxField is not null && postproc is not null) {
postproc.AppendLine ("#if ARCH_32");
postproc.AppendFormat ("if (({0}) ret == ({0}) {1}.MaxValue)\n", underlyingTypeName, itype);
postproc.AppendFormat ("\tret = {0}.{1}; // = {2}.MaxValue\n", renderedEnumType, definedMaxField.Name, underlyingTypeName);
Expand Down
7 changes: 7 additions & 0 deletions tests/generator/tests/nativeenum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public enum MyEnum8 : ulong {
Value2 = ulong.MaxValue,
}

delegate void EnumHandler (MyEnum7 seven, MyEnum8 eight);

[BaseType (typeof (NSObject))]
interface MyClass {
[Export ("myProp1")]
Expand Down Expand Up @@ -90,5 +92,10 @@ interface MyClass {
MyEnum8 MyProp8 { get; set; }
[Export ("myMethod8:")]
MyEnum8 MyMethod8 (MyEnum8 arg);

[Export ("myDelegateProp")]
EnumHandler MyDelegateProp { get; set; }
[Export ("myDelegateMethod:")]
EnumHandler MyDelegateMethod (EnumHandler arg);
}
}

0 comments on commit 92e446d

Please sign in to comment.