Граф коммитов

3 Коммитов

Автор SHA1 Сообщение Дата
Sebastien Pouliot a2d9c80cb5
[homekit] Expose weakly-typed API since the constants are extensible. Fixed #60303 (#3025)
This is a case of NSString enum extensibility - even if this framework does not use the usual `NS_EXTENSIBLE_STRING_ENUM` macro (which is recent and have not been applied for all framework / headers).

Minimally we need to provide alternative, weakly typed, `NSString`-based API wherever the (extensible) enums types are used. Not the best API (even if we can minimize it's use with `[EditorBrowsable (EditorBrowsableState.Advanced)]`) but C# enums can't be extended this way.

Also, even if less urgent, we need to make the enum-generated helper aware of the extensibility so they do not throw, making it easier to mix strongly and weakly typed code (instead of choosing one over the other).

Taking the first step for `xcode92` with the enum-backed constants in HomeKit, i.e.
* HMAccessoryCategoryType
* HMCharacteristicType
* HMServiceType
* HMSignificantEvent

Reference
https://bugzilla.xamarin.com/show_bug.cgi?id=60303

* [tests] WeakSignificantEvent is a weakly typed alternative (not a weak argument semantic)
2017-11-21 20:50:33 -05:00
Sebastien Pouliot 168245c44e [generator] Don't output ArgumentSemantic when they are not required (#1278)
This reduce the metadata size and this information, even if part of the
header files, is not required (as some types are just not refcounted)

E.g.
	public bool MicrophoneEnabled {
		[Export ("isMicrophoneEnabled", ArgumentSemantic.UnsafeUnretained)]

should be

	public bool MicrophoneEnabled {
		[Export ("isMicrophoneEnabled")]

This could have been done in different places but not generating them has
the smallest impact versus:

1. Check bindings input and report them as errors
	- con: break existing binding code;
	- con: sharpie outputs them;

2. Removed by the linker
	- con: linking not always enabled, e.g. 3rd party bindings
	- con: extra logic == extra time for each build

Generator diff
https://gist.github.com/spouliot/cc36e68bf7bd6097064ed6ba0bb3275a
2016-12-01 17:25:30 -05:00
Sebastien Pouliot 00ada0f773 Move parts of dontlink tests into new introspection tests (#32)
Those tests needs to be run with the linker disabled since they use
reflection for most of their work.

The original dontlink (for linker tests) was becoming too large in
some configuration (e.g. tvOS release with bitcode) but this was
due to other BCL assemblies (not the introspection tests)
2016-05-04 20:14:32 -04:00