Skip to content

Commit

Permalink
Merge branch 'main' into sequoia-test
Browse files Browse the repository at this point in the history
  • Loading branch information
dalexsoto authored Jan 27, 2025
2 parents 6bd5674 + e7419d9 commit b0abf79
Show file tree
Hide file tree
Showing 104 changed files with 5,163 additions and 554 deletions.
5 changes: 3 additions & 2 deletions dotnet/Workloads/SignList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@
<Skip Include="Build\System.Text.Json.dll" />
<Skip Include="Build\System.Threading.Tasks.Dataflow.dll" />
<Skip Include="Build\System.Threading.Tasks.Extensions.dll" />
<!-- They are now signed by their origin build https://github.com/xamarin/XamarinVS/pull/14522 -->
<Skip Include="imobiledevice-*\*.dll" />
<Skip Include="imobiledevice-*\*.exe" />
</ItemGroup>

<ItemGroup>
<ThirdParty Include="BouncyCastle.Crypto.dll" />
<ThirdParty Include="imobiledevice-*\*.dll" />
<ThirdParty Include="imobiledevice-*\*.exe" />
<!-- Build.zip -->
<ThirdParty Include="Mono.Cecil*.dll" />

Expand Down
2 changes: 1 addition & 1 deletion msbuild/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
-->
<MessagingVersion Condition="'$(MessagingVersion)' == ''">[3.0.13]</MessagingVersion>
<HotRestartVersion>[17.14.51-gd03e25086a]</HotRestartVersion>
<HotRestartVersion>[17.14.83-g77e8f56103]</HotRestartVersion>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)../Directory.Build.props" />
</Project>
2 changes: 1 addition & 1 deletion msbuild/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ IOS_WINDOWS_TARGETS = \

TASK_ASSEMBLIES = Xamarin.MacDev.Tasks $(LOCALIZATION_ASSEMBLIES)
IOS_WINDOWS_TASK_ASSEMBLIES = Xamarin.iOS.Tasks.Windows
IOS_WINDOWS_DEPENDENCIES = Xamarin.iOS.Windows.Client iSign.Core ws2_32 System.Diagnostics.Tracer System.Formats.Asn1 System.Buffers System.Memory System.Numerics.Vectors System.Runtime.CompilerServices.Unsafe System.Security.Cryptography.ProtectedData System.Security.Cryptography.Pkcs Microsoft.Win32.Registry System.Security.AccessControl System.Security.Principal.Windows
IOS_WINDOWS_DEPENDENCIES = Xamarin.iOS.Windows.Client iSign.Core ws2_32 System.Diagnostics.Tracer System.Formats.Asn1 System.Buffers System.Memory System.Numerics.Vectors System.Runtime.CompilerServices.Unsafe System.Security.Cryptography.ProtectedData System.Security.Cryptography.Pkcs Microsoft.Win32.Registry
IOS_WINDOWS_MOBILEDEVICE_TOOLS = iMobileDevice-net bz2 getopt ideviceactivation idevicebackup idevicebackup2 idevicecrashreport idevicedate idevicedebug idevicedebugserverproxy idevicediagnostics ideviceenterrecovery ideviceimagemounter ideviceinfo ideviceinstaller idevicename idevicenotificationproxy idevicepair ideviceprovision idevicerestore idevicescreenshot idevicesyslog idevice_id imobiledevice-net-lighthouse imobiledevice ios_webkit_debug_proxy iproxy irecovery irecovery libcharset libcurl LIBEAY32 libiconv libusb-1.0 libusb0 libxml2 lzma pcre pcreposix plist plistutil plist_cmp plist_test pthreadVC3 readline SSLEAY32 usbmuxd usbmuxd vcruntime140 zip zlib1

PROPS_AND_TARGETS = \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<PackageReference Include="Xamarin.Messaging.Build.Client" Version="$(MessagingVersion)" IncludeAssets="contentFiles" />
<PackageReference Include="Xamarin.Messaging.Core" Version="$(MessagingVersion)" IncludeAssets="build" />
<PackageReference Include="Xamarin.Messaging.Server" Version="$(MessagingVersion)" IncludeAssets="contentFiles" />
<PackageReference Include="iSign.Core" Version="$(HotRestartVersion)" GeneratePathProperty="true" />
<PackageReference Include="Xamarin.iOS.HotRestart.Client" Version="$(HotRestartVersion)" GeneratePathProperty="true" />
<PackageReference Include="System.Diagnostics.Tracer" Version="2.1.0-alpha" GeneratePathProperty="true" />
<!-- GitInfo is pulled in because of Xamarin.Messaging from above, but we don't want it, so just exclude all assets from it -->
Expand All @@ -38,7 +39,7 @@
<None Include="*.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(PkgXamarin_iOS_HotRestart_Client)\lib\netstandard2.0\iSign.Core.pdb" CopyToOutputDirectory="PreserveNewest" />
<None Include="$(PkgiSign_Core)\lib\netstandard2.0\iSign.Core.pdb" CopyToOutputDirectory="PreserveNewest" />
<None Include="$(PkgXamarin_iOS_HotRestart_Client)\lib\netstandard2.0\Xamarin.iOS.Windows.Client.pdb" CopyToOutputDirectory="PreserveNewest" />
<Compile Include="../Versions.g.cs" />
<Compile Include="..\Xamarin.MacDev.Tasks\PublishFolderType.cs">
Expand Down
15 changes: 15 additions & 0 deletions src/ObjCBindings/BindingTypeTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public enum Class : Int64 {
/// Use to let the generator know that the default constructor should not be generated.
/// </summary>
DisableDefaultCtor = 1 << 2,

/// <summary>
/// Flags the object as being thread safe.
/// </summary>
IsThreadSafe = 1 << 3,
}

/// <summary>
Expand All @@ -32,6 +37,11 @@ public enum Protocol : Int64 {
/// Use the default values.
/// </summary>
Default = 0,

/// <summary>
/// Flags the object as being thread safe.
/// </summary>
IsThreadSafe = 1 << 2,
}

/// <summary>
Expand All @@ -44,6 +54,11 @@ public enum Category : Int64 {
/// Use the default values.
/// </summary>
Default = 0,

/// <summary>
/// Flags the object as being thread safe.
/// </summary>
IsThreadSafe = 1 << 2,
}

/// <summary>
Expand Down
30 changes: 30 additions & 0 deletions src/ObjCBindings/ExportTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public enum Constructor : Int64 {
/// Map to Objective-C/clang use of __attribute__((objc_designated_initializer)).
/// </summary>
DesignatedInitializer = 1 << 2,

/// <summary>
/// Flags the object as being thread safe.
/// </summary>
IsThreadSafe = 1 << 3,
}

/// <summary>
Expand Down Expand Up @@ -59,6 +64,11 @@ public enum Method : Int64 {
/// </summary>
CustomMarshalDirective = 1 << 5,

/// <summary>
/// Flags the object as being thread safe.
/// </summary>
IsThreadSafe = 1 << 6,

}

/// <summary>
Expand Down Expand Up @@ -97,6 +107,26 @@ public enum Property : Int64 {
/// </summary>
CustomMarshalDirective = 1 << 5,

/// <summary>
/// Apply to strings parameters that are merely retained or assigned,
/// not copied this is an exception as it is advised in the coding
/// standard for Objective-C to avoid this, but a few properties do use
/// this. Use this falg for properties flagged with `retain' or
/// `assign', which look like this:
///
/// @property (retain) NSString foo;
/// @property (assign) NSString assigned;
///
/// This forced the generator to create an NSString before calling the
/// API instead of using the fast string marshalling code.
/// </summary>
DisableZeroCopy = 1 << 6,

/// <summary>
/// Flags the object as being thread safe.
/// </summary>
IsThreadSafe = 1 << 7,

}
}

11 changes: 7 additions & 4 deletions src/ObjCRuntime/Stret.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
#endif
using System.Runtime.InteropServices;

#if !RGEN
using Foundation;
#endif

// Disable until we get around to enable + fix any issues.
#nullable disable
Expand All @@ -41,7 +43,7 @@ static bool IsHomogeneousAggregateSmallEnough_Armv7k (Type t, int members)
// https://github.com/llvm-mirror/clang/blob/82f6d5c9ae84c04d6e7b402f72c33638d1fb6bc8/lib/CodeGen/TargetInfo.cpp#L5516-L5519
return members <= 4;
}

#if !RGEN
static bool IsHomogeneousAggregateBaseType_Armv7k (Type t, Generator generator)
{
// https://github.com/llvm-mirror/clang/blob/82f6d5c9ae84c04d6e7b402f72c33638d1fb6bc8/lib/CodeGen/TargetInfo.cpp#L5500-L5514
Expand Down Expand Up @@ -77,6 +79,7 @@ static bool IsHomogeneousAggregate_Armv7k (List<Type> fieldTypes, Generator gene

return true;
}
#endif

#if BGENERATOR
public static bool ArmNeedStret (Type returnType, Generator generator)
Expand Down Expand Up @@ -152,7 +155,7 @@ public static bool ArmNeedStret (Type returnType, Generator generator)
}
#endif // BGENERATOR

#if BGENERATOR
#if BGENERATOR || RGEN
public static bool X86NeedStret (Type returnType, Generator generator)
{
Type t = returnType;
Expand Down Expand Up @@ -188,7 +191,7 @@ public static bool X86_64NeedStret (Type returnType, Generator generator)
// IL2070: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicFields', 'DynamicallyAccessedMemberTypes.NonPublicFields' in call to 'System.Type.GetFields(BindingFlags)'. The parameter 'type' of method 'ObjCRuntime.Stret.GetValueTypeSize(Type, List<Type>, Boolean, Object)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
[UnconditionalSuppressMessage ("", "IL2070", Justification = "Computing the size of a struct is safe, because the trimmer can't remove fields that would affect the size of a marshallable struct (it could affect marshalling behavior).")]
#endif
static int GetValueTypeSize (Type type, List<Type> fieldTypes, bool is_64_bits, Generator generator)
internal static int GetValueTypeSize (Type type, List<Type> fieldTypes, bool is_64_bits, Generator generator)
{
int size = 0;
int maxElementSize = 1;
Expand Down Expand Up @@ -228,7 +231,7 @@ static bool IsBuiltInType (Type type)
return IsBuiltInType (type, true /* doesn't matter */, out var _);
}

static bool IsBuiltInType (Type type, bool is_64_bits, out int type_size)
internal static bool IsBuiltInType (Type type, bool is_64_bits, out int type_size)
{
type_size = 0;

Expand Down
1 change: 1 addition & 0 deletions src/rgen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Generated
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
<Compile Include="../Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs">
<Link>Generator/Extensions/TypeSymbolExtensions.Core.cs</Link>
</Compile>
<Compile Include="../Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Generator.cs">
<Link>Generator/Extensions/TypeSymbolExtensions.Generator.cs</Link>
</Compile>
<Compile Include="../Microsoft.Macios.Generator/Extensions/TypedConstantExtensions.cs" >
<Link>Generator/Extensions/TypedConstantExtensions.cs</Link>
</Compile>
Expand Down
37 changes: 37 additions & 0 deletions src/rgen/Microsoft.Macios.Generator/Attributes/MarshalDirective.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;

namespace Microsoft.Macios.Generator.Attributes;

record CustomMarshalDirective (string? NativePrefix, string? NativeSuffix, string? Library);

static class ExportDataExtensions {

public static bool ShouldMarshalNativeExceptions<T> (this ExportData<T> self) where T : Enum
=> self switch {
ExportData<ObjCBindings.Property> property => property.Flags.HasFlag (ObjCBindings.Property
.CustomMarshalDirective),
ExportData<ObjCBindings.Method> method => method.Flags.HasFlag (
ObjCBindings.Property.CustomMarshalDirective),
_ => false,
};

public static CustomMarshalDirective? ToCustomMarshalDirective<T> (this ExportData<T> self) where T : Enum
{
var present = self switch {
ExportData<ObjCBindings.Property> property => property.Flags.HasFlag (ObjCBindings.Property
.CustomMarshalDirective),
ExportData<ObjCBindings.Method> method => method.Flags.HasFlag (
ObjCBindings.Property.CustomMarshalDirective),
_ => false,
};
if (present) {
return new (self.NativePrefix, self.NativeSuffix, self.Library);
}

return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ internal SupportedOSPlatformData (string platformName)
(Platform, Version) = platformName.GetPlatformAndVersion ();
}

internal SupportedOSPlatformData (ApplePlatform platform, Version version)
{
Platform = platform;
Version = version;
}

/// <summary>
/// Try to parse the attribute data to retrieve the information of an SupportedOSPlatformAttribute.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ internal UnsupportedOSPlatformData (string platformName)
(Platform, Version) = platformName.GetPlatformAndVersion ();
}

internal UnsupportedOSPlatformData (ApplePlatform platform)
{
Platform = platform;
Version = new Version ();
}

internal UnsupportedOSPlatformData (string platformName, string? message = null) : this (platformName)
{
Message = message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public bool Equals (PlatformAvailability other)
var obsoleteComparer = new DictionaryComparer<Version, (string?, string?)> ();
var unsupportedComparer = new DictionaryComparer<Version, string?> ();

var x = Equals (SupportedVersion, other.SupportedVersion);
return Platform == other.Platform &&
Equals (SupportedVersion, other.SupportedVersion) &&
unsupportedComparer.Equals (unsupported, other.unsupported) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ public sealed class Builder {

internal Builder () { }

/// <summary>
/// Return the immutable version of the current data in the builder.
/// </summary>
public IEnumerable<PlatformAvailability> PlatformAvailabilities {
get {
// return the immutable version of the builder data
foreach (var availability in platforms.Values) {
yield return availability.ToImmutable ();
}
}
}

/// <summary>
/// Returns the PlatformAvailability for the given platform. If we did not have a builder for the
/// platform, a new one is created and added to the dictionary.
Expand Down
Loading

0 comments on commit b0abf79

Please sign in to comment.