Skip to content

Commit

Permalink
Merge branch 'main' into il_strip_net6
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne authored Sep 30, 2021
2 parents f215ae8 + 7a090e9 commit ca0cab7
Show file tree
Hide file tree
Showing 25 changed files with 759 additions and 827 deletions.
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="6.0.100-rtm.21476.2">
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="6.0.100-rtm.21478.8">
<Uri>https://github.com/dotnet/installer</Uri>
<Sha>885ff3819901e75ee1782185a53a3ab4ea6deac8</Sha>
<Sha>b83da76f5fede9432ca6efce8652a616efff2ea6</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-1.21473.1" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
<Uri>https://github.com/dotnet/linker</Uri>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<!--Package versions-->
<PropertyGroup>
<MicrosoftDotnetSdkInternalPackageVersion>6.0.100-rtm.21476.2</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftDotnetSdkInternalPackageVersion>6.0.100-rtm.21478.8</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftNETILLinkTasksPackageVersion>6.0.100-1.21473.1</MicrosoftNETILLinkTasksPackageVersion>
<MicrosoftDotNetBuildTasksFeedPackageVersion>6.0.0-beta.21212.6</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftNETILStripTasksPackageVersion>6.0.0-rc.2.21468.3</MicrosoftNETILStripTasksPackageVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../../product.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
Expand Down
17 changes: 0 additions & 17 deletions msbuild/Xamarin.Mac.Tasks/Tasks/Metal.cs

This file was deleted.

17 changes: 0 additions & 17 deletions msbuild/Xamarin.Mac.Tasks/Tasks/MetalLib.cs

This file was deleted.

21 changes: 19 additions & 2 deletions msbuild/Xamarin.MacDev.Tasks.Core/Tasks/MetalLibTaskBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

using Xamarin.Localization.MSBuild;
using Xamarin.Utils;

namespace Xamarin.MacDev.Tasks
Expand All @@ -26,8 +27,24 @@ public abstract class MetalLibTaskBase : XamarinToolTask

#endregion

protected abstract string DevicePlatformBinDir {
get;
string DevicePlatformBinDir {
get {
switch (Platform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
case ApplePlatform.WatchOS:
return AppleSdkSettings.XcodeVersion.Major >= 11
? Path.Combine (SdkDevPath, "Toolchains", "XcodeDefault.xctoolchain", "usr", "bin")
: Path.Combine (SdkDevPath, "Platforms", "iPhoneOS.platform", "usr", "bin");
case ApplePlatform.MacOSX:
case ApplePlatform.MacCatalyst:
return AppleSdkSettings.XcodeVersion.Major >= 10
? Path.Combine (SdkDevPath, "Toolchains", "XcodeDefault.xctoolchain", "usr", "bin")
: Path.Combine (SdkDevPath, "Platforms", "MacOSX.platform", "usr", "bin");
default:
throw new InvalidOperationException (string.Format (MSBStrings.InvalidPlatform, Platform));
}
}
}

protected override string ToolName {
Expand Down
20 changes: 18 additions & 2 deletions msbuild/Xamarin.MacDev.Tasks.Core/Tasks/MetalTaskBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,24 @@ public abstract class MetalTaskBase : XamarinToolTask
[Output]
public ITaskItem OutputFile { get; set; }

protected abstract string DevicePlatformBinDir {
get;
string DevicePlatformBinDir {
get {
switch (Platform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
case ApplePlatform.WatchOS:
return AppleSdkSettings.XcodeVersion.Major >= 11
? Path.Combine (SdkDevPath, "Toolchains", "XcodeDefault.xctoolchain", "usr", "bin")
: Path.Combine (SdkDevPath, "Platforms", "iPhoneOS.platform", "usr", "bin");
case ApplePlatform.MacOSX:
case ApplePlatform.MacCatalyst:
return AppleSdkSettings.XcodeVersion.Major >= 10
? Path.Combine (SdkDevPath, "Toolchains", "XcodeDefault.xctoolchain", "usr", "bin")
: Path.Combine (SdkDevPath, "Platforms", "MacOSX.platform", "usr", "bin");
default:
throw new InvalidOperationException (string.Format (MSBStrings.InvalidPlatform, Platform));
}
}
}

protected override string ToolName {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Xamarin.Messaging.Build.Client;

namespace Xamarin.iOS.Tasks
namespace Xamarin.MacDev.Tasks
{
public class Metal : MetalTaskBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;

namespace Xamarin.iOS.Tasks
namespace Xamarin.MacDev.Tasks
{
public class MetalLib : MetalLibTaskBase, ITaskCallback
{
Expand Down
6 changes: 2 additions & 4 deletions msbuild/Xamarin.Shared/Xamarin.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.FindWatchOS2AppBundle" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.GetFiles" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.GetMlaunchArguments" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.Metal" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.MetalLib" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.MTouch" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.ParseDeviceSpecificBuildInformation" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.PrepareNativeReferences" AssemblyFile="$(_TaskAssemblyName)" />
Expand All @@ -73,8 +71,6 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<UsingTask Condition="'$(_PlatformName)' == 'macOS'" TaskName="Xamarin.Mac.Tasks.CreateEmbeddedResources" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' == 'macOS'" TaskName="Xamarin.Mac.Tasks.DetectSdkLocations" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' == 'macOS'" TaskName="Xamarin.Mac.Tasks.DetectSigningIdentity" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' == 'macOS'" TaskName="Xamarin.Mac.Tasks.Metal" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' == 'macOS'" TaskName="Xamarin.Mac.Tasks.MetalLib" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' == 'macOS'" TaskName="Xamarin.Mac.Tasks.Mmp" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' == 'macOS'" TaskName="Xamarin.Mac.Tasks.PrepareNativeReferences" AssemblyFile="$(_TaskAssemblyName)" />

Expand Down Expand Up @@ -105,6 +101,8 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<UsingTask TaskName="Xamarin.MacDev.Tasks.GetFullPath" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.GetPropertyListValue" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.IBTool" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.Metal" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.MetalLib" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.OptimizeImage" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.OptimizePropertyList" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.PackLibraryResources" AssemblyFile="$(_TaskAssemblyName)" />
Expand Down
17 changes: 0 additions & 17 deletions msbuild/Xamarin.iOS.Tasks.Core/Tasks/MetalLibTaskBase.cs

This file was deleted.

17 changes: 0 additions & 17 deletions msbuild/Xamarin.iOS.Tasks.Core/Tasks/MetalTaskBase.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/AppKit/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2277,7 +2277,7 @@ public enum NSPopUpArrowPosition : ulong {
}

// FileType 4cc values to use with NSFileTypeForHFSTypeCode.
[NoMacCatalyst]
[MacCatalyst(15, 0)]
public enum HfsTypeCode : uint
{
/* Generic Finder icons */
Expand Down
6 changes: 4 additions & 2 deletions src/Foundation/Enum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,17 @@ public enum NSEnumerationOptions : ulong {
Reverse = 2
}

#if MONOMAC
#if MONOMAC || __MACCATALYST__
[MacCatalyst(15, 0)]
[Native]
public enum NSNotificationSuspensionBehavior : ulong {
Drop = 1,
Coalesce = 2,
Hold = 3,
DeliverImmediately = 4,
}


[MacCatalyst(15, 0)]
[Flags]
[Native]
public enum NSNotificationFlags : ulong {
Expand Down
2 changes: 1 addition & 1 deletion src/Foundation/NSScriptCommandArgumentDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Foundation {

#if MONOMAC
#if MONOMAC || __MACCATALYST__

// The kyes are not found in any of the public headers from apple. That is the reason
// to use this technique.
Expand Down
2 changes: 1 addition & 1 deletion src/Foundation/NSScriptCommandDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Foundation {

#if MONOMAC
#if MONOMAC || __MACCATALYST__

// The kyes are not found in any of the public headers from apple. That is the reason
// to use this technique.
Expand Down
2 changes: 1 addition & 1 deletion src/Foundation/NSScriptCommandDescriptionDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Foundation {

#if MONOMAC
#if MONOMAC || __MACCATALYST__

public static class NSScriptCommandDescriptionDictionaryKeys {
private static NSString cmdClass = new NSString ("CommandClass");
Expand Down
44 changes: 25 additions & 19 deletions src/Metal/MTLDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,42 +61,48 @@ public static IMTLDevice? SystemDefault {
public static IMTLDevice [] GetAllDevices ()
{
var rv = MTLCopyAllDevices ();
return NSArray.ArrayFromHandle<IMTLDevice> (rv);
var devices = NSArray.ArrayFromHandle<IMTLDevice> (rv);
NSObject.DangerousRelease (rv);
return devices;
}

#if !NET
[Mac (10, 13)]
#endif
[DllImport (Constants.MetalLibrary)]
unsafe static extern IntPtr MTLCopyAllDevicesWithObserver (ref IntPtr observer, void* handler);
static extern IntPtr MTLCopyAllDevicesWithObserver (out IntPtr observer, ref BlockLiteral handler);

#if !NET
[Mac (10, 13)]
#endif
[BindingImpl (BindingImplOptions.Optimizable)]
public static IMTLDevice [] GetAllDevices (ref NSObject observer, MTLDeviceNotificationHandler handler)
public static IMTLDevice [] GetAllDevices (MTLDeviceNotificationHandler handler, out NSObject observer)
{
if (observer == null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (observer));
var block_handler = new BlockLiteral ();
block_handler.SetupBlockUnsafe (static_notificationHandler, handler);

IntPtr handle = observer.Handle;
var rv = MTLCopyAllDevicesWithObserver (out var observer_handle, ref block_handler);
var obj = NSArray.ArrayFromHandle<IMTLDevice> (rv);
NSObject.DangerousRelease (rv);

unsafe
{
BlockLiteral* block_ptr_handler;
BlockLiteral block_handler;
block_handler = new BlockLiteral ();
block_ptr_handler = &block_handler;
block_handler.SetupBlockUnsafe (static_notificationHandler, handler);
block_handler.CleanupBlock ();

var rv = MTLCopyAllDevicesWithObserver (ref handle, (void*) block_ptr_handler);
var obj = NSArray.ArrayFromHandle<IMTLDevice> (rv);
observer = Runtime.GetNSObject (observer_handle);
NSObject.DangerousRelease (observer_handle); // Apple's documentation says "The observer out parameter is returned with a +1 retain count [...]."

if (handle != observer.Handle)
observer = Runtime.GetNSObject (handle);
return obj;
}

return obj;
}
#if !NET
[Mac (10, 13)]
#endif
[Obsolete ("Use the overload that takes an 'out NSObject' instead.")]
[BindingImpl (BindingImplOptions.Optimizable)]
public static IMTLDevice [] GetAllDevices (ref NSObject observer, MTLDeviceNotificationHandler handler)
{
var rv = GetAllDevices (handler, out var obs);
observer = obs;
return rv;
}

internal delegate void InnerNotification (IntPtr block, IntPtr device, IntPtr notifyName);
Expand Down
Loading

0 comments on commit ca0cab7

Please sign in to comment.