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

59 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 34772d23bc
[Runtime] Don't skip dynamic user type checking as long as dynamic registration is supported. (#11588)
When checking whether a type is a user type or not, we might have to do a
dynamic check if the dynamic registrar is available. Otherwise we may run into
a situation where the static registrar ran during the app build, but then the
app loaded additional assemblies at runtime, and those assemblies contained
user types that were registered using the dynamic registrar, so the static
registrar doesn't know about those custom types (in other words: we need to
check at runtime).
2021-05-18 16:28:09 +02:00
Rolf Bjarne Kvinge c398519565 [tests] Add an ARM64 configuration of xammac tests. 2021-05-11 15:54:39 +02:00
Rolf Bjarne Kvinge 68e67835f1
[xammac tests] Add Bluetooth description in the Info.plist. (#11496)
Otherwise the test app crashes when running within lldb.
2021-05-11 15:54:24 +02:00
Rolf Bjarne Kvinge 93bbfe7a86
[tests] Merge apitest into xammac_tests. (#10276)
* [apitest] Sanitize files by adding missing eols.

* [apitest] Add #if __MACOS__ to all test files.

In preparation for the move into monotouchtest.

* [apitest] Move test files into monotouchtest.

* [tests] Remove the apitest project.

* [monotouch-test] Remove MessagingMac.cs, it's not needed.

* [xammac-tests] Add file PlatformInfo.cs to the build.

* [xammac-tests] Move files into monotouch-test.

* [monotouch-test] Rename test class to not clash with another test class of the same (Objective-C) name.

* [tests] How did this ever work?

Answer: it never did.

* [monotouch-test] Remove duplicated test code.

* [xammac-tests] Define DYNAMIC_REGISTRAR when we're using the dynamic registrar.

* [monotouch-test] Adjust the BundleTest.TestGetBundleId test to cope with having multiple apps for the same bundle id.

* [monotouch-test] Ignore a test that doesn't work with the static registrar (due to a bug in the static registrar).
2020-12-18 11:45:06 +01:00
Rolf Bjarne Kvinge 9e20285ebb
[tests] Merge the msbuild-mac tests into the Xamarin.MacDev.Tests project. (#10129) 2020-12-04 13:05:51 +01:00
Rolf Bjarne Kvinge 9cbde483a9
[tests] Set DEVELOPER_DIR when calling xcrun manually. (#9859)
This fixes build problems that may occur when the various versions of Xcode
(system Xcode, VSMac Xcode, '/Applications/Xcode.app' symlink) don't agree on
which Xcode is THE Xcode:

    CustomMetalSmelting:
      Creating directory "bin/iPhone/Debug-unified/monotouchtest.app".
      xcrun -sdk iphoneos metal -c Resources/fragmentShader.metal -o obj/iPhone/Debug-unified//fragmentShader.air -mios-version-min=11.0
      2020-10-14 09:09:03.985 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IDEWatchSupportUI.ideplugin (com.apple.dt.IDEWatchSupportUI) not present
      2020-10-14 09:09:03.985 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IDEWatchSupportCore.ideplugin (com.apple.dt.IDEWatchSupportCore) not present
      2020-10-14 09:09:03.985 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IBCocoaTouchBuildSupport.ideplugin (com.apple.dt.IDE.IBCocoaTouchBuildSupport) not present
      2020-10-14 09:09:03.985 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for GPUDebuggerOSXSupport.ideplugin (com.apple.dt.gpu.GPUDebuggerOSXSupport) not present
      2020-10-14 09:09:03.985 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IDEOSXSupportCore.ideplugin (com.apple.dt.IDE.IDEOSXSupportCore) not present
      2020-10-14 09:09:03.985 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IDEOSXSupportUI.ideplugin (com.apple.dt.IDE.IDEOSXSupportUI) not present
      2020-10-14 09:09:03.985 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IBAppleTVBuildSupport.ideplugin (com.apple.dt.IDE.IBAppleTVBuildSupport) not present
      2020-10-14 09:09:03.985 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IDEInterfaceBuilderAppleTVIntegration.ideplugin (com.apple.dt.IDE.IDEInterfaceBuilderAppleTVIntegration) not present
      2020-10-14 09:09:03.985 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IDEInterfaceBuilderWatchKitIntegration.ideplugin (com.apple.dt.IDE.IDEInterfaceBuilderWatchKitIntegration) not present
      2020-10-14 09:09:03.986 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IDEInterfaceBuilderWatchKitBuildSupport.ideplugin (com.apple.dt.IDE.IDEInterfaceBuilderWatchKitBuildSupport) not present
      2020-10-14 09:09:03.986 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for GPUDebuggertvOSSupport.ideplugin (com.apple.dt.gpu.GPUDebuggertvOSSupport) not present
      2020-10-14 09:09:03.986 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IDEAppleTVSupportUI.ideplugin (com.apple.dt.IDEAppleTVSupportUI) not present
      2020-10-14 09:09:03.986 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IDEAppleTVSupportCore.ideplugin (com.apple.dt.IDEAppleTVSupportCore) not present
      2020-10-14 09:09:03.986 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for DVTAppleTVSupportCore.dvtplugin (com.apple.dt.DVTAppleTVSupportCore) not present
      2020-10-14 09:09:03.986 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for GPUDebuggeriOSSupport.ideplugin (com.apple.dt.gpu.GPUDebuggeriOSSupport) not present
      2020-10-14 09:09:03.986 xcodebuild[59510:1676867] [MT] DVTPlugInManager: Required plug-in compatibility UUID C80A9C11-3902-4885-944E-A035869BA910 for IDEiOSPlatformSupportCore.ideplugin (com.apple.dt.IDEiOSPlatformSupportCore) not present
      2020-10-14 09:09:04.081 xcodebuild[59510:1676867] [MT] DVTPlatform: Required content for platform watchOS is missing.
      Domain: DVTFoundationErrorDomain
      Code: 4
      Recovery Suggestion: Please reinstall Xcode.
      --
      No Xcode.DVTFoundation.ExtendedPlatformInfo extension found for platform with identifier com.apple.platform.watchos
      Domain: DVTExtendedPlatformInfoErrorDomain
      Code: 2
      --
    xcodebuild : error : Initialization failed. [[...]/xamarin-macios/tests/monotouch-test/monotouch-test.csproj]
      	Reason: Required content for platform watchOS is missing.
    xcrun : error : sh -c '/Applications/Xcode_11.7.0.app/Contents/Developer/usr/bin/xcodebuild -sdk iphoneos -find metal 2> /dev/null' failed with exit code 17920: (null) (errno=No such file or directory) [[...]/xamarin-macios/tests/monotouch-test/monotouch-test.csproj]
    xcrun : error : unable to find utility "metal", not a developer tool or in PATH [[...]/xamarin-macios/tests/monotouch-test/monotouch-test.csproj]
    [...]/xamarin-macios/tests/monotouch-test/monotouch-test.csproj(385,5): error MSB3073: The command "xcrun -sdk iphoneos metal -c Resources/fragmentShader.metal -o obj/iPhone/Debug-unified//fragmentShader.air -mios-version-min=11.0" exited with code 72.
2020-10-14 19:19:00 +02:00
Rolf Bjarne Kvinge fa58a24161
[msbuild] Port the test projects to .NET, and add a test case that compares the built .app (#9706)
Port the iOS/tvOS/watchOS msbuild test projects to .NET, and add a unit test
that builds both the old-style and new-style test projects and compares the
output in the resulting .app directories.

There are many expected differences in the apps, those will be ignored during
the comparison.

There are also numerous features that are not implemented yet in .NET, with
the corresponding adjustments in the comparison logic (they show up as TODO in
the code), these TODOs will be removed as features are implemented in the .NET
build.

There are a couple of test projects that can't be compared yet, because they
just don't build yet. Those are also TODOs.
2020-09-29 08:44:08 +02:00
Rolf Bjarne Kvinge 22fe547944
[tests] Make the .NET bgen tests actually reference the .NET BCL. (#9693)
Make the bgen tests pass in the path to the attribute library, platform
assembly and all the .NET reference assemblies to bgen. This way we execute
these tests using the .NET version of everything.
2020-09-24 14:57:05 +02:00
Rolf Bjarne Kvinge 96615bbd67 [tests] The upstream NUnitLine isn't linker safe, so add an xml file to make sure linking doesn't remove too much.
In particular NUnit uses reflection to get a private method, and the linker removes
the corresponding private method:

1c680b4dc8/src/NUnitFramework/framework/Internal/TestExecutionContext.cs (L552)

So add an xml definition to keep this private method, and modify project files to
pass the xml definition to mtouch and mmp.

Some care needs to be taken to make sure xharness is still able to clone these project
files.
2020-08-03 11:53:17 +02:00
Rolf Bjarne Kvinge dcfa5015cc [tests] Update Xamarin.Mac tests to use Touch.Client and the official NUnit[Lite]. 2020-08-03 11:53:17 +02:00
Rolf Bjarne Kvinge cff47214ec [tests] Move bindings-test[-mac].csproj to their own directory. 2020-07-21 17:24:15 +02:00
Manuel de la Pena c568f42571
[Tests] Add missing resource needed by tests. Fixes #2248 (#8954)
New test that did not consider that tests are shared with mac os x.

fixes: #2248
2020-06-25 11:58:41 -04:00
Rolf Bjarne Kvinge c3bcfac582
Unify code for executing processes. (#8848)
* Create a simple Xamarin.Utils.Execution class that can handle all our
  process execution needs:
    * Captures or streams stdout/stderr (in UTF8).
    * Supports async
    * Supports a timeout
    * Does not depend on any other source file we have, only uses BCL API.
* Have the execution helper classes from mtouch/mmp
  (Xamarin.BundlerDriver.RunCommand) and the tests
  (Xamarin.Tests.ExecutionHelper) use this new class.
* Some simplifications were made:
    * All API that took a string array for the environment now takes a
      Dictionary<string, string>.
    * The Driver.RunCommand methods were split out to a separate file. This
      file also contains a Verbosity field, which is conditioned on not being
      in mtouch nor mmp, which makes including this file from other projects
      simpler (such as bgen - in particular bgen was modified to use this
      Verbosity field instead of its own).
2020-06-18 12:34:07 +02:00
Rolf Bjarne Kvinge 2b2f1d08dc
[tests] Remove Classic code from all tests. (#8702) 2020-05-28 16:35:09 +02:00
Sebastien Pouliot a5ac0ea102
[generator] Add C#8 nullability into generated code (#7570)
Goals
* Reflect Apple nullability annotations in our bindings using C#8
* No warnings when building bindings

Non-Goals
* Update (add or fix) `[NullAllowed]` to match Apple headers (next phase)
* Make the generator or internal code fully nullable aware (`nowarn` is used)

Notes
* Apple's own annotations are not 100% accurate :(
* Where known issue exists we have _fixed_ our attributes to match reality :)
* We also do additional null-checks internally that might seems not required (better safe than sorry).
2020-04-09 09:29:28 -04:00
Rolf Bjarne Kvinge 5b7ea53e2e [monotouch-test] Fix ProxyTest according to changed behavior in iOS 13.
In iOS 13 it's no longer possible to get PACs from file:// urls (this is
explained in the release notes, so it's expected). So launch a local
httpserver and serve the PAC that way.
2019-09-16 15:21:29 +02:00
Rolf Bjarne Kvinge c7522b3a71 Fix broken merge. 2019-09-16 15:21:24 +02:00
Rolf Bjarne Kvinge 2c66d68277 Fix a few merge breakages. 2019-09-16 15:20:59 +02:00
Rolf Bjarne Kvinge 303aa0a649 Merge remote-tracking branch 'origin/xcode11' into master-xcode11 2019-09-13 18:35:18 +02:00
Rolf Bjarne Kvinge 18321c6069
[xammac_tests] Fix a few issues after the latest beta. Fixes xamarin/maccore#1886. (#6575)
* [monotouch-test] Adjust EventKitCalendarTest for the latest Xcode 11 beta (3). Partial fix for xamarin/maccore#1886.
 
Partial fix for https://github.com/xamarin/maccore/issues/1886.

* [xammac_tests] Add missing resources files. Partial fix for xamarin/maccore#1886.

Partial fix for https://github.com/xamarin/maccore/issues/1886.

Fixes https://github.com/xamarin/maccore/issues/1886.
2019-07-12 09:12:10 -07:00
Jonathan CONTE 9f0a3104b1 [appkit] Add signatures to NSGridView.Create and deprecate the actual one. Fixes #6232. (#6453)
Fixes https://github.com/xamarin/xamarin-macios/issues/6232
2019-07-07 22:36:12 -07:00
Rolf Bjarne Kvinge 6e5ec5b5a4
[tests] Ignore all compiler warnings in apitest, introspection, monotouch-test and xammac tests. (#6430)
Nobody cares about them anyway, and they keep filling my terminal with useless
text.
2019-06-27 15:34:36 +02:00
Rolf Bjarne Kvinge 2fe7377003
[tests] Remove 32-bit Xamarin.Mac tests (both Classic and Unified). (#6301)
* [tests] Remove 32-bit Xamarin.Mac tests (both Classic and Unified).

We're removing support for 32-bit Xamarin.Mac apps (#6300), which means we
don't need to run the tests anymore.

This part of the implementation for #6300, I'm starting with the tests because
some of our XM/Classic tests are failing and making the bots unnecessarily red
(since we'll remove XM/Classic support anyway). Also CI will be faster if we
don't run these tests.

* [mmptest] Fix build.

* [tests] Fix build for mono-native-mac.csproj.
2019-06-17 08:03:58 +02:00
Rolf Bjarne Kvinge 1d85078962 [monotouch-test] Adjust tests to cope with changes in Xcode 11 beta 1. 2019-06-14 20:02:27 +02:00
Rolf Bjarne Kvinge 96517671f6 [Metal] Sprinkle [return: Release] on all 'new*' selectors. Fixes #5941.
Also add tests for all the API I could figure out how to use.

Fixes https://github.com/xamarin/xamarin-macios/issues/5941.
2019-05-31 06:32:58 +00:00
Rolf Bjarne Kvinge 0ce0010824
[Metal] Sprinkle [return: Release] on all 'new*' selectors. Fixes #5941. (#6159)
* [Metal] Sprinkle [return: Release] on all 'new*' selectors. Fixes #5941.

Also add tests for all the API I could figure out how to use.

Fixes https://github.com/xamarin/xamarin-macios/issues/5941.

* [tests] MTLFunctionConstantValues didn't have a default ctor until Xcode 9.

* [tests] Use a higher offset when calling MTLBuffer.CreateTexture to try to comply with the requirements for the API.

Hopefully fixes this assertion:

> 07:42:06.7701360 validateStrideTextureParameters:1512: failed assertion `Linear texture: bytesPerRow (64) must be aligned to 256 bytes'

which doesn't happen on my machine.

* Fix whitespace.

* Simplify nested usings.

* Fix availability correctly.
2019-05-29 22:06:14 -07:00
monojenkins daf5006281 [d16-2] [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6035)
* [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects.

Fixes https://github.com/mono/mono/issues/13483 :

```
@akoeplinger: Since we moved types from Mono.Android.dll and
Xamarin.iOS/WatchOS/TVOS.dll to System.Drawing.Common.dll user projects
would fail to compile. We need to add some msbuild logic to add a
reference to the assembly automatically.
```

* [msbuild] Implement the same fix for XM projects as well.

* [msbuild] Update Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* tests.

We're including a new assembly, which means the
Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* must be updated
accordingly.

Also modify these tests so that test assert that fails lists the actual
assembly that's missing, i.e. instead of this:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         #1
      Expected: 6
      But was:  7

we now print:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         References
      Expected: equivalent to < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
      But was:  < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Drawing.Common.dll", "System.Xml.dll", "Xamarin.iOS.dll" >

* [tests] Adjust Xamarin.MMP.Tests.AssemblyReferencesTests.ShouldNotAllowReference_ToSystemDrawing.

The test was verifying that referencing System.Drawing.dll and trying to use
System.Drawing.RectangleF would fail to compile (because System.Drawing.dll
shouldn't be resolved in this case).

The addition of System.Drawing.Common.dll breaks this assumption, because now
we ship System.Drawing.RectangleF, so the code that was supposed to fail to
compile works just fine instead.

So modify the test to verify that there's no System.Drawing.dll in the final
bundle.

* Remove workarounds for mono/mono#13483.

* [msbuild] Create a way out if automatically referencing System.Drawing.Common.dll causes problems.

* [msbuild] Adjust variable name and boolean logic according to review.
2019-05-10 16:16:01 +02:00
Ankit Jain 3a7bdc0a13 [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6011)
* [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects.

Fixes https://github.com/mono/mono/issues/13483 :

```
@akoeplinger: Since we moved types from Mono.Android.dll and
Xamarin.iOS/WatchOS/TVOS.dll to System.Drawing.Common.dll user projects
would fail to compile. We need to add some msbuild logic to add a
reference to the assembly automatically.
```

* [msbuild] Implement the same fix for XM projects as well.

* [msbuild] Update Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* tests.

We're including a new assembly, which means the
Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* must be updated
accordingly.

Also modify these tests so that test assert that fails lists the actual
assembly that's missing, i.e. instead of this:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         #1
      Expected: 6
      But was:  7

we now print:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         References
      Expected: equivalent to < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
      But was:  < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Drawing.Common.dll", "System.Xml.dll", "Xamarin.iOS.dll" >

* [tests] Adjust Xamarin.MMP.Tests.AssemblyReferencesTests.ShouldNotAllowReference_ToSystemDrawing.

The test was verifying that referencing System.Drawing.dll and trying to use
System.Drawing.RectangleF would fail to compile (because System.Drawing.dll
shouldn't be resolved in this case).

The addition of System.Drawing.Common.dll breaks this assumption, because now
we ship System.Drawing.RectangleF, so the code that was supposed to fail to
compile works just fine instead.

So modify the test to verify that there's no System.Drawing.dll in the final
bundle.

* Remove workarounds for mono/mono#13483.

* [msbuild] Create a way out if automatically referencing System.Drawing.Common.dll causes problems.

* [msbuild] Adjust variable name and boolean logic according to review.
2019-05-10 01:20:52 +02:00
Alexander Köplinger 39c61cca88 REVERTME: Add workaround for missing System.Drawing.Common reference 2019-03-20 01:32:48 +01:00
Rolf Bjarne Kvinge 23b7847066 Merge remote-tracking branch 'origin/master' into mono-2018-08 2018-11-26 08:05:36 +01:00
Rolf Bjarne Kvinge f91e8fb811
Use a full path to xibuild. (#5140)
* Use a full path to xibuild.

Use a full path to xibuild everywhere, since it's easier than making sure PATH
is correct every time we want to invoke xibuild.

Also remove the xbuild-in-place script, it's not used anymore.

* Fix xibuild path lookup.

* [xammac_tests] Remove unneeded csproj changes.
2018-11-20 12:14:16 -05:00
Rolf Bjarne Kvinge cca50fe500 Mono 2018-08 requires macOS 10.9+, so Xamarin.Mac must as well. 2018-10-25 09:54:43 +02:00
Vincent Dondain eec95e881c Merge branch 'd15-8' into xcode10-rebase-15.8 2018-08-13 21:04:56 -04:00
Rolf Bjarne Kvinge 302328db34 Revert "Bump tests minimum version from 10.7 to 10.9"
This reverts commit acc58900dd.
2018-07-25 11:55:58 +02:00
Alex Soto acc58900dd Bump tests minimum version from 10.7 to 10.9 2018-07-18 22:45:30 -05:00
Rolf Bjarne Kvinge c517cccd1a [tests] Move some tests from xammac_tests to mmptest.
Move tests that build projects from xammac_tests to mmptest, so that
xammac_tests is only testing API, and not building anything.

This makes it easier to run xammac_tests on older macOS versions (where we
don't necessarily support building Xamarin.Mac apps).
2018-07-02 19:05:27 +02:00
Manuel de la Pena f765d674d3 [Compression] Add compression framework bindings. (#3942) 2018-05-11 15:54:31 -04:00
Rolf Bjarne Kvinge 0e66298a15
[xharness] Clone XM projects. (#3427)
* [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.
2018-02-08 14:32:48 +01:00
Rolf Bjarne Kvinge 1a260e542b
[tests] Build the native test library for macOS and create a binding project for it. (#3373)
* [tests] Build the native test library for macOS and create a binding project for it.

Also add the new binding project to the xammac and link all XM test projects,
which allows us to stop excluding tests that require the native library and
the corresponding bindings.

* [tests] Include more tests in xammac_tests.

* [tests] Correctly ignore the ObjC exception tests in release mode.
2018-02-02 11:14:44 +01:00
Rolf Bjarne Kvinge af03020eef
[mtouch/mmp] Give users more control over optimizations, and share more code between mtouch and mmp. (#3242)
* [mtouch/mmp] Give users more control over optimizations, and share more code between mtouch and mmp.

1. Add an --optimize flag to mtouch/mmp that allows users to select which
   optimizations to apply (or not). This makes it easier to add future
   optimizations, and allow users to disable any optimization that causes
   problems without having to disable many other features.

2. Share as much optimization code as possible between mtouch and mmp. This
   immediately gives a benefit to mmp, which has three new optimizations only
   mtouch had: NSObject.IsDirectBinding inlining, IntPtr.Size inlining and
   dead code elimination.

   This results in ~6kb of disk space saved for a linked Xamarin.Mac app:

   * link sdk: [Debug][1], [Release][2]
   * link all: [Debug][3], [Release][4]

Testing also verifies that monotouchtest ([Debug][5], [Release][6]) has not
changed size at all, which means that no default optimizations have changed
inadvertedly.

[1]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-sdk-mac--debug
[2]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-sdk-mac--release
[3]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-all-mac--debug
[4]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-all-mac--release
[5]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#monotouchtest-iphonedebug64
[6]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#monotouchtest-iphonerelease64

* [tools] Don't enable the IsDirectBinding optimization by default for Xamarin.Mac apps, it's not safe.

* Fix whitespace issues.

* [doc] Document optimizations.

* Officially support optimizations by adding them to the Versions.plist.

* [linker] Improve IntPtr.Size inliner + dead code eliminatior and add tests.

* Properly handle operands for the ldc_i4_s instruction (they're sbyte).
* Fix less-than condition to actually do a less-than comparison.
* Make sure to look up the bitness in the Target, not the Application, since
  the Application's value will be incorrect when building fat apps (both
  Is32Build and Is64Build will be true).
* Remove unnecessary checks for the IntPtr.Size inliner: this optimization
  does not depend on other instructions than the IntPtr.get_Size call, so
  remove the checks that verify surrounding instructions. This makes the
  IntPtr.Size inliner kick in in more scenarios (such as the new tests).
* Add tests.

* [tests] Add mmp tests for optimizations.

* [tests] Fix XM optimization tests.

* [tests] Fix test build error.
2018-01-23 11:33:48 +01:00
Sebastien Pouliot f5df902049
[foundation] Add NSBundle.GetLocalizedString returning an NSString. Fixes #41292 (#3266)
The original, now obsoleted, `LocalizedString` API returned a .net
`string` which does not work in most cases.

Different versions of iOS seems to return different (public or internal)
subclasses of `NSString` that are understood by other API (like NSString
`localizedStringWithFormat:`) for further customization.

Our logic to convert NSString to string is correct but it cannot
recreate the custom, required subclass to continue the localization.

So the new API return an `NSString` publicly (which is actually a
subclass) that can do the required job.

Adding a test in monotouch-test is presently blocked by #3265 [2]

[1] https://bugzilla.xamarin.com/show_bug.cgi?id=41292
[2] https://github.com/xamarin/xamarin-macios/issues/3265

* Add tests for new (and old) NSBundle API and adjust old ones since adding a Base.lproj directories changes things

* Add localization to xammac_tests since it shares the same, updated tests
2018-01-20 14:00:01 -05:00
Vincent Dondain d7b7a6ea02 Merge branch 'xcode9.2' 2017-12-06 14:41:13 -05:00
Chris Hamons 4c966e3e71 Fix macOS 10.13 test failures (#3066) 2017-12-03 19:45:28 -05:00
Manuel de la Pena 6135a6c4d8
[MSBuild] Do not set CFBundleDevelopmentRegion if not present. (#2779)
* [MSBuild] Do not set CFBundleDevelopmentRegion if not present.

This is a complicated fix. This is a regression introduced by Apple.
CFLocaleCopyCurrent(), used in the iOS code, will return the value of
the application's CFBundleDevelopmentRegion Info.plist key if all of the
following conditions are true:

* CFBundleDevelopmentRegion is present in the Info.plist
* The CFBundleDevelopmentRegion language is in the list of preferred
languages on the iOS device, but isn't the first one
* There are no localized resources (i.e. no .lproj directory) in the app
for the first preferred locale

This differs from iOS 10 where the presence of the
CFBundleDevelopmentRegion key had no effect.

Note that if the CFBundleDevelopmentRegion key is not present at all,
CFLocaleCopyCurrent() always returns the first preferred locale as it
did in iOS 10.

We are adding the key by default in the plist of the applications which confuses users since they do not see the key in the .plist added by the template. This commit removes it to be more explicit and help users understand the behaviour.
2017-12-01 16:52:25 +01:00
Timothy Risi 87f9e23989 [MetalPerformanceShaders] Xcode 9 bindings (#3005)
* [MetalPerformanceShaders] Activate bindings for Xamarin.Mac and add n… (#2816)

* [MetalPerformaceShaders] Several MPSCnnKernel properties should be readonly (#2938)

The subclasses versions of the properties need Override, cannot be removed since it would break visibility for iOS 10

* Remove some [Model] attributes that sholdn't be needed

* Fix introspection test crashes

* More introspection fixes

* NN does not need to be PascalCased

Remove unneeded Models and BaseTypes

* PR Whitespace fixes and renamings

* Paste fail

* More fixes from PR comments

* [MPS] Adds new intro test, fixes ctors and xtro output

* Removes duplicated availability attributes.
* Removes obsoleted API from macOS since mps is new to it.
* Fixes xtro output.
* Adds missing API.
* Fixes parameterless ctors, some of them do not really work, found
  by our new intro test and disabled the one that seem to not make
  sense due to the presence of DesignatedInitializers.
* Fixes a selector typo.
* Adds new `ShouldNotExposeDefaultCtorTest` to intro.

ShouldNotExposeDefaultCtorTest
==============================

This test checks for types with a parameterless ctor that are subclasses
of `NSObject` and then cheks if the BaseType of said objects also expose
a parameterless ctor (all in .NET land), if this is not the case it reports
them and so they can manually audited. Also this test has the ability to
print alloc/init ObjC code by setting `genObjCTestCode` to `true` so you can
take this code into an Xcode project and easily tests the ctors.

It seems that xtro (sharpie) does not have a complete picture of when a ctor
must be exposed hence the hability to generate this code and manually test.

Right now this test is just enabled for MPS since it is the scope of this PR.
In the future it should be enabled for all other frameworks and the output be
manually audited.

* [MPS] Fixes premature collection possible in bindings (bug 59547) and implements feedback.

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

* Fixes premature collection possible in bindings im MPSKernel.cs
* Fixes MPSImageHistogramTest from using deprecated API.
* Removes renamed selectors and typos from ApiSelectorTest and ApiTypoTest.

* [MPS] Reenable Copy API and DesignatedInitializer xtro feedback

* Implement more feedback

* More feedback
2017-11-28 14:29:05 -06:00
Timothy Risi 2926a13f7e
[test] Change monotouch-test and xammac_tests to use all .cs files in monotouch-test/ Fixes #60290 (#2930)
Exclude the registrar/trampoline generated files from xammac_tests
Remove CoreLocation.LocationTest since is covered by introspection
2017-10-31 08:09:21 -08:00
Sebastien Pouliot 05eb96d0a7 Merge branch 'xcode9' into xcode9-master-merge 2017-09-15 11:05:30 -04:00
Rolf Bjarne Kvinge 15808c4693 Merge pull request #2571 from rolfbjarne/xcode9-matrix
Add Simd matrix types and use them to bind native Simd matrices. Fixes #58599
2017-09-05 15:33:02 +02:00
Timothy Risi c628320cda [Metal] New bindings from Xcode 9 betas (#2457) 2017-09-05 08:45:03 -04:00
Rolf Bjarne Kvinge 371827e7dc [monotouch-test] Exclude code that requires the binding project from xammac tests.
Exclude code that requires the test binding project from xammac tests because
there's currently no XM version of the test binding project.

Fixes this:

    tests/monotouch-test/SpriteKit/UniformTest.cs(20,7): error CS0246: The type or namespace name 'Bindings' could not be found (are you missing a using directive or an assembly reference?)
    tests/monotouch-test/ModelIO/MDLMaterialProperty.cs(37,7): error CS0246: The type or namespace name 'Bindings' could not be found (are you missing a using directive or an assembly reference?)
    tests/monotouch-test/ModelIO/MDLTransform.cs(34,7): error CS0246: The type or namespace name 'Bindings' could not be found (are you missing a using directive or an assembly reference?)
2017-09-01 12:48:49 +02:00