Create a table of interface -> protocol in the static registrar, since we need
to be able to look up a protocol given a managed type without looking at the
(possibly linked away) [Protocol] attribute.
* [registrar] Skip informal protocols when enumerating the protocols a type implements.
This prevents the registrars from generating this (`NSMenuValidation` is an informal protocol):
@interface __monomac_internal_ActionDispatcher : NSObject<NSMenuValidation> {
}
@end
which is not correct.
* [registrar] Don't skip real protocols implemented by informal protocols.
* [generator] Propagate the IsInformal value to [Protocol] attributes on models.
We shouldn't put [Protocol] attributes on models in the first place, but at
least do it right if we do it.
* [NSObject] Don't conform to informal protocols.
* [tests] Fix relative paths in mmptest and make cloned XM nunit projects work properly.
Fixes this build problem with mmptest:
/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/mmptest/CustomBuildActions.targets: error : Command 'make bin/SimpleClassDylib.dylib bin/SimpleClassStatic.a bin/Mobile-static/MobileBinding.dll' exited with code: 255.
Fixes https://github.com/xamarin/maccore/issues/633.
* [mmp] Improve Driver.IsDefaultMarshalingManagedExceptionMode to work before MarshalManagedException has been initialized.
Fixes this test failure:
1) Failed : Xamarin.MMP.Tests.MMPTests.UnifiedDebugBuilds_ShouldLinkToPartialStatic_UnlessDisabled
Debug build should use partial static registrar
Expected: True
But was: False
This regressed in 0561618460, where we wouldn't
properly select the partial static registrar because the initialization order
changed and we'd do it before selecting the default exception marshaling mode.
Changing Driver.IsDefaultMarshalingManagedExceptionMode to work before
MarshalManagedException has been initialized to its default value fixes the
problem.
* [src] Fix installing pdbs for MonoTouch.Dialog and MonoTouch.NUnitLite.
The pdb rules I've removed here didn't do anything (no recipe, only a
dependency, which meant that the rule to install them wouldn't execute because
of some reason only make understands).
Instead implement this correctly: one command (running the C# compiler)
produces both the dll and the pdb, and the way to express this in a makefile
is to use a pattern rule [1] with two targets (the dll and the pdb), and both
targets having with the same stem (it can be anything, I chose the path
separator because that was simplest, even though it looks somewhat strange).
[1]: https://www.gnu.org/software/make/manual/html_node/Pattern-Examples.html#Pattern-Examples
* [src] Make sure that the output is always a dll.
In the previous commit I changed these rules to state that the same recipe
would build both the dll and the pdb.
A problem arises when the file that ends up executing the recipe is the pdb,
in which case we can't say that the output from the compilation is the target
(`-out:$@`), because that would write the assembly with the pdb's filename.
So change the output to be a dll instead.
Improved linker to:
* Not mark protocol interfaces by the mere virtue of having a type that
implements them. This is implemented by not marking protocol interfaces when
they're implementing a class, but instead when a method implementation is
found to implement a method from a protocol interface.
* Mark the wrapper type for protocols (this allows us to remove the Protocol
attribute, since that's the link between the protocol and its wrapper type).
* Remove the [Protocol], [ProtocolMember] and [Adopts] attributes.
The static registrar still needs some of the information linked away, so a few
changes are required to make it available post linker.
Generate table of protocols and their corresponding wrapper type in the static
registrar, so that we don't have to look for this information using the
dynamic registrar at runtime.
Fix warning about ignored optimizations to include 'register-protocols', since
it has conditions not in other optimizations (both the static registrar and
the linker must be enabled).
Make the generated static registrar code implement protocols from [Adopts]
attributes, so that we can just query the ObjC runtime to see if a type
implements a protocol instead of keeping this information around ourselves.
There's only one static registrar now, so there's no need for code to select
which one, just create the one and only.
Also unify this code between mtouch and mmp.
Bindings trying to override members with that attribute would produce a
```
error BI1055: bgen: Internal error: failed to convert type 'ObjCRuntime.RequiresSuperAttribute, Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. Please file a bug report (https://bugzilla.xamarin.com) with a test case.
```
Fixes https://github.com/xamarin/maccore/issues/632