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

5044 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge afff63f04d
[tests] Fix make variables usage in template code. (#12940) 2021-10-06 18:54:27 +02:00
Rolf Bjarne Kvinge 63de01c21c
[tests] Fix packaging of Xamarin.Mac tests. (#12776)
I recently deleted the generated makefile support for building and running our
test suites. It turned out that it was used for building the packaged
Xamarin.Mac tests, so it wasn't as unused as I thought.

So fix the building and packaging of Xamarin.Mac tests to not use the
(non-existent) makefile targets, but instead replicate it with manual make
code.

Also take the opportunity to add packaging and execution of the .NET versions
of these test suites we execute on other macOS versions (both for macOS and
the Mac Catalyst).

* [devops] Use stricter matching when finding the Xamarin.Mac pkg link.

Otherwise the branch name in any package could end up matching the pattern we
were looking for:

	XM_PACKAGE=https://bosstoragemirror.blob.core.windows.net/wrench/tests-package-xamarin-mac-tests/15759261d425ae08494b0a26862a0b1356c5f8ec/5268864/package/Microsoft.iOS.Bundle.15.0.101-ci.tests-package-xamarin-mac-tests.68.pkg

is just clearly wrong.
2021-10-06 08:10:07 +02:00
Chris Hamons dade24c63a
Catalyst changes for CoreAnimation, CoreFoundation, and AVKit (#12926) 2021-10-05 16:42:37 -05:00
Manuel de la Pena 67e1ca5459
[Metal] Add support for xcode 13 beta5 . (#12875)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-10-05 13:32:48 -04:00
Rolf Bjarne Kvinge f1e4cbcfcd
[tests] Modify a few test directories with multiple projects to have the projects in subfolders. (#12921)
This fixes a problem where the build from the different projects could stomp
on eachother in the obj/bin folders. It's technically possible to make this
work by setting up custom [Base][Intermediate][OutputPath] properties in the
project files, but the simplest solution is to just make sure there's no more
than a single project per directory.
2021-10-05 18:06:35 +02:00
Chris Hamons 9230c798a9
[UIKit] Add Catalyst support (#12809) 2021-10-05 11:04:44 -05:00
Chris Hamons a300dfc56b
[msbuild] Add ILStrip'ing for net6 applications. Fixes #11445. (#12563)
- Controlled by EnableAssemblyILStripping which defaults to true
- Integration test included

Before - https://gist.github.com/chamons/c7886f7bacbc2e5ac5966e4251d13e71
After - https://gist.github.com/chamons/148e1bef22fa336f953f3d02dcf20667

859,136 -> 527,872 managed

Fixes https://github.com/xamarin/xamarin-macios/issues/11445.
2021-10-05 09:43:22 -05:00
Rolf Bjarne Kvinge b772397b63
[msbuild] Share the BTouch task implementation between iOS and macOS. (#12873) 2021-10-04 08:18:47 +02:00
Rolf Bjarne Kvinge 62bdd683cf
[dotnet] Add support for 'dotnet pack'. Fixes #12631. (#12900)
Add support for 'dotnet pack', by:

1. Add a workaround for the fact that as soon as a project has a
   'NativeReference' item, .NET's MSBuild logic wants to include a
   'Native.$(AssemblyName).manifest' file in the NuGet. This obviously breaks,
   because we don't create such a file, so we work around it by removing the
   file in question from the corresponding item groups.

2. Add any binding resource packages to the NuGet.

3. Add tests.

Fixes https://github.com/xamarin/xamarin-macios/issues/12631.
2021-10-04 07:43:55 +02:00
Rolf Bjarne Kvinge 43d894da15
[msbuild/tools] Augment the CreateBindingResourcePackage to support creating a zipped binding resource package. (#12868)
Augment the CreateBindingResourcePackage to support creating a zipped binding
resource package (which is just a zipped version of the binding resource
package). This can either be manually chosen by the new 'Compressed' property,
or automatically detected (create a zipped version when there's a symlink in
the binding resource package).

The default is to not create a zipped version in legacy Xamarin, and
automatically detect for .NET.

The problem this is trying to solve is when creating a NuGet package - NuGet
doesn't handle symlinks correctly and it's not possible to create a NuGet with
symlinks. Instead we need to create a zipfile with all the binding resources.
The default has been chosen so that we automatically create a zip file when
it's required for .NET, while still maintaining old behavior with legacy
Xamarin.
2021-10-01 08:40:01 +02:00
Rolf Bjarne Kvinge 4c9e2668b5
[tests] Add more special cases for random network errors on CI. (#12879)
Ref: https://github.com/xamarin/maccore/issues/2304
2021-10-01 08:36:40 +02:00
Rolf Bjarne Kvinge 26771dfefa
[xharness] Remove iOS 32-bit simulator support, current Xcodes don't support it. (#12880)
Our existing tests that claimed to run iOS 32-bit tests were really executing
in 64-bit mode.
2021-10-01 08:33:18 +02:00
Rolf Bjarne Kvinge 7bd39ff873
[tests] Make sure interdependent-binding-projects builds with our workaround for NUnit bugs in .NET. (#12881) 2021-10-01 08:31:31 +02:00
Rolf Bjarne Kvinge 403bc2e774
[tests] Add a test to verify that AppDomain.CurrentDomain.BaseDirectory is always something. Fixes #12687. (#12885)
Fixes https://github.com/xamarin/xamarin-macios/issues/12687.
2021-10-01 08:29:56 +02:00
Chris Hamons 3ffabb1daa
[AppKit] Add Catalyst attributes (#12863) 2021-09-30 09:57:10 -05:00
Rolf Bjarne Kvinge 9286bfb793
[msbuild/dotnet] Compile project-level assets in the outer build for multi-rid builds. Fixes #12410. (#12847)
We don't need to compile project-level assets for every RuntimeIdentifier in
multi-rid builds, we can instead compile them just once in the outer build.

There is also a correctness issue here: we can't compile assets more than once
and expect to get the exact same compiled result every time (in particular
actool seems to be adding random bytes in to the compiled output), and this
creates a problem when trying to merge the different runtime-specific compiled
output into a universal binary.

We accomplish this by:

* Processing these assets in the outer build, before we execute the
  rid-specific inner builds.
* Store the paths to the assets we've processed in a file.
* In the inner builds, we read that file, and remove any matches from the
  corresponding item group.
* Make sure to copy the compiled assets to the app bundle at the end of the
  outer build.

These are the assets we currently handle this way:

* BundleResource
* ImageAsset
* InterfaceDefinition
* SceneKitAsset
* Collada
* TextureAtlas
* CoreMLModel

Also:

* Add a new test case (AppWithResource) that contains all these different
  types of assets.
* Add support for the ScnTool task on Mac Catalyst (which the new test case
  revealed was missing).

Fixes https://github.com/xamarin/xamarin-macios/issues/12410.
2021-09-30 08:25:10 +02:00
Rolf Bjarne Kvinge 2417377017
[tests] Fix a few nullability warnings. (#12872) 2021-09-30 08:21:43 +02:00
Chris Hamons af416003f1
[Foundation] Add attributes and fix ignores for Catalyst (#12854) 2021-09-29 10:18:01 -05:00
Rolf Bjarne Kvinge cd2867d44c
[msbuild] Share the Metal[Lib] task implementations between iOS and macOS. (#12851) 2021-09-29 07:55:55 +02:00
Rolf Bjarne Kvinge 3d182c5c54
[Metal] Fix a few issues in MTLDevice. (#12861)
* MTLCopyAllDevices returns a retained object, so we need to release it.
* MTLCopyAllDevicesWithObserver returns an observer (no need to provide one). This
  means we can obsolete the 'ref NSObject' overload (the API doesn't make sense),
  and instead add an 'out NSObject' overload.
* The returned observer from MTLCopyAllDevicesWithObserver is retained, so we must
  release it.
* The returned array from MTLCopyAllDevicesWithObserver is a retained object, so
  we need to release it.
* Simpify the supporting block code for the calls to MTLCopyAllDevicesWithObserver.
* Clean up the block we passed to MTLCopyAllDevicesWithObserver.
2021-09-29 07:54:42 +02:00
Rolf Bjarne Kvinge 7dc2d9af61
[msbuild] Sign Xamarin.iOS.Tasks.dll and Xamarin.Mac.Tasks.dll. Fixes #9835. (#12831)
We need to strongname our MSBuild assemblies, so that different versions
can be loaded side-by-side (one example being having both a legacy and a
.NET project in the same solution).

This required setting a version for Xamarin.iOS.Tasks.dll and
Xamarin.Mac.Tasks.dll, otherwise strong-naming won't work properly (all
versions of an assembly would have the same identity).

Also sign the corresponding test assemblies, since they poke into the
internals of the task assemblies.

Fixes https://github.com/xamarin/xamarin-macios/issues/9835.
2021-09-28 17:31:35 +02:00
Manuel de la Pena b20ca55943
[Foundation] Remove warning due to the Equals accepting a null value. (#12839)
Removes the following warning during the builds:

```
warning CS8767: Nullability of reference types in type of parameter 'host' of 'bool NSHost.Equals(NSHost host)' doesn't match implicitly implemented member 'bool IEquatable<NSHost>.Equals(NSHost? other)' (possibly because of nullability attributes)
```

Test was added to ensure that we did not throw an exception.
2021-09-28 08:11:07 -04:00
Manuel de la Pena 339936f457
[Tests] Fix cecil tests. (#12853)
-  Added the marshaling attr and a test to ensure it is ok.
- Fix the cecil MarshalAs test to not skip over types when checking.
    This revealed multiple tests failures that needed fixing.

fixes: https://github.com/xamarin/maccore/issues/2519

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-09-28 08:09:23 -04:00
Rolf Bjarne Kvinge 6bf39bacfa
[tests] Simplify the test code for the .NET unit tests. (#12842)
As more tests have been written, helper methods have been added, so this is
just making existing code use newer helper methods.
2021-09-27 15:55:30 +02:00
Rolf Bjarne Kvinge e2d1777cc7
[dotnet] Show an error if we must link, but linking has been disabled. Fixes #12372. (#12832)
For executable projects, we must run the linker (otherwise we won't produce
something that can be executed).

We'll enable the linker by default in these cases, but if the developer has
manually disabled the linker (if the linker fails to execute for any reason,
it will suggest that the developer disables it), then we should show an error
explaining why.

Fixes https://github.com/xamarin/xamarin-macios/issues/12372.
2021-09-27 07:28:10 +02:00
Manuel de la Pena ad673ae731
[CoreMedia] Add support for xcode13 (#12770)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-09-24 18:19:49 -04:00
Rolf Bjarne Kvinge 4d5616687a
[dotnet] Fix an issue where we wouldn't re-link if some files changed. (#12794) 2021-09-24 13:20:03 +02:00
Rolf Bjarne Kvinge 5318a2b9fa
[msbuild] Make the CompileAppManifestTaskBase.AppManifest property an ITaskItem. (#12804)
So that any input app manifest is copied to Windows when doing remote builds.
2021-09-23 18:46:37 +02:00
Rolf Bjarne Kvinge 83de23f6b4
[tests] Build interdependent-binding-projects for macOS now, there's a corresponding macOS Touch.Client project. (#12817) 2021-09-23 16:20:18 +02:00
Rachel Kang 70dd0d31fa
[Intents] Update bindings for Xcode 13.0 betas 1 through 5 (#12771)
* "[Intents] Update bindings for Xcode 13.0 betas 1 through 5"

* Update based on feedback

* Update based on feedback

* Update based on feedback
2021-09-21 20:30:56 -04:00
Chris Hamons 65f0e4c614
Some Catalyst API annotations and corrections (#12677)
- Part of https://github.com/xamarin/xamarin-macios/issues/10216
- This includes most of the smaller SDKs.
2021-09-21 14:17:52 -05:00
Rolf Bjarne Kvinge c4a67e585c
[msbuild/tools] Add a better error message for when we fail to convert between iOS and macOS versions for Mac Catalyst. (#12767)
New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@9e6e29f [Xamarin.MacDev] Return valid iOS/macOS versions when converting betweeen iOS and macOS versions for Mac Catalyst.

Diff: 41d91e0de0..9e6e29f2a4
2021-09-21 16:19:04 +02:00
TJ Lambert e16d8fe1fe
[Dotnet] Enable the Test to check for Dotnet Attributes (#12745)
Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-09-20 15:13:53 -04:00
Chris Hamons a6eb528197
[net6][msbuild] Set SelfContained for AppExtensions sooner to fix publishing (#12703)
This PR resolves a crash when running the linker on publishing iOS extensions.

The crash would occur here in failing to resolve corelib.

The reason this would fail was System.Private.CoreLib.dll was not in input_assemblies.

This was because we were passes the set of reference assemblies not the expected 'real' ones, and those do not include CoreLib.

After a bunch of digging, this was because _ComputeManagedRuntimePackAssembliesIfSelfContained target was not being set as a condition of _ComputeAssembliesToPostprocessOnPublish.

_ComputeManagedRuntimePackAssembliesIfSelfContained happened to be the place these were added, and wasn't being set since it has a condition of $(SelfContained) == 'true'

Now confusingly SelfContained WAS being set to true, but only in the targets file, which was too late, as it was checked in a 'global' property group outside of a target.

This means we'd fail to set SelfContained until after the condition, and not run.

This was verified by setting /p:SelfContained=true to true.

I also looked at removing the condition above, since https://github.com/dotnet/runtime/issues/54406 is fixed, however this caused project that didn't set RuntimeIdentifier to fail.
2021-09-20 09:40:41 -05:00
Rolf Bjarne Kvinge 499a69e772
[dotnet] Enable default compile items for binding projects. Fixes #12532. (#12758)
Enable default compile items for binding projects, and just exclude any api definition
and core source from any automatically included files.

Fixes https://github.com/xamarin/xamarin-macios/issues/12532.
2021-09-20 13:41:20 +02:00
Rolf Bjarne Kvinge cb93a8e66a
[tests] Fix a thread synchronization issue in the generator tests. (#12775)
Properly synchronize access to the current writer in the generator tests'
ThreadStaticTextWriter class.

Should fix this random failure:

    Error Message:
     System.NullReferenceException : Object reference not set to an instance of an object.
    Stack Trace:
       at Xamarin.Tests.ThreadStaticTextWriter.WriteLine(String value) in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/generator/BGenTool.cs:line 478
     at System.IO.TextWriter.SyncTextWriter.WriteLine(Object value)
     at System.Console.WriteLine(Object value)
     at Xamarin.Tests.BGenTool.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/generator/BGenTool.cs:line 235
     at Xamarin.Tests.BGenTool.AssertExecute(String message) in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/generator/BGenTool.cs:line 207
     at GeneratorTests.BGenTests.BuildFile(Profile profile, Boolean nowarnings, Boolean processEnums, IEnumerable`1 references, String[] filenames) in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/generator/BGenTests.cs:line 780
     at GeneratorTests.BGenTests.BuildFile(Profile profile, Boolean nowarnings, Boolean processEnums, String[] filenames) in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/generator/BGenTests.cs:line 766
     at GeneratorTests.BGenTests.BuildFile(Profile profile, String[] filenames) in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/generator/BGenTests.cs:line 756
     at GeneratorTests.BGenTests.VSTS970507() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/generator/BGenTests.cs:line 650
2021-09-20 13:39:24 +02:00
Rolf Bjarne Kvinge a96c28b979
[msbuild] Call the generator using a response file. (#12756)
Fixes this warning:

> Xamarin.Shared.targets(992,3): warning MSB6002: The command-line for the "BTouch" task is too long. Command-lines longer than 32000 characters are likely to fail. Try reducing the length of the command-line by breaking down the call to "BTouch" into multiple calls with fewer parameters per call.
2021-09-20 07:40:57 +02:00
Rolf Bjarne Kvinge 728347ad63
[dotnet] Remove watchOS code and from our .NET support. (#12764)
It's not tested, and thus has probably already bitrotted. If we add support
for watchOS to .NET in the future, it would likely be easier to start from
scratch (copying some of the other platforms), than having incomplete and
bitrotted code.
2021-09-20 07:40:03 +02:00
Rolf Bjarne Kvinge f7a3619974
[tests] Fix warning about unused variable. (#12762) 2021-09-17 16:01:48 +02:00
Rolf Bjarne Kvinge 04548c7da0
[msbuild/dotnet] Include font files by default in .NET apps, and implement a way to automatically register them. Fixes #12536. (#12752)
* Automatically include *.ttf, *.ttc and *.otf in .NET projects as BundleResource
  items (if these files are found within the Resources/ subdirectory).
* Add support for a 'RegisterFont' metadata on BundleResource items, where if set
  to 'true', we'll register the font file in the Info.plist as required by the target
  platform.
* Add tests.

Fixes https://github.com/xamarin/xamarin-macios/issues/12536.
2021-09-17 10:18:09 +02:00
Rolf Bjarne Kvinge 3ab8e4ab61
[tests] Re-generate test[-system].config after .NET bumps. (#12759) 2021-09-17 09:57:14 +02:00
Alex Soto e2d05da816
[TVUIKit] Update bindings to Xcode 13 Beta 5 (#12722)
* [TVUIKit] Update bindings to Xcode 13 Beta 5

* Apply feedback

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-09-16 19:03:48 -04:00
Manuel de la Pena 2a2bc2560e
[Xtro] Allow to run xtro with some platforms ignored. (#12742) 2021-09-16 16:08:36 -04:00
Rolf Bjarne Kvinge 298d423cf1
[xharness] Don't generate makefiles anymore. (#12751)
We either use the html web page, or for .NET tests there are custom makefile
logic.

This avoids having to maintain the makefile generation to keep up with our new
tests, and it fixes numerous warnings like this:

    Makefile-mac.inc:56: warning: overriding recipe for target 'build-mac-modern-macOS'
    Makefile-mac.inc:41: warning: ignoring old recipe for target 'build-mac-modern-macOS'
    Makefile-mac.inc:59: warning: overriding recipe for target 'clean-mac-modern-macOS'
    Makefile-mac.inc:44: warning: ignoring old recipe for target 'clean-mac-modern-macOS'
    Makefile-mac.inc:62: warning: overriding recipe for target 'exec-mac-modern-macOS'
    Makefile-mac.inc:47: warning: ignoring old recipe for target 'exec-mac-modern-macOS'
    Makefile-mac.inc:65: warning: overriding recipe for target 'run-mac-modern-macOS'
    Makefile-mac.inc:50: warning: ignoring old recipe for target 'run-mac-modern-macOS'
2021-09-16 17:23:07 +02:00
Rolf Bjarne Kvinge d142a3756f
[tests] Relax a few special folder checks for tvOS even more. Fixes #12640. (#12748)
Hopefully fixes https://github.com/xamarin/xamarin-macios/issues/12640.
2021-09-16 15:36:06 +02:00
Rolf Bjarne Kvinge a78700bb40
[tests] Add additional test to try to narrow down #xamarin/maccore@2443. (#12384) 2021-09-16 15:00:06 +02:00
Rolf Bjarne Kvinge 79eb633fab
[tests] Fix (a)synchronous F# code. (#12738)
MonoTouch.NUnit.UI.MacRunner.MainAsync will try to invoke things on the main
thread, and at the same time execute a runloop, and if the runloop isn't
executing on the main thread, we end up with a deadlock, where we keep waiting
on the main thread to process stuff enqueued by the background thread, while
the main thread is waiting for the background thread to finish.

Solve this by fixing the F# code to call
MonoTouch.NUnit.UI.MacRunner.MainAsync on the main thread.
2021-09-16 09:43:29 +02:00
Sebastien Pouliot 2691791ad2
[corefoundation] Optimize `CFArray` (#12740)
The added test case has not shown any major performance enhancement,
anything (if) is lost in the noise.

Beside the performance the change has two small size advantages
* `Create` does not call another method (less metadata)
* `GetCount` is now the p/invoke `CFArrayGetCount`

Before

// * Summary *

BenchmarkDotNet=v0.12.1.1528-nightly, OS=macOS Big Sur 11.5.2 (20G95) [Darwin 20.6.0]
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
  [Host] : Mono 6.12.0 (2020-02/3cf59ad33da), X64

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=3
LaunchCount=1  WarmupCount=3

| Method | Length |        Mean |       Error |    StdDev |
|------- |------- |------------:|------------:|----------:|
| Create |      0 |    255.4 ns |    53.68 ns |   2.94 ns |
| Create |      1 |    343.0 ns |     8.55 ns |   0.47 ns |
| Create |     16 |    443.8 ns |    30.54 ns |   1.67 ns |
| Create |    256 |  1,898.4 ns |   246.80 ns |  13.53 ns |
| Create |   4096 | 40,503.2 ns | 5,395.81 ns | 295.76 ns |

// * Legends *
  Length : Value of the 'Length' parameter
  Mean   : Arithmetic mean of all measurements
  Error  : Half of 99.9% confidence interval
  StdDev : Standard deviation of all measurements
  1 ns   : 1 Nanosecond (0.000000001 sec)

// ***** BenchmarkRunner: End *****
Global total time: 00:00:33 (33.26 sec), executed benchmarks: 5

After

// * Summary *

BenchmarkDotNet=v0.12.1.1528-nightly, OS=macOS Big Sur 11.5.2 (20G95) [Darwin 20.6.0]
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
  [Host] : Mono 6.12.0 (2020-02/3cf59ad33da), X64

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=3
LaunchCount=1  WarmupCount=3

| Method | Length |        Mean |       Error |   StdDev |
|------- |------- |------------:|------------:|---------:|
| Create |      0 |    246.3 ns |    55.49 ns |  3.04 ns |
| Create |      1 |    341.1 ns |    18.13 ns |  0.99 ns |
| Create |     16 |    425.4 ns |    34.97 ns |  1.92 ns |
| Create |    256 |  1,741.1 ns |   298.87 ns | 16.38 ns |
| Create |   4096 | 40,333.6 ns | 1,646.70 ns | 90.26 ns |

// * Legends *
  Length : Value of the 'Length' parameter
  Mean   : Arithmetic mean of all measurements
  Error  : Half of 99.9% confidence interval
  StdDev : Standard deviation of all measurements
  1 ns   : 1 Nanosecond (0.000000001 sec)

// ***** BenchmarkRunner: End *****
Global total time: 00:00:31 (31.68 sec), executed benchmarks: 5
2021-09-16 08:39:16 +02:00
Rolf Bjarne Kvinge c2a531259f
[introspection] Skip VideoToolbox classes in the ApiCMAttachmentTest on tvOS devices. (#12695)
They crash on device.
2021-09-16 08:25:29 +02:00
Rolf Bjarne Kvinge 5b4301f129
[tests] Add .NET makefiles for bindings-test. (#12712) 2021-09-16 08:20:35 +02:00