* [objc][generator] Use metadata token lookup when building release
where release is non-debug.
https://github.com/mono/Embeddinator-4000/issues/82
* [tests] Run test-cli and perf-cli in release (non debug) mode
- Don't expose `MonoEmbedObject* _object;` in the public headers - it's
not meant to be used outside the generated code (but make it @public);
- Don't expose `dealloc` in the headers - it's not meant to be called
from public code;
- Call `__initialize_mono` when loading assembly image, not class - the
later happens way more often;
- Drop `__lookup_class_*` functions in favor of `+initialize`;
- That makes it possible to remove the `__lookup_class_*` call from methods;
It's similar to XI/XM NSObjectFlag - we need a different road to call
the base classes without calling managed code twice (e.g. the Super
and Base tests for exceptions).
Note: `init` is not always exposed, so we cannot trust it blindly.
This allow the same "internal" `initWithSuper` to be re-used to return
instance of types being bound (e.g. a `+create` without a `-init`).
* [tests] [objc-cli] Improve a few Makefile targets to have correct dependencies.
* [objc] Generate a dealloc method that handles object destruction.
* [objc] Fix a memory leak when searching for assemblies.
`mono_embeddinator_search_assembly` returns a string that must be freed, so
free it.
* [objc][tests] Add leak tests.
* [tests][objc] Try running leaks with sudo if we don't have a controlling terminal.
Otherwise this happens on Jenkins:
> leaks[33383]: [fatal] unable to ask for permission to examine process; run tool using sudo, or without redirecting stdin and stderr.
* [objc] Fix chained init methods and avoid chaining dealloc.
In an init method we must only create the managed object if a derived class
hasn't already created it.
Also we must only dealloc once in the inheritance hierarchy.
This also handle the case of setter-only properties (generated as a
set* method).
Unit tests added for existing methods (previously not generated)
Replace PR https://github.com/mono/Embeddinator-4000/pull/63
E.g. `public class SuperUnique : Unique {}`
This raise an interesting issue (to be solved later) since ObjC and .NET
semantics differs for init*/.ctor. A test case (with a FIXME) is added.
and I now recall why headers were a bad idea:
./bindings.h:75:39: error: attempting to use the forward class 'Constructors_Unique' as superclass of 'Constructors_SuperUnique'
so the ordering of forwarders had to be altered a bit.
Also remove the NSAutoreleasePool code, the current code doesn't build with
ARC, and in any case it's the consumer's responsibility to ensure there's an
NSAutoreleasePool on the stack.
so we don't have to to it twice - as filtering will only become more
complex over time.
Also sort the types so it's easier to find them (e.g. when listed in the
class forwarders) and adjust some WriteLine so make generated code easier
to read.
Remove the 'libmanaged' target from the Xcode test project, and instead link
with the libmanaged.dylib that the embeddinator compiles. This ensures we're
not compiling with different compiler flags in the Xcode project.
This also requires adding an rpath to the built library so that the test
executable can find it.
Also add makefile target to run the Xcode test project from the command line.
* EM0000 is now shown for unhandled exceptions - asking for a bug report
to be submitted;
* EM0001 is reported when the output directory cannot be found;
* EM1000 is reported when the generator throws a NotImplementedException,
no bug report is required, but contributions are welcome :)
This allows debugging the generated code with Xcode as well as
running the native unit tests with XCTest (which might not be the
best tool but it's good to support).
This commit requires a addition to mono_embeddinator so we can
override where the assemblies are loaded from - we cannot assume
they will be with the executable (e.g. plugin) and we hit this
case with Xcode unit tests.