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

591 Коммитов

Автор SHA1 Сообщение Дата
Joao Matos bbdb54218c Merge branch 'objc' of github.com:mono/embeddinator-4000 2017-04-17 15:58:25 +01:00
Joao Matos 801e852c0c [tests][c] Added a few more tests for exceptions. 2017-04-17 15:49:36 +01:00
Joao Matos 6093ee586e [c] Improve error and memory handling for throwing ctors. 2017-04-17 15:45:54 +01:00
Joao Matos ee1d6acd74 [tests][c] Provide our own test runner main and setup a dummy error handler. 2017-04-17 15:44:52 +01:00
Joao Matos 11aba98d4a [tests][c] Added a few more tests for types. 2017-04-17 15:13:21 +01:00
Sebastien Pouliot 27e5f34941 [objc] Add basic (readonly) support for fields (#129)
We cannot access them directly but we can provide (ObjC) property
wrappers around them, making them usable from ObjC code.
2017-04-17 10:03:46 -04:00
Joao Matos 3bc2bd73bb [tests][c] Added a few more tests for constructors. 2017-04-17 14:50:33 +01:00
Joao Matos 6ae125e930 [c] Print managed char types as GLib unicode chars. 2017-04-17 14:44:46 +01:00
Joao Matos bf380e7490 [ast] Do not use spaces when joining internal managed names. 2017-04-17 14:44:11 +01:00
Joao Matos caeab300ed [tests][c] Added a few more tests for namespaces. 2017-04-17 13:37:25 +01:00
Joao Matos 95bb6f2ea2 [tests][c] Added a few more tests for properties. 2017-04-17 13:37:07 +01:00
Joao Matos 3c30c0a238 [ast] Changed how we keep the managed Mono type name in the AST. 2017-04-17 13:36:24 +01:00
Alex Soto a14fb87310 [objc] Add call to mono_domain_set_config to avoid ConfigurationErrorsException (#127)
A ConfigurationErrorsException was raised when trying to use WebClient/HttpClient
right now we are setting mono_domain_set_config's base_dir to current working
directory and giving it a non existent app config. We might want to adjust
this settings in the future when needed.

Ref 57f5187ad2
2017-04-14 18:18:00 -04:00
Sebastien Pouliot 35bc36e0c4 [objc] Warn if default values are used on parameters (#126)
Right now this is ignored [1] so we warn about them.

[1] https://github.com/mono/Embeddinator-4000/issues/73
2017-04-14 15:13:31 -04:00
Sebastien Pouliot 943b1da124 [objc] Generated (property) indexers as methods (#125)
That's basic support. The nicer way would be to use subscripts [1]

[1] https://github.com/mono/Embeddinator-4000/issues/122
2017-04-14 15:13:20 -04:00
Sebastien Pouliot 24a1f3e543 [objc] Fix the case where bound type A creates instance of bound type B (#121)
As Alex pointed out this scenario requires the `_object` field to be
public.
2017-04-13 22:24:57 -04:00
Sebastien Pouliot 64b7df0d19 [objc] Generate better looking names for operators (#120)
Remove the `op_` prefix on operators.

Also fix a (non fatal) typo, extra `)`, when computing mono signatures.
2017-04-13 21:41:21 -04:00
Sebastien Pouliot 44b14b6e67 [objc] Add support for enums and [Flags] (#119) 2017-04-13 21:07:52 -04:00
Sebastien Pouliot 02202b7743 [objc] Add support for structs / valuetype (#118) 2017-04-13 17:59:28 -04:00
Sebastien Pouliot 2f52100568 [object][processor] Filter and warn about unsupported C# features/types (#117)
This allow the tool to produce something on existing binaries, which
will make testing easier as we go forward.
2017-04-13 15:21:39 -04:00
Joao Matos 7665414327 [build] Re-generate build projects. 2017-04-13 13:12:35 +01:00
Joao Matos e434cfdc01 [java] Added Java JNA native invocation declaration generator. 2017-04-13 03:58:02 +01:00
Joao Matos b0cd521933 [c] Simplify some generation code by using interpolation strings. 2017-04-13 03:57:35 +01:00
Joao Matos bcbdf3379d [c] Move C-specific passes setup code from the driver to the C generator. 2017-04-13 03:57:09 +01:00
Joao Matos 32197278a6 [c] Extract method identifier generation code to its own method. 2017-04-13 03:56:40 +01:00
Joao Matos 50a5b493ea [java] Re-use method parameters printing code from type printer. 2017-04-13 03:54:55 +01:00
Joao Matos c0f404bfd9 [java] Re-use compatible constructor in JavaSources.
This makes sure we initialize TypePrinter correctly even if we use this ctor overload.
2017-04-13 03:54:26 +01:00
Sebastien Pouliot 4c60ece830 [objc] Add support for `ref` and `out` arguments (#115) 2017-04-12 21:20:37 -04:00
Alex Soto a33c458113 [objc] Avoid objc ctor inheritance. Fixes issue #72 (#103)
.NET .ctor are not inherited but `init*` methods are in ObjC, we now
mark as `NS_UNAVAILABLE` the ctors that are not available.

Also this commit introduces `objcgenerator-helpers.cs` which its main
intention is to move the small ObjC related functions like
`GetSignatures` or `GetUnavailableParentCtors` to avoid
polluting too much `objcgenerator.cs` readability
2017-04-12 21:20:21 -04:00
Rolf Bjarne Kvinge f92f01b0b0 [objc] Add support for --abi to limit the number of architectures we build. Fixes #74. (#114) 2017-04-12 13:52:20 -04:00
Rolf Bjarne Kvinge d5d341431e [tests][objc] Build debug tests into a subdirectory as well. (#108)
* [tests][objc] Build debug tests into a subdirectory as well.

This cleans up the current directory quite a bit.

Also modify the cli/perf tests a little bit to be able to run the
debug/release versions in parallel.

* [tests][objc] Don't fail to create directory if directory already exists.

* [tests][objc-cli] Make sure libmanaged.dylib is built before xctest.

Since the corresponding xcode project builds libmanaged.dylib if it's not
already built (by executing make), we may end up with two make process trying
to build the same target simultaneously, which breaks everything.
2017-04-12 17:02:16 +02:00
Rolf Bjarne Kvinge 98ac5de4eb [objcgen] Create an embedder class that contains the state required to run the embeddinator. (#110)
This makes it easier to test, because Driver.Main can be called multiple
times, each time independent from previous executions.
2017-04-12 08:57:26 -04:00
Rolf Bjarne Kvinge 75dfc163b5 [objc] Add a header (embeddinator.h) that's meant to be included by generated headers. (#109)
This way we can limit the API surface of the generated code.
2017-04-12 08:55:44 -04:00
Rolf Bjarne Kvinge 346dcf64f2 [objc] Warnings are good. (#107) 2017-04-12 08:50:18 -04:00
Rolf Bjarne Kvinge eb8a9970af [objc] Use msbuild instead of xbuild. (#106)
This prevents fleeting visions of red text in the terminal.
2017-04-12 08:49:38 -04:00
Sebastien Pouliot a16e5478fe [objc][generator] Produce better names for ObjC methods (#105)
* Better name for setter only properties, e.g.
	-       [query set_Secret: 1];
	+       [query setSecret: 1];

* Second method argument should be lowercased, e.g. `second`
	[Methods_Parameters concatFirst:@"first" second:@"second"]

* Reduce some code duplication, to avoid fixing things multiple times, e.g.
	* Unify the signatures generation for ObjC and Mono;
	* Unify the parameter marshaling code (the one for methods was missing a lot)

* Simplify `ImplementMethod` arguments
2017-04-12 07:48:25 +02:00
Alex Soto dbc3c9287b [objc] Disable the `new` selector when no `init` is available (#101)
We currently disable the `init` ctor when is not needed i.e. static
classes in .NET but we should also disable the `new` static selector
since you could do `[foo new]` and get an instance.
2017-04-11 16:38:51 -04:00
Vincent Dondain bb16097c23 [objc][generator] Update type/pointer spacing to follow ObjC conventions (#95)
* [objc][generator] Update type/pointer spacing to follow ObjC conventions

The convention is that there's a space between the type and the pointer character (*) in Objective-C.
See: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html#//apple_ref/doc/uid/20001282-BCIGIJJF
_Note: Apple's frameworks are using this convention too._

* [objc][generator][tests] Fixed NSString * test
2017-04-11 12:00:22 -05:00
Rolf Bjarne Kvinge 727f82c725 [objc] Fix use-after-free by freeing after use. (#99)
The `path` variable is accessed later than first thought when an error occurs,
so we need to make sure to only free it after all uses are done.
2017-04-11 17:30:42 +02:00
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
Joao Matos 9fedc6a59c [tests] Fixed path to JNA Jar file to work with non-submodule'd JNA. 2017-04-11 13:09:37 +01:00
Joao Matos 0f370e3d2c Merge branch 'objc' 2017-04-11 12:52:42 +01:00
Joao Matos 190f3d3d3f [java] Remove translation units when getting package names. 2017-04-11 12:51:41 +01:00
Joao Matos ea0bd2f1dc [java] Minor formatting fixes. 2017-04-11 12:51:19 +01: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