xamarin-macios/msbuild/Xamarin.Mac.Tasks/Tasks
William Kent 8425129eeb Add bindings for NSXpcConnection and related types (#7001)
* Add bindings for NSXpcConnection and related types

* Re-add accidentally deleted file

* Typo fix

* Add NSXpcInterface.CreateForType()

* Add MethodInfo-taking overloads to NSXpcInterface

* Add null check

* Mark methods with wrappers as internal

Also fixed a formatting bug that I didn't catch earlier.

* Change NSXPCProxyCreating methods to be strongly typed

I got rid of the NSXpcProxyCreating interface in this change,
because its only user was NSXpcConnection, and I needed to
inline the protocol methods into the class definition so I
could mark them as [Internal].

* Add missing casts

* Add NSXpcConnectionOptions enum

* Convert NSXpcConnection constructor to use new enum

* Remove now-unneeded manual constructor

* Fix bgen warning

* Typo fix

* Fix selector

* Remove incorrect use of BindAsAttribute

Per the docs, this only works for enums backed
by NSNumber and NSValue, not for enums
passed directly as integers.

* Fix duplicated selector errors

* Throw ArgumentException instead of InvalidOperationException

* Extend AppExtension targets to produce XPC services

Rather than create an entirely new set of targets
(that would require VS and VSMac updates to properly
consume), I have decided to use the existing AppExtension
build targets to produce XPC services as well. All the
user must do is set the $(IsXPCService) property to true in
their project file, and the targets will do The Right Thing™.

Note that this support is Mac-only for now; I may need a bit
of help adjusting them to work on for iOS/watchOS/tvOS, as I
am not as familiar with those platforms.

* Copy XPC service bundles into the correct location

* Move IsXPCService property definition to props file

* Don't pass /extension to mmp for XPC service targets

This would cause the XPC service binary to
be linked incorrectly.

* Add NSXpcConnection/NSXpcInterface.cs files to the build

* Fix build

* Fix build

* Add required type parameter requirements

* Fix type parameter requirements

* Fix return type

* Fix return type of NSXpcInterface.CreateForProtocol ()

* Take ownership of the returned object types

* Adjust XPC service mmp invocation

I need to link the XPC service bundle as if it is an app extension, but
I must not use xamarin_mac_extension_main. I added a new flag to make
this possible.

* Change mmp to correctly construct XPC service bundle

* Set the MonoBundleExecutable Info.plist key for XPC services

* Use the runtime to get the protocol

* Make NSXpcInterface.CreateForProtocol() public

The static registrar must be used for Cocoa to accept the protocol
as a valid XPC interface, but that then seems to break resolving
the protocol from the type. I must therefore hard-code the protocol
name in my code, and that requires I make this constructor public.

* Add XpcInterfaceAttribute

See the doc comment in XpcInterfaceAttribute.cs for why
this type is required. The referenced mmp optimizations
will be added in future commits.

* Add XpcInterfaceAttribute to generator build

* Add support for XpcInterfaceAttribute to the generator

* Force static generation of protocols decorated with XpcInterfaceAttribute

* Change how static registrar translates block parameters

Previously, they would always be marshalled as "id".
This would throw off the XPC subsystem, which parses
the block signature to determine the communication
protocol.

* Undo whitespace noise

* Remove unneeded casts

* Add trailing comma

* Use HasAttribute instead of GetCustomAttribute

* Fix style issues

* Bind NSXpcConnection.auditSessionIdentifier

* Address naming feedback

* Make Get/SetAllowedClasses public

IMHO, passing the selector as a string is just as
usable as passing a MethodInfo, and is also less
verbose if you copy/paste the selector string
from the ExportAttribute. There is no reason why
we cannot have both overloads be public.

* Update overload names to match

* Update more overload names to match

* Make mmp --xpc imply --extension

* Reformat if statement

* Fix build

* Conditionalize creation of PlugIns and XPCServices directories

* Add AutoGeneratedName

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>

* Get rid of ProtocolizeAttribute

* Update availability attributes to please xharness

I actually think xharness is wrong here, since the
NSXPCConnection header lists these types as being
available starting in macOS 10.8.

* Update sharpie ignore files to reflect changes

This should fix the xtro-sharpie test failures CI has been reporting.

* Fix MM4105 error generation

* Adjust error message in test to match mmp

I had to change the error text slightly, because the type of the parameter
cannot be determined where the error is thrown anymore. However, the newer
exception message IMO is just as clear.

* Make exception message match test exactly

* Remove outdated copyright header text

* Remove more outdated copyright header text

* Revert changes to MM4105 error generation

I have a more elegant way of fixing this test now.

* Return "id" if Invoke method cannot be found

This fixes the MM4105 error unit test,
without requiring modification to that test.

* Remove redundant availability attributes

* Add DesignatedInitializerAttribute

* Re-add required code to macOS-Foundation.ignore

* Put DesignatedInitializer on the right constructor

* Update xtro-sharpie ignore files
2019-10-22 15:38:01 +02:00
..
ACTool.cs Build MSBuild targets & assemblies. 2016-04-24 14:48:44 -04:00
ALToolUpload.cs [vsts-938452] Change inheritance order of altool-task classes 2019-08-07 16:09:20 -04:00
ALToolValidate.cs [vsts-938452] Clean up file names and indentations 2019-08-07 16:09:58 -04:00
Archive.cs Add macOS Xcode archive support (#5862) 2019-04-15 15:20:18 -05:00
BTouch.cs [msbuild] Fix running bgen for Xamarin.Mac. (#1977) 2017-04-10 16:34:49 +02:00
CodesignVerify.cs [msbuild] Repack all iOS Task assemblies into Xamarin.iOS.Tasks.dll (#3168) 2018-01-08 14:29:52 -05:00
CompileAppManifest.cs Add bindings for NSXpcConnection and related types (#7001) 2019-10-22 15:38:01 +02:00
CompileEntitlements.cs [msbuild] Fixed provisioning profile lookups for tvOS (#3216) 2018-01-17 15:18:34 -05:00
CompileSceneKitAssets.cs [msbuild] Provide the correct value for the operating system for tvOS and watchOS to a few tasks. Fixes #6200. (#7226) 2019-10-16 22:14:11 +02:00
CreateBindingResourcePackage.cs Add 'NoBindingEmbedding' style binding project support (#5167) 2018-12-12 09:55:57 -05:00
CreateEmbeddedResources.cs Build MSBuild targets & assemblies. 2016-04-24 14:48:44 -04:00
DetectSdkLocations.cs Made tasks in Mac.Tasks.Core bases; added SessionId 2016-05-26 10:24:13 -03:00
DetectSigningIdentity.cs Add support for Apple Development certificates to Xamarin.Mac MSBuild (#6797) 2019-08-28 11:30:36 -04:00
EmbedProvisionProfile.cs Made tasks in Mac.Tasks.Core bases; added SessionId 2016-05-26 10:24:13 -03:00
IBTool.cs [msbuild] Make Mac IBTool logic consistent with iOS logic (#127) 2016-06-03 13:55:44 -04:00
Metal.cs [msbuild] Provide the correct value for the operating system for tvOS and watchOS to a few tasks. Fixes #6200. (#7226) 2019-10-16 22:14:11 +02:00
MetalLib.cs [msbuild] Update 'metal' binary path for Xcode 10 (#4601) 2018-08-17 10:24:02 -04:00
Mmp.cs Macios symbolicate (#74) 2016-05-31 11:57:47 -04:00
PrepareNativeReferences.cs Build MSBuild targets & assemblies. 2016-04-24 14:48:44 -04:00
ScnTool.cs [msbuild] Provide the correct value for the operating system for tvOS and watchOS to a few tasks. Fixes #6200. (#7226) 2019-10-16 22:14:11 +02:00
TextureAtlas.cs Build MSBuild targets & assemblies. 2016-04-24 14:48:44 -04:00