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

2779 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge ac1c33255d [registrar] Add support for BindAs conversion between NSNumber and enums. 2017-07-06 20:27:14 +02:00
Rolf Bjarne Kvinge b189d784cc [tests] Restrict some tests to the required Xcode version. 2017-07-06 20:27:13 +02:00
Rolf Bjarne Kvinge 16f6c7951e [registrar] Make sure to include the required headers for the generated BindAs glue code.
Since the native signature doesn't match the managed signature, we need to
manually check the type of each conversion and make sure the required headers
are included.
2017-07-06 20:27:13 +02:00
Rolf Bjarne Kvinge bdd4e48cfb [linker] Preserve smart enum conversion methods when needed. 2017-07-06 20:27:13 +02:00
Rolf Bjarne Kvinge f0fdb0d074 [runtime] Don't freak out at startup if we can't find the NSValue or NSNumber classes.
They might have been linked away.
2017-07-06 20:27:13 +02:00
Rolf Bjarne Kvinge 4b597841ed [runtime] Use the native equivalent of Type.GetTypeCode to do fewer string comparisons. 2017-07-06 20:27:12 +02:00
Rolf Bjarne Kvinge b36bb3ef5a [generator] Don't generate a 'GetConstant (T?)' and 'GetNullableValue' for smart enums.
Instead inline the corresponding code in the generator, so that we don't add a
lot of metadata for little benefit.

Generator diff (compared with the commit before starting to generate
GetConstant/GetNullableValue (32fb0b65dd)):
https://gist.github.com/rolfbjarne/440f3a78089098881145dfb231d86d66 (empty).
2017-07-06 20:27:12 +02:00
Rolf Bjarne Kvinge 9166b36d6f [generator] Print nicer typenames in the BindAs attribute.
Diff (empty): https://gist.github.com/rolfbjarne/8604c61ce33f8352e7ee75cb5c7a318e
2017-07-06 12:10:22 +02:00
Rolf Bjarne Kvinge 34e074369b [registrar] Improve an error message. 2017-07-06 11:20:27 +02:00
Rolf Bjarne Kvinge 24eaf38a8f [registrar] Simplify code a bit and fix a FIXME. 2017-07-06 11:20:20 +02:00
Rolf Bjarne Kvinge 5c008277ec [ObjCRuntime] Add a null check. 2017-07-05 09:03:25 +02:00
Rolf Bjarne Kvinge 098c6876fa [mtouch] Minor adjustments to get error messages right. 2017-07-05 08:54:42 +02:00
Rolf Bjarne Kvinge 7a12600031 [registrar] Make mmp-specific code mmp-specific. 2017-07-04 20:10:54 +02:00
Rolf Bjarne Kvinge f53e9da0d7 [mtouch] Minor adjustments to get error messages right. 2017-07-04 20:07:20 +02:00
Rolf Bjarne Kvinge ec05d9560e [tests] Use a smart enum type available in all profiles for generated tests. 2017-07-04 18:58:17 +02:00
Rolf Bjarne Kvinge 3ce435d470 [generator] Don't use extension methods in generated code.
Extension methods require the containing class' namespace to be in a `using`,
which we can't easily do (currently) for user code, since we hardcode all our `using`s.

So just call the static extension method directly instead of relying on syntax
sugar.
2017-07-04 18:56:43 +02:00
Rolf Bjarne Kvinge fb463ed921 [registrar] Don't require private mono symbols for BindAs support.
The two functions mono_class_is_nullable and mono_class_get_nullable_param are
private mono symbols, which means we can't call them when using Xamarin.Mac
with libmono from a dynamic library.

Implement a fallback for this case, where we call a managed method when these
functions are not available (and restrict this workaround to Xamarin.Mac only,
since it's not needed for Xamarin.iOS).
2017-07-04 18:33:32 +02:00
Rolf Bjarne Kvinge 7ecbc7abee [registrar] Add support for the BindAs attribute. 2017-07-04 07:35:29 +02:00
Rolf Bjarne Kvinge d3a505fa24 [tests] Add mtouch tests for the BindAs attribute. 2017-07-04 07:35:29 +02:00
Rolf Bjarne Kvinge 2fb35682a2 [tests] Add generated runtime tests for the BindAs attribute. 2017-07-04 07:35:28 +02:00
Rolf Bjarne Kvinge 4c68fb81ad [Foundation] Make NSArray.FromNSObjects return null on null input.
This makes it easier to generate code that uses this function and which can
get null input from Objective-C.
2017-07-04 07:31:13 +02:00
Rolf Bjarne Kvinge 24ad89261f [generator] Generate a 'GetConstant (T?)' and 'GetNullableValue' for smart enums.
This makes it possible to also generate code that works properly with nullable
smart enums (both the managed enum and the native string).

Generator diff: https://gist.github.com/rolfbjarne/90324a90de2d812eec078756d3ad2b66
2017-07-04 07:31:13 +02:00
Rolf Bjarne Kvinge 32fb0b65dd [src] Change Stret.Need* to take the return type itself, instead of the MethodInfo.
This makes it possible to check if a type that isn't the return type of a
MethodInfo needs stret.
2017-07-04 07:31:13 +02:00
Rolf Bjarne Kvinge b85b12cba5 [generator] Add helpful make target to only rebuild the generator. 2017-07-04 07:31:13 +02:00
Rolf Bjarne Kvinge 49dfc88545 [generator] Don't try creating NSNumber/NSValue for null.
Generator diff (empty): https://gist.github.com/rolfbjarne/eaf290c19bdd1845a2bdd40d5fe0d88f
2017-07-04 07:31:13 +02:00
Alex Soto 06521b2e59 [generator] Add nullcheck (?.) when using nullables with BindAs
Generator diff: https://gist.github.com/rolfbjarne/8dcc78f9355b4fc621e98e3e7544baa9
2017-07-04 07:31:13 +02:00
Alex Soto 81e1340865 [generator] Persist BindAs attribute information in generated code.
Persisting BindAs attributes is required for the registrars to be able to
handle methods with BindAs attributes correctly.

Generator diff: https://gist.github.com/rolfbjarne/0fafbce9373ff1f407839a20ea5e72e9
2017-07-04 07:31:13 +02:00
Rolf Bjarne Kvinge 492d1c9c2f [ObjCRuntime] Remove Class.RegisterMethods, it's XI/Classic only, which is dead. (#2286)
This allows us to remove a bunch of other code, which was useless and not
needed anymore, but still executed.
2017-07-04 07:29:36 +02:00
Rolf Bjarne Kvinge f610917d4e [generator] Exclude pdb files from the diff. (#2287) 2017-07-04 07:29:17 +02:00
Rolf Bjarne Kvinge 6ce702798f [generator] Fix a few BindAs typos. (#2284)
Generator diff (no change): https://gist.github.com/rolfbjarne/02444b88124a0fda857f10745f6ffc40
2017-07-03 18:19:32 +02:00
Jeffrey Stedfast 6351aef095 [msbuild] Don't define __IOS__ for tvOS binding projects (#2274)
* [msbuild] Don't define __IOS__ for tvOS binding projects

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=57764

* minor fixups

* Conditional compilation.
2017-06-30 12:35:48 -04:00
Andy Martin 340963fd96 [uikit] renamed tableview to tableView to follow naming convention (#2247)
* renamed tableview to tableView to follow naming convention

* added requested changes from dalexsoto
2017-06-28 20:15:08 -04:00
Rolf Bjarne Kvinge 2448108976 [monotouch-test] Allow more values for MACaptionAppearanceGetDisplayType.
On at least one of my devices I get MACaptionAppearanceDisplayType.AlwaysOn,
while the locale is 'en'.

So just allow all valid enum values for the return type.
2017-06-28 12:31:25 -05:00
Rolf Bjarne Kvinge 22a01fd6f8 [mtouch] Check for __Internal P/Invokes after processing P/Invokes for exception marshaling. Fixes #57833. (#2261)
When we process P/Invokes to add support for exception marshaling, we may
change P/Invokes to be __Internal. This means that we need to move the check
for __Internal P/Invokes to after processing P/Invokes for exception
marshaling.

https://bugzilla.xamarin.com/show_bug.cgi?id=57833
2017-06-28 17:09:15 +02:00
Rolf Bjarne Kvinge 2fa55d410d [mtouch] If a P/Invoke is used by any assembly that looks up the native symbol using dlsym, it's a required symbol. Fixes #57826. (#2260)
Previously the assumption was that if an assembly not using dlsym references a
native symbol, it's not a required symbol. This is true as far as the native
linker goes: the native linker will see that the native symbol is referenced
by the AOT-compiled code, and it won't be removed.

However, we use also this exact logic to create the list of functions we ask
the native strip command to preserve, and in this case we need to include all
symbols needed in all assemblies that looks up native functions using dlsym.

https://bugzilla.xamarin.com/show_bug.cgi?id=57826
2017-06-28 16:26:26 +02:00
Rolf Bjarne Kvinge 1d7d414795 [common] Fix StringUtils.Quote to quote backslashes too. Fixes #57768. (#2248)
Some Quote implementations quoted backslashes, some didn't. When selecting a
common implementation, one of the implementations that didn't quote
backslashes won, and the rest were forgotten. Almost. Except for the MT0106
test, which started failing, thus exposing the winner's deficiencies.

So dethrone the implementation that won and reinstante the importance of the
backslash.

https://bugzilla.xamarin.com/show_bug.cgi?id=57768
2017-06-28 14:45:53 +02:00
Rolf Bjarne Kvinge b4d695a4fa [monotouch-test] Make sure we don't strip symbols in any configuration. Fixes #57811. (#2259)
https://bugzilla.xamarin.com/show_bug.cgi?id=57811
2017-06-28 14:34:26 +02:00
Bernhard Urban 15c9275b43 [runtime] set mono_set_crash_chaining (#2184)
it was introduced a while ago for Xamarin-Android:

8ffc4070a9

8d7cc2b800/src/monodroid/jni/monodroid-glue.c (L2840)

it potentially helps to get even better crash reports.
2017-06-27 17:40:30 -04:00
Alex Soto 8c55dd888a Complete support for [BindAs] (#2220)
* [registrar] BindAs uses Nullable types so allow them to be registered as NSObjects

BindAsAttribute allows to bind NSValue and NSNumber into more
accurate C# types lyke bool?, int? etc. so we must teach registrar
about this.

* [tests][introspection] Teach intro about BindAs and Nullable types

Introspection will currently fail if BindAs is used, introspection
will report that the incorrect type is registered so we need to skip
this check if Nullable type is found in the signature

* [introspection] Add better type checking instead of totally skipping the type when Nullable type is encountered

Introspection will currently fail if BindAs is used. Introspection
will report that the incorrect type is registered so we need verify
if a Nullable type is found in the signature and check against of
a withelist of BindAs supported types

* Revert "[registrar] BindAs uses Nullable types so allow them to be registered as NSObjects"

This reverts commit 911eab97b7.

* [tests] Add comment about where to find BindAs types
2017-06-26 10:56:10 -05:00
Alex Soto aa4797decd [tests] Fix bug 57699 - [iOS]InternalsTest failure (Linkall) tests on device (#2243)
Strip native debugging symbols should not be checked for debug builds
2017-06-22 17:04:40 -05:00
James Clancey e7a5dd2af1 MPNowPlayingInfo is available on iOS,MacOS, and TvOS (#2178)
* Added MPNowPlaying info to MacOS/TvOS
2017-06-22 09:33:09 -04:00
Rolf Bjarne Kvinge 1a2633ca1e [runtime] Fix random parallel build error. (#2237)
Very occasionally this may happen:

    /bin/sh: /Users/builder/data/lanes/5024/08614af6/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/Frameworks/Xamarin-debug.framework/Info.plist: No such file or directory
    make[4]: *** [/Users/builder/data/lanes/5024/08614af6/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/Frameworks/Xamarin-debug.framework/Info.plist] Error 1

which is fixed by using the right dependencies for the Info.plist target.
2017-06-21 16:37:48 +02:00
Rolf Bjarne Kvinge fe217e641c [generator] Fix c&p error in type mapping for CMTimeMapping. (#2238) 2017-06-21 16:36:45 +02:00
Nick Berardi 22b3dadb5a NSActivityOptions.IdleDisplaySleepDisabled had wrong value (#2232)
This was due to an integer overflow.  The original value was based on Int32
1 << 40 == 256

The correct value should be based on a UInt64.
1UL << 40 == 1099511627776
2017-06-21 09:10:21 +02:00
Rolf Bjarne Kvinge 0a316951a3 Bump mono to get cecil fix for bug #56808. (#2221)
https://bugzilla.xamarin.com/show_bug.cgi?id=56808
2017-06-16 09:57:57 +02:00
Jeffrey Stedfast 5d6d244d04 [msbuild] Properly generate dSYMs for WatchKit2 appex's (#2215)
* [msbuild] Properly generate dSYMs for WatchKit2 appex's

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=56345

* dSYMs only get generated for iPhone

* Reverted accidental change to mono
2017-06-15 14:03:37 -04:00
Rolf Bjarne Kvinge 257de9c2c0 [mtouch] Normalize strings that refer to assemblies and their paths before comparing them. Fixes #57266. (#2217)
HFS normalizes filenames to Form D when files are stored. This means that an
assembly whose assembly name is stored in Form C might be stored in a file
whose filename is Form D (which you'll get if you use the Form C filename).

However, this is a problem when we've already loaded an assembly and if we
doesn't take normalization into account: we check the cache based on the
filename, but store in the cache based on the assembly name. If those two uses
different normalization schemes, bad things (bug #57266) happen.

So in these scenarios normalize strings before comparing them.

https://bugzilla.xamarin.com/show_bug.cgi?id=57266
2017-06-15 11:24:31 +02:00
Timothy Risi 43f5679323 [macos] Mmp should quote paths when passing arguments to clang. Fixes #56850 (#2140)
* [macos] Mmp should quote paths when passing arguments to clang.  Fixes #56850

* Use the merged Quote from stringutils

* Fix driver also

* Fix tests
2017-06-15 11:15:59 +02:00
Chris Hamons 9accdb3888 Framework tests were still binding non-linked Simple class which errors now (#2216)
- Improve Makefile to rebuild when projects build with errors
2017-06-14 08:33:18 -05:00
Jeffrey Stedfast f010926615 [msbuild] Use @(ReferencePath) instead of @(ResolvedFiles) (#2188)
This allows things to work on both xbuild and msbuild.

In xbuild, both lists are exactly the same and on msbuild,
only @(ReferencePath) exists.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=55147
2017-06-12 13:29:45 -05:00