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
This reverts commit 95d1968856.
Unfortunately with this commit our build fails with
```
[5:06:58] GEN XamMac.CFNetwork.xml
[5:06:58] install: ../../../../xamarin-macios/external/macios-binaries/docs/macOS/classic/XamMac.xml: No such file or directory
[5:06:58] install: ../../../../xamarin-macios/external/macios-binaries/docs/macOS/classic/XamMac.CFNetwork.xml: No such file or directory
[5:06:58] make[6]: *** [../../../../xamarin-macios/external/macios-binaries/docs/macOS/classic/XamMac.xml] Error 71
[5:06:58] make[6]: *** Waiting for unfinished jobs....
[5:06:58] make[6]: *** [../../../../xamarin-macios/external/macios-binaries/docs/macOS/classic/XamMac.CFNetwork.xml] Error 71
```
* [ObjCRuntime] Add support for getting the native ObjC class for a given System.Type without using the dynamic registrar.
* The static registrar now generates a table of any types that skipped
registration (which is currently used for generic types, such as
`NSArray<T>`), that allows us to look up the corresponding native type.
* In Runtime.Class now look in the tables generated by the static registrar to
find the native ObjC class for any given System.Type.
* Store the results in a dictionary so that the lookup isn't slower than
before (in fact it's ~4x faster now).
* [registrar] Elevate debug spew into a proper error.
* [registrar] Don't process 64bit-only skipped types on 32-bits.
This also requires fixing the registrar's parsing of the new [iOS] and [Mac]
availability attributes
Those were missed because xtro did not scan ObjC categories for
`objc_requires_super` attributes.
Fixing the naming mapping (to consider inlined categories) also
uncovered a few API with extraneous [DesignatedInitializer] attributes
Those were deprecated (API) and moved into categories so xtro missed
the designated initializer was removed.
All your `base`, well `super` in ObjC, now belong to us :)
https://github.com/xamarin/xamarin-macios/issues/3253
* [tests][xammac] Fix a few path calculations to not be hardcoded.
* [xharness] Clone XM projects.
Cloning projects before building them will also clone project references,
which will make it possible to build multiple projects in parallel, when those
projects have common project references.
Fixes https://github.com/xamarin/maccore/issues/624.
* [xharness] Fix XM project cloning
* Don't clone Classic projects (they're solutions, and xharness doesn't understand them).
* Clonee projects properly when cloning execution tasks.
* [xharness] GuiUnit needs specialized cloning.
The GuiUnit project uses relative paths to write to files outside the project
directory, which means that multiple GuiUnit project files may write to the
same location.
So special-case GuiUnit cloning to make those paths subdirectories of the
project's directory instead.
* [xharness] Process imported targets when cloning projects.
Also make the msbuild-mac's custom targets file independent of the location of
the project file by making all paths relative to the custom targets file.
Now that we don't use pmcs anymore, VSfM can actually understand our source code.
So in order to make the editing experience in VSfM better:
* Include all the source files in the csprojs.
* Make sure to not build into the same directories as the normal build
process, since the csproj don't build the official version of the
assemblies.
* Misc other fixes to make it all build.