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

512 Коммитов

Автор SHA1 Сообщение Дата
Sebastien Pouliot 1bdeef1dd8 [objc][generator] Use metadata token lookup when building release (#91)
* [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
2017-04-11 17:21:54 +02:00
Rolf Bjarne Kvinge 00d5ec5ea8 [objc] Get the Xcode location using 'xcode-select -p' to use for our clang compiler flags. (#98) 2017-04-11 10:34:19 -04:00
Rolf Bjarne Kvinge 7de0e3f0cc [objc] Add support fat and static libraries for all platforms. (#97)
[objc] Add support fat and static libraries for all platforms.
2017-04-11 15:25:40 +02:00
Rolf Bjarne Kvinge 2633f39627 [objc] Use _NSGetExecutablePath instead of proc_pidpath to get the executable path. (#96)
Use _NSGetExecutablePath instead of proc_pidpath to get the executable path,
because the latter doesn't exist on iOS.
2017-04-11 14:51:15 +02:00
Sebastien Pouliot e62cb1b80e [objc][support] Move MonoString to NSString conversion into it's own routine (to avoid several dupes in generated code) (#94) 2017-04-11 08:35:10 +02:00
Sebastien Pouliot 9df25e4b18 [objc][driver] Remove duplicated 'Compiling binding code...' message (#93) 2017-04-11 08:33:57 +02:00
Vincent Dondain 8a38ad248a [objc][README] Recommend usage of objcgen.exe instead of MonoEmbeddinator4000.exe (#92)
objcgen.exe has to be used in order to try the new generator (with the latest fixes).
2017-04-11 08:33:38 +02:00
Vincent Dondain 2ae40370a0 [objc][generator] Remove space between method's return type and name (#90) 2017-04-10 17:12:59 -04:00
Vincent Dondain 6980f5ec52 [objc][doc] Update examples and add Objective-C coding guidelines document (#88) 2017-04-10 13:35:33 -04:00
Sebastien Pouliot 112ba1fb0b [objc] Remove non-public information from header files and simplify runtime initialization (#86)
- 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;
2017-04-10 19:13:45 +02:00
Sebastien Pouliot 7d20bde00f [objc] Fix subclassing when `init` is not available (#85)
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`).
2017-04-10 19:12:24 +02:00
Sebastien Pouliot e6e11d7591 [objc] `mono_embeddinator_create_object` now calls `mono_gchandle_new` (#84)
So we need to remove our own call, which overwrites the original one.
2017-04-10 07:00:00 +02:00
Sebastien Pouliot 6a7f73b0c1 [objc][generator] Do not generate a `dealloc` or the `_object` field for static types (#83)
Sadly we can't easily test the presence (or absence) of `dealloc` as this
gets us an error:

> ARC forbids use of 'dealloc' in a @selector
2017-04-10 06:59:25 +02:00
Rolf Bjarne Kvinge 790046d6ac [objc] Improve Makefile dependencies to only rebuild things if needed. (#76) 2017-04-07 20:05:25 +02:00
Sebastien Pouliot 64720b0859 [test][objc] Fix Makefile not to delete leak-at-exit.c (#81)
That one is not a generated file
2017-04-07 17:12:17 +02:00
Rolf Bjarne Kvinge 9900d12dff Auto-provision Xamarin.iOS and Xamarin.Mac. (#80) 2017-04-07 13:47:26 +02:00
Rolf Bjarne Kvinge 79fa12070a [tests][objc] Improve Makefile dependencies to only rebuild things if needed. (#78) 2017-04-07 12:24:53 +02:00
Rolf Bjarne Kvinge b75dc6aa62 [tests][leaktest] Use pid-specific control files. (#77)
Use pid-specific control files so multiple leak tests can run in parallel.
2017-04-07 12:24:39 +02:00
Rolf Bjarne Kvinge c4074e16fb [objc] Assert with a descriptive message if an assembly can't be found. (#75) 2017-04-07 12:24:29 +02:00
Rolf Bjarne Kvinge 21f7a853c1 [objc] Use enums instead of string values for platform/target/compilationtarget, and add initial scaffolding for iOS/watchOS/tvOS + framework support. (#69) 2017-04-06 17:28:24 +02:00
Sebastien Pouliot a13e48abc6 [objc] The same type name can exists in several namespaces (#68)
Not common, but has to work. Unit test added.
2017-04-06 10:15:51 -05:00
Sebastien Pouliot 7eeb4d123d [objc][docs] Start documenting ObjC specific generator features and requirements (#64) 2017-04-06 08:54:43 -05:00
Rolf Bjarne Kvinge c2e0eba081 [objc] Add memory leak tests, and fix a few issues those found. (#65)
* [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.
2017-04-06 15:50:43 +02:00
Sebastien Pouliot 946ed79896 [objc] Initial support for methods (#67)
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
2017-04-06 08:46:24 -05:00
Rolf Bjarne Kvinge d43603791c [objc] Add script to autoprovision mono. (#66) 2017-04-06 15:19:44 +02:00
Sebastien Pouliot 7c2384d729 [objc][generator] Fix subclassing when both types are bound (#62)
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.
2017-04-06 11:59:58 +02:00
Sebastien Pouliot 38357f1ac7 [objc][driver] Command-line options parity with master (#61)
This will help scripts to switch between implementations.
2017-04-06 09:29:16 +02:00
Rolf Bjarne Kvinge 3bae118183 [objc] Enforce ARC. (#60)
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.
2017-04-05 14:08:52 -05:00
Sebastien Pouliot 9db995bfe1 [objc] Add support for non-default init* methods (constructors) (#59) 2017-04-05 08:46:12 +02:00
Sebastien Pouliot ca5545cae4 [objc][tests] Add more unit tests for existing features (#56)
For
* instance properties (uncomment them);
* namespaces;
* exceptions inside `init`;
2017-04-04 09:43:01 +02:00
Sebastien Pouliot e899b7510d [objc][generator] Use the already filtered `types` at generation time (#57)
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.
2017-04-04 09:41:05 +02:00
Rolf Bjarne Kvinge d6003c415b [objc][tests] Remove the 'libmanaged' target from the Xcode cli test project. (#55)
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.
2017-04-03 13:25:34 -05:00
Sebastien Pouliot b560ed5c39 [objc] Add -c[ompile] option to the driver (#54) 2017-04-03 11:53:21 -05:00
Rolf Bjarne Kvinge b89e3cf8a0 [objc] Add support for building the native library with debug information. (#53) 2017-04-03 10:55:50 -05:00
Rolf Bjarne Kvinge c0b00f4222 [objc] Add support for more primitive types. (#51) 2017-04-03 10:42:32 -05:00
Rolf Bjarne Kvinge 7c09a324ef [objc][tests] Automatically rebuild the generator before running tests. (#52) 2017-04-03 10:14:25 -05:00
Sebastien Pouliot d49fc8c666 [objc] Add support for -o (output directory) and -v (verbosity) and add some error codes (#39)
* 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 :)
2017-04-03 09:24:36 -05:00
Rolf Bjarne Kvinge 0ff824da7c [objc][tests] Always rebuild managed.dll before running cli tests. (#50) 2017-04-03 08:55:42 -05:00
Rolf Bjarne Kvinge 3553b9951d [objc][tests] Build the project file instead of having separate build logic. (#49) 2017-04-03 08:55:14 -05:00
Sebastien Pouliot d4775744bf [objc] Add support for default .ctor/init and namespaces (#38) 2017-04-03 08:23:57 -05:00
Sebastien Pouliot fdb0041515 [objc] Add xcode support for objc-cli to build the libmanaged.dylib and it's unit tests (#42)
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.
2017-04-03 14:33:05 +02:00
Sebastien Pouliot 83ec1a965d [objc] Merge master. (#46)
This should fix travis-ci marking all macOS builds as broken/red.
2017-04-02 13:37:16 -05:00
Sebastien Pouliot 514e20f437 [docs] Start a limitations document and add read me for the new directories created in the objc branch (#45) 2017-04-02 13:25:42 -05:00
Sebastien Pouliot 7d1ac85de2 [build] .gitignore had an entry for Makefile so some were not committed previously (#44) 2017-04-02 13:13:47 -05:00
Sebastien Pouliot ef1f06ff4b [docs] Initial version of the best practices document (#40) 2017-04-02 13:12:59 -05:00
Sebastien Pouliot 6e35580f8f [tests] Remove generated files from tests/objc-cli (#41) 2017-04-01 16:28:36 -05:00
Rolf Bjarne Kvinge 257711b8c0 [objc] 'Generate' if assemblies were passed in. (#37) 2017-03-31 13:57:24 -05:00
Rolf Bjarne Kvinge da70fce5b3 [objc] Use Mono.Options. (#36) 2017-03-31 13:17:05 -05:00
Rolf Bjarne Kvinge 34ee3f3376 [objc] Don't ignore native build failures. (#35) 2017-03-31 13:15:36 -05:00
Rolf Bjarne Kvinge 2c7052bf69 [objc] Add support for running tests from the command line. (#34)
* [objc] Add support for running tests from the command line.

* [objc][test] Write test results in NUnit v2 format.

So that Jenkins understands it.
2017-03-31 13:13:51 -05:00