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

4543 Коммитов

Автор SHA1 Сообщение Дата
Sebastien Pouliot 32bce7fc1f
[xcode12.5] Initial bump for beta 1 (#10573)
This version of Xcode requires macOS 11.0 or later.

New commits in xamarin/maccore:

* xamarin/maccore@de616ca53e [mlaunch] Fix dependencies for Xcode 12.5 beta 1 (#2387)
* xamarin/maccore@e93375583c [Actions] Fix rebase trigger.
* xamarin/maccore@0dfeb85ff6 [CI][VSTS] Add information when the external tool fails. (#2377)
* xamarin/maccore@87e165fdbb Remove Vincent as a code owner 😞 (#2368)
* xamarin/maccore@55a700bb5b [build] Add /restore to Xamarin.Analysis build (#2366)
* xamarin/maccore@2d9f8a9685 Bump to xamarin/xamarin-analysis@95245313 (#2362)

Diff: 428964bf32..de616ca53e

* Bump system mono to the latest available 2020-02 package. (#10402)

This makes xamarin-macios build on Apple Silicon, and also seems to get an
updated csc that fixes a problem with nullability warnings/errors.

* [tests] Fix mmp-regression build

```
10:59:46.5383210 Making all in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/mmp-regression
10:59:46.5392610 TargetFrameworkFallbackSearchPaths=/Users/builder/azdo/_work/1/s/xamarin-macios/_mac-build/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPathFallbackPathsOverride=/Users/builder/azdo/_work/1/s/xamarin-macios/_mac-build/Library/Frameworks/Mono.framework/External/xbuild make all
10:59:46.6208220 /Applications/Xcode_12.5.0-beta.app/Contents/Developer/usr/bin/make clean
10:59:46.6956100 /Applications/Xcode_12.5.0-beta.app/Contents/Developer/usr/bin/make build
10:59:46.7422460 GEN      dylib/libTest.dylib
10:59:46.8094820 ld: library not found for -lSystem
10:59:46.8097590 clang: error: linker command failed with exit code 1 (use -v to see invocation)
10:59:46.8110310 make[2]: *** [dylib/libTest.dylib] Error 1
10:59:46.8112570 make[1]: *** [run] Error 2
10:59:47.0030120 Process make exited with 2
```

This happens on BigSur as it does not find the default location anymore...

* [tests] Do not test GKLeaderboardViewController on BigSur

The issue is the OS version, not the Xcode version. Update check
to skip that test on macOS 11+

* [tests] Fix MSBuild tests / integration

The test cannot work on BigSur since while you can `dlopen` the library
you can open `fopen` it as a file (and can't embed it for the test).

```
12:31:23.9407820 CSC : error CS1566: Error reading resource 'libz.dylib' -- 'Could not find file "/usr/lib/libz.dylib"' [/Users/builder/azdo/_work/1/s/xamarin-macios/tests/msbuild/Xamarin.MacDev.Tests/bin/Debug/net472/tmp-test-dir/msbuild-tests201/XM45Binding.csproj]
12:31:23.9407900 Done Building Project "/Users/builder/azdo/_work/1/s/xamarin-macios/tests/msbuild/Xamarin.MacDev.Tests/bin/Debug/net472/tmp-test-dir/msbuild-tests201/XM45Binding.csproj" (default targets) -- FAILED.
```

* [tests] Fix MTouch tests failures

* `nm` changed it's output and test was updated

* `clang` linking has a much higher limit for it's command-line length

At least it does not seem to be OS specific since both 10.15 and 11.0
returns the same maximum

```
$ getconf ARG_MAX
1048576
```
2021-02-05 20:30:24 -05:00
Rolf Bjarne Kvinge f5156f7ed7
[dotnet] Add support for the interpreter on device. Fixes #10292. (#10555)
* Pass and parse the MtouchInterpreter value to dotnet-linker.
* Move required logic from mtouch to shared code to take advantage of existing
  code to compute AOT arguments (which we need to compute the correct AOT
  arguments for System.Private.Corelib.dll, which is always AOT-compiled).
* Add a linker task to compute the AOT arguments for .NET.
* Add test projects.

This PR is probably best reviewed commit-by-commit.

Fixes https://github.com/xamarin/xamarin-macios/issues/10292.
2021-02-05 07:47:23 +01:00
Rolf Bjarne Kvinge 3a29de80a8
[tests] Make link sdk and link all work on Mac Catalyst. (#10579)
* [link sdk/link all] Adjust to compile on Mac Catalyst.

* [tests] Adjust the LinkAllRegressionTest.NoFatCorlib to work on Mac Catalyst.

* [tests] Add version checks to make link sdk green on Mac Catalyst.

* [tests] Make the LinkSdkRegressionTest.SpecialFolder test pass on Mac Catalyst.

* [xharness] link sdk and link all are green on Mac Catalyst now.

* Fix test build.
2021-02-05 07:43:33 +01:00
Rolf Bjarne Kvinge 5ef69f173b
[msbuild/tests] Fix support for XCFrameworks for Mac Catalyst. (#10578)
* [tests] Use the 'Apple Developer' code signing key instead of 'iPhone Developer' for xcframework-test.

* [msbuild] Fix resolving the XCFramework for Mac Catalyst.

* [xharness] Enable xcframework-test by default on Mac Catalyst.
2021-02-05 07:39:38 +01:00
Sebastien Pouliot b29cb8596d
[pdfkit] Add nullability to (generated and manual) bindings (#10577)
See [HOWTO](https://github.com/xamarin/xamarin-macios/wiki/Nullability)

Also small change to generator so strong dictionaries can accept `null`
`NSDictionary`, which was already accepted by the class itself.

and expose two properties that were not usable before
2021-02-04 20:39:41 -05:00
Rolf Bjarne Kvinge 2ef3f887f7 Merge remote-tracking branch 'origin/main' into dotnet-interpreter 2021-02-04 22:26:25 +01:00
Rolf Bjarne Kvinge 37a25a7ca1
[xharness] framework-test is now green on Mac Catalyst (#10572) 2021-02-04 08:28:47 +01:00
Sebastien Pouliot 035a97e450
[coreanimation] Add nullability to (generated and manual) bindings (#10547)
See [HOWTO](https://github.com/xamarin/xamarin-macios/wiki/Nullability)
2021-02-03 08:51:42 -05:00
Rolf Bjarne Kvinge 9d4e1ae32a Merge remote-tracking branch 'origin/main' into dotnet-interpreter 2021-02-03 12:52:24 +01:00
Sebastien Pouliot 0c1b7e8935
[wkwebkit] Add nullability to (generated and manual) bindings (#10561)
See [HOWTO](https://github.com/xamarin/xamarin-macios/wiki/Nullability)
2021-02-02 21:42:23 -05:00
Rolf Bjarne Kvinge a3235c4fbd
[tests] Use the 'Apple Developer' code signing key instead of 'iPhone Developer' for framework-test. (#10556)
This is part 1 of making framework-test build on Mac Catalyst.

Contributes to https://github.com/xamarin/xamarin-macios/issues/10440.
2021-02-02 08:46:17 +01:00
Rolf Bjarne Kvinge 13fd8f5b07
[tests] Adjust BundledResources.ResourcesTest to pass on Mac Catalyst. (#10553)
This makes dont link green on Mac Catalyst.

Also adjust xharness to run dont link/Mac Catalyst by default.

Contributes towards https://github.com/xamarin/xamarin-macios/issues/10440.
2021-02-01 18:42:40 +01:00
Rolf Bjarne Kvinge 51648223be Add newly added localizable string to canary test of translated strings. 2021-02-01 17:14:42 +01:00
Rolf Bjarne Kvinge abd54028b8 Merge remote-tracking branch 'origin/main' into catalyst-monotouch-test 2021-01-29 19:01:10 +01:00
Rolf Bjarne Kvinge 506b4f1b30 Fix boolean logic (or not!?) 2021-01-29 19:01:00 +01:00
Rolf Bjarne Kvinge 7824319964 [xtro] More xtro updates. 2021-01-29 18:58:48 +01:00
Rolf Bjarne Kvinge a9c21ef791
[dotnet] Add support for some of the single-project MSBuild properties. (#10545)
* [tests] Add test case for single-project properties in .NET.

* [msbuild] Add support for the single-project ApplicationId MSBuild property.

* [msbuild] Add support for the single-project ApplicationTitle, ApplicationVersion and AppleShortVersion MSBuild properties.

* [dotnet] Enable the single-project MSBuild properties by default.

* [dotnet] Add a short doc about single project properties.

* [tests] Fix the GeneratePlistTaskTests.BundleIdentifier test according to bundle identifier changes.

This test asserts that the CFBundleIdentifier value in the Info.plist isn't
overwritten, and does so by calling the CompileAppManifest task, giving it a
different value for the bundle identifier than what's in the Info.plist.

The behavior change is that now we do things in the following manner:

DetectSigningIdentityTask will read the Info.plist, compute a bundle
identifier (which will be the value from the Info.plist if it's there), and
returns it to the MSBuild code. Eventually that value will be passed to the
CompileAppManifestTask, which will write it to the Info.plist.

However, this test doesn't run the DetectSigningIdentityTask, which means that
the initial value for the bundle identifier doesn't come from the Info.plist.
2021-01-29 17:37:37 +01:00
Rolf Bjarne Kvinge 21e2462e9c Adjust code according to code review. 2021-01-29 11:06:55 +01:00
Rolf Bjarne Kvinge 37ab334489 [tests] Adjust TestRuntime.RequestEventStorePermission to work on Mac Catalyst. 2021-01-29 11:00:14 +01:00
Rolf Bjarne Kvinge 794214e0cd [xtro] Fix a few SafariServices entries for Mac Catalyst. 2021-01-29 10:54:06 +01:00
Rolf Bjarne Kvinge dfa1284c2f [tests] Add .NET Xamarin.Forms test app. 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge 0a581bb3f7 [tests] Add test project for running iOS apps with the interpreter. 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge d9af032dd5 [xharness] Run Mac Catalyst variations by default, and disable all but monotouch-test by default.
This will effectively run monotouch-test on Mac Catalyst by default.
2021-01-28 08:08:02 +01:00
Rolf Bjarne Kvinge d1735ae779 [monotouch-test] Adjust ExceptionsTest.ManagedExceptionPassthrough according to behavior on Mac Catalyst. 2021-01-28 08:08:02 +01:00
Rolf Bjarne Kvinge cfc32f237e [monotouch-test] Ignore tests that require the GC to actually work in Mac Catalyst. 2021-01-28 08:08:02 +01:00
Rolf Bjarne Kvinge ea56e75816 [monotouch-test] Ignore a few Font tests due to bugs in Mac Catalyst. 2021-01-28 08:08:02 +01:00
Rolf Bjarne Kvinge 1a2d352087 [monotouch-test] Ignore a few tests that require a custom provisioning profile on Mac Catalyst. 2021-01-28 08:08:02 +01:00
Rolf Bjarne Kvinge df4d85ab84 [monotouch-test] Adjust PassLibraryTest.Defaults for Mac Catalyst. 2021-01-28 08:08:02 +01:00
Rolf Bjarne Kvinge 4ec519b7cb [monotouch-test] Fix AVCapturePhotoBracketSettingsTest.TestConstructor to take into account the max bracketed capture photo count. 2021-01-28 08:07:58 +01:00
Rolf Bjarne Kvinge 52e29c4130 [monotouch-test] Adjust version checks according to how they're done now for Mac Catalyst. 2021-01-28 08:07:58 +01:00
Rolf Bjarne Kvinge 4a734d0673 [tests] Adjust TestRuntime.Check*SystemVersion according to how version checks are done on Mac Catalyst now. 2021-01-28 08:07:58 +01:00
Rolf Bjarne Kvinge 72b50c4693 Merge remote-tracking branch 'origin/main' into HEAD 2021-01-28 08:07:48 +01:00
Rolf Bjarne Kvinge 179114b870
[monotouch-test] Rework big parts of KeyChainTest. Fixes #xamarin/maccore@2365. (#10492)
* [monotouch-test] Rework big parts of KeyChainTest. Fixes #xamarin/maccore@2365.

'GenericPassword' keychain items are unique by their Service+Account
properties [1]. This means that changing the Label property will not create a
different 'GenericPassword', which has a few consequences:

* It's possible to filter (and try to delete) using the Label property.
* It's possible to try to delete a 'GenericPassword' item, and have that
  deletion attempt fail with 'no item found', and then subsequently trying to
  add the same item will fail with a DuplicateItem, because the deletion
  was filtered using the Label property.

The change I've made is to:

* Make the Label property much more descriptive, and unique per process. This
  makes it easier to figure out where things come from in the Keychain Access
  app.
* Make the Service property unique per process. This way these tests are
  parallel safe and they won't stomp on eachother.
* Keep the Account property the same (a constant value), so that it's easy to
  filter to just these items in the Keychain Access app.
* Remove the Label property from all queries, it doesn't matter anyway. The
  Label property is still set when adding items to the keychain.

Finally try to clean up after ourselves as good as possible. This way we don't
fill the keychain with test stuff. This involves removing certificates and
passwords we add to the keychain at the end of tests.

Fixes https://github.com/xamarin/maccore/issues/2365.

[1]: https://stackoverflow.com/a/11672200/183422

* Adjust query for RecordTest.AuthenticationType as well to not include fields that don't determine uniqueness.

Also make the InternetPassword items we add to the keychain more descriptive and labelled helpfully.
2021-01-28 07:50:34 +01:00
Rolf Bjarne Kvinge 69c1a715c6
[dotnet] Add support for LinkDescription items. (#10467)
* [dotnet] Add support for LinkDescription items.

Also use the LinkDescription item group instead of a custom one
(_BundlerXmlDefinitions), since there's no need for the custom one.

* The world (aka mmp) isn't quite ready for this yet.

* Don't parse into LinkDescription, use a temporary variable instead.

And then only use the temporary variable for .NET.

The problem is that parsing mtouch extra args and adding any --xml arguments
to LinkDescription is that the xml file will be passed again to mtouch, and in
this case any ${ProjectDir} properties won't be evaluated.
2021-01-27 17:59:35 +01:00
Rolf Bjarne Kvinge df4388e8d1
[link sdk] Adjust the LinkSdkRegressionTest.SpecialFolder to handle uncertainty whether a directory exists or not on .NET. Fixes #xamarin/maccore@2379. (#10511)
The directory does not exist for me locally, but exists when running the tests on
the bots.

Fixes https://github.com/xamarin/maccore/issues/2379.
2021-01-27 17:56:43 +01:00
Rolf Bjarne Kvinge 2a61296464
[tests] Ignore the MonoTouchFixtures.ObjCRuntime.RegistrarTest.RegistrarRemoval test, it's failing on .NET. Fixes #xamarin/maccore@2380. (#10513)
Fixes https://github.com/xamarin/maccore/issues/2380.
2021-01-27 17:44:52 +01:00
Sebastien Pouliot e8c7aabdd5
[coredata] Add nullability to (generated and manual) bindings (#10533)
See [HOWTO](https://github.com/xamarin/xamarin-macios/wiki/Nullability)
2021-01-27 09:22:07 -05:00
Sebastien Pouliot f98b901d53
[xtro] Fix Catalyst support (#10518)
Ensure we run sanity checks so the `.todo` files remains up-to-date with
the required work. Updated existing `.todo` files to avoid duplication
errors.

Fix the report. The number of columns varies locally (more details) and
on bots. The former was not right since the original catalyst update.
2021-01-26 10:23:43 -05:00
Alex Soto b5855c821e
[xcode12.4] Initial bump to Xcode 12.4 RC (#10509) 2021-01-25 10:12:13 -05:00
Rolf Bjarne Kvinge a06ae76c36
[monotouch-test] Be more descriptive and clean up stuff added to the keychain. (#10493)
* [monotouch-test] Use a more descriptive label for items added to the keychain in KeyTest.

* [monotouch-test] Use a more descriptive label for some items in CertificateTest.

Also make generated keys non-permanent so that they're not added to the keychain.

* [monotouch-test] Clean up a few items added to the keychain by CertificateTest.
2021-01-22 16:15:11 +01:00
VS MobileTools Engineering Service 2 ae5479927b
[Xharness] Fix the xharness links to work with vsdrops. (#10477)
We need to add the prefix to the xharness logs or we will not be able to
acceess them via a click.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-21 09:42:41 -05:00
VS MobileTools Engineering Service 2 a8dc688778
[Xharness] Fix the xharness links to work with vsdrops. (#10476)
We need to add the prefix to the xharness logs or we will not be able to
acceess them via a click.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-21 09:40:23 -05:00
Rolf Bjarne Kvinge c48c62fed5
[msbuild] Unify how CFBundleName is calculated. (#10475)
* [msbuild] Unify how CFBundleName is calculated.

Previously, CFBundleName would default to:

* iOS: CFBundleDisplayName (if set), otherwise the app bundle name.
* all other platforms: the app bundle name.

Now unify the logic so that we have the same behavior on all platforms.

This is a breaking change under the following conditions:

* Building for iOS
* CFBundleName is not set in the Info.plist
* CFBundleDisplayName is set in the Info.plist
* CFBundleDisplayName from the Info.plist is different from AssemblyName in
  the csproj (which is the value used to calculate the app bundle name).

The fix would be to:

* Set CFBundleName in the Info.plist to the desired value.

This change works in previous versions of Xamarin.iOS as well.

* Update tests.
2021-01-21 14:29:19 +01:00
VS MobileTools Engineering Service 2 be8a8e815d
[tests] Don't use the tcp tunnel in the HttpClientHandler tests. Fixes xamarin/maccore#2154. (#10472)
Fixes https://github.com/xamarin/maccore/issues/2154.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-01-20 10:31:50 -05:00
Manuel de la Pena ff33a72a2b
[Xharness] Fix the xharness links to work with vsdrops. (#10469)
We need to add the prefix to the xharness logs or we will not be able to
acceess them via a click.
2021-01-20 08:00:24 -05:00
Rolf Bjarne Kvinge 41c56269f6
[tests] Adjust link all's project file to set properties to their expected values according to the current configuration. (#10468)
Also don't overwrite DefineConstants, just add to it instead.
2021-01-20 07:15:33 +01:00
Rolf Bjarne Kvinge a867cf4b4f
[tests] Fix reporting exit code for .NET tests. (#10460) 2021-01-19 14:30:16 +01:00
Rolf Bjarne Kvinge 3dbdc1ea81
[dotnet-linker] Add the RemoveUserResources sub step. (#10456)
* [dotnet-linker] Add the RemoveUserResources sub step.

This comes with a few changes to the RemoveUserResources sub step as well:

* Bail out earlier if we're in the simulator (no need to do any processing at
  all - we know at the very beginning if we're building for the simulator).
* Do a positive simulator check, instead of a negative device check (because
  Mac[Catalyst] are neither devices - so they pass the negative device check).
* Remove all the conditional mtouch/mmp code, and figure out at runtime which
  resource prefixes we need to check for.

It was also necessary to change where steps are added to the pipeline: we have
to remove resources before the OutputStep, but at the same time we have to do
it after the ExtractBindingLibraries step, otherwise the
ExtractBindingLibraries step won't find any binding libraries to extract. So
move the ExtractBindingLibraries, LoadNonSkippedAssemblies and
ListExportedSymbols to before the OutputStep (to keep their internal order),
and then add the RemoveUserResources after those.

This fixes the following link sdk/link all test when running on device:

    BundledResources.ResourcesTest
        [FAIL] Bundled :   No resources
            Expected: 0
            But was:  2

* [tests] Update the BuildInterdependentBindingProjects test now that we're removing resources.
2021-01-19 14:06:25 +01:00
Rolf Bjarne Kvinge bc7af2ebb7
[tests] Ignore a few known failures in link sdk / link all on device with .NET. (#10458) 2021-01-19 07:53:13 +01:00
Rolf Bjarne Kvinge b644e23adf
[tests] Don't use the tcp tunnel in the HttpClientHandler tests. Fixes xamarin/maccore#2154. (#10451)
Fixes https://github.com/xamarin/maccore/issues/2154.
2021-01-18 14:27:34 +01:00
Rolf Bjarne Kvinge 18ab7db7c7
[xharness] Fix warning about unknown file wrt default inclusion. (#10438)
Fixes this warning when running xharness:

    Unknown file: fsharplibrary.fsproj (extension: .fsproj). There might be a default inclusion behavior for this file.
2021-01-18 07:28:39 +01:00
VS MobileTools Engineering Service 2 0cea46da64
[CI][VSTS] The pkg of the tests fail because there is a path not longer found. (#10436)
fixes: https://github.com/xamarin/maccore/issues/2363

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-01-15 17:14:21 -05:00
Rolf Bjarne Kvinge aa1bf71cd6 [monotouch-test] Make it work with Mac Catalyst.
* Fix system version checks to work properly on Mac Catalyst (which uses the macOS
  version as its system version).

* Add the framework-specific defines to the build for monotouch-test.csproj (using
  the generated response files), this way we can use them in the tests.

* Sprinkle conditionals in numerous places - I tried using either framework-specific
  or XAMCORE_3_0 whenever that made since (instead of using Mac Catalyst as a condition).

* Updated a few tests to use non-deprecated API (because the deprecated API often
  doesn't exist in Mac Catalyst).

* Also a few minor API fixes to make any corresponding tests compile.
2021-01-15 17:52:28 +01:00
Sebastien Pouliot 4eda43b1c9
[msbuild] Fix semi-conflicting options to set codesign timestamp (#10428)
TL&DR:

This effectively change nothing - but prevents (warn) if both options
contradict themselves.

Long Story....

So we have two ways to control the codesign's `--timetamp` option but
they both ignore each other so we can end up with the option being
set more than once at build time.

`DisableTimestamp` was the original one. It was meant for iOS (and
derivative OS) and disable the option (which requires the network)
for simulator or debug builds. IOW we _wanted_ timestamps when doing
release builds for devices.

```
DisableTimestamp="$(_CodesignDisableTimestamp)"
```

```
<_CodesignDisableTimestamp>False</_CodesignDisableTimestamp>
<_CodesignDisableTimestamp Condition="'$(_SdkIsSimulator)' == 'true' Or '$(_BundlerDebug)' == 'true'">True</_CodesignDisableTimestamp>
```

Now disabling the timestamp did not mean it was enabled. We did not ask
for a timestamp, leaving it to the default which from `man codesign`
means:

> If this option is not given at all, a system-specific default behavior is invoked.
> This may result in some but not all code signatures being timestamped.

Then `UseSecureTimestamp` was added for macOS builds. If hardening is
enabled then a secure timestamp is required.

`msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets` `_CodesignAppBundle`

```
UseSecureTimestamp="$(UseHardenedRuntime)"
```

However it's also exposed for iOS (shared target) in
`msbuild/Xamarin.Shared/Xamarin.Shared.targets` `__CodesignNativeLibraries`
but it would always be `false` in that case.

Adding this option means there's now always a `--timestamp` option given,
either to enable it (no URL so it means using Apple's server) or to
disable it (`=none`) but since it's controlled by `UseHardenedRuntime`,
which is macOS only, then iOS device builds are never timestamped.

An alternative would be to have `UseSecureTimestamp` as a macOS-only
option - but that would change how we currently sign the iOS applications
and I'd rather not change things that are known to work.
2021-01-15 10:43:11 -05:00
Rolf Bjarne Kvinge 29727d6a8d
[tests] Preserve a required method in System.Private.CoreLib to work around a bug in .NET 6. (#10426)
Ref: https://github.com/dotnet/runtime/issues/46908.
2021-01-15 16:39:44 +01:00
Rolf Bjarne Kvinge 24331f35dd
[monotouch-test] Adjust CaptiveNetworkTest.TryCopyCurrentNetworkInfo to work on iOS 10.3.3 (#10435)
According to Apple's documentation, an app linked with iOS 12 or later must
enable a specific entitlement, otherwise calls to CNCopyCurrentNetworkInfo
will always return NULL.
2021-01-15 16:14:27 +01:00
Manuel de la Pena d04a86a408
[CI][VSTS] The pkg of the tests fail because there is a path not longer found. (#10432) 2021-01-15 07:53:05 -05:00
Rolf Bjarne Kvinge ef53600f7a
[monotouch-test] Change the url for the TestPACParsingScriptNoProxy test to be the Microsoft uri. (#10423)
All the other *NoProxy tests use the Microsoft uri, which seems to be the uri
that's not supposed to need a proxy (according to what I understand from the
code) - in other words, it looks like this was a c&p error.

Fixes this test failure when running on device:

    [FAIL] TestPACParsingAsyncNoProxy :   Expected: None
        But was:  HTTPS
	        at MonoTouchFixtures.CoreFoundation.ProxyTest.TestPACParsingAsyncNoProxy () [0x000fa] in /Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/monotouch-test/CoreFoundation/ProxyTest.cs:238
2021-01-15 08:25:19 +01:00
Rolf Bjarne Kvinge 48080d2d03
[monotouch-test] Add version checks for new HKCategoryTypeIdentifier fields. (#10424) 2021-01-15 08:24:29 +01:00
Rolf Bjarne Kvinge ca7d562493
[monotouch-test] Add a few Xcode version checks to ColorTest and AvoidOccluderConstraintTest. (#10425)
* [monotouch-test] Adjust ColorTest.CreateByMatchingToColorSpace to be Xcode 11+ only.

This test uses CGColor.CreateSrgb, which is Xcode 11+ only.

* [monotouch-test] Restrict AvoidOccluderConstraintTest to iOS 11+.
2021-01-15 08:24:12 +01:00
Sebastien Pouliot 05e28c3713
[macos] Add correct support for producing/archiving `dSYM` (#10409)
TL&DR: This PR

1. Removes the creation of the `.dSYM` based on `Debug Information` [1]

2. Adds dSYM support to XM msbuild (now shared with XI implementation)

3. Archive the `.dSYM` directories (plural) properly, e.g.

```
msbuild -p:Configuration=Release -p:ArchiveOnBuild=true
```

Why ? The long story...

Historically `.dSYM` for Xamarin.Mac have not been very useful, largely
because (most of) the code is JITed so not much is known before runtime.
So they were simply not generated during the builds...

However AOT options were added to Xamarin.Mac, making them potentially
more useful. Also symbols from `libmono` and other native libraries /
frameworks can prove useful when diagnosing application crashes.

Unsurprisingly developers looking to get symbols eventually found _a way_
[1] to get a `.dSYM` for their applications - but it was not quite
correct because:

* setting the debug information option meant that `mmp` would be supplied with `-debug`. This disables several optimizations that are, by default, enabled for release builds. IOW generating symbols should have no effect on the executing code (but it had);

* it was produced when compiling the native launcher, so the symbols coverage was incomplete. How much depends if mono was statically or dynamically linked. However this would not cover any AOTed code nor bundled libraries or user frameworks.

* the .dSYM was produced inside the `x.app/Contents/MacOS/`, side-by-side with the native executable, which makes it part of the **signed** `.app` and also part of the created (and signed) `.pkg`. This had a large impact on the application's, disk and download, size(s). Manually (re)moving the `.dSYM` means re-signing the app and re-creating (and signing) the `.pkg` is not a good solution.

[1] https://forums.xamarin.com/discussion/139705/how-to-symbolicate-a-xam-mac-crash-log

Additional fixes

* Use `Directory.Move` instead of running the `mv` command

While the result is identical there is a cost to spawn several `mv`
processes. Doing it in parallel (might have) helped but that setup
also comes at a cost.

`Directory.Move` the four `.dylib.dSYM` of an app takes 1 ms, while
the existing code took 17 ms to do the same.

* Fix building mmptest since the DeleteDebugSymbolCommand constant is not present (nor used) anymore
2021-01-14 08:42:24 -05:00
Rolf Bjarne Kvinge db79cd6b4c
[monotouch-test] Fix a few issues when running the .NET version of monotouch-test on device. (#10419)
* [monotouch-test] Fix conditional compilation constants when building for device.

* [tests/monotouch-test] Don't use entitlements when building monotouch-test for device.
2021-01-14 14:37:31 +01:00
Rolf Bjarne Kvinge 7584ada30d
Bump to .NET 6.0.100-alpha.1.21060.3. (#10388)
* Bump to .NET 6.0.100-alpha.1.21060.3.

* Fix dotnet command line arguments.

* dotnet build: the project file must be the first argument.
* dotnet build/publish: use the documented verbosity format.

* Update version number in tests.

* [tests/introspection] Adjust introspection to cope with different library names in the new .NET version.

* [tests/link sdk] Adjust the LinkSdkRegressionTest.SpecialFolder test according to the new version of .NET 6.

* [tests/link sdk] Preserve a required method in System.Private.CoreLib to work around a bug in .NET 6.

Ref: https://github.com/dotnet/runtime/issues/46908.

* Revert "[CI][VSTS] Add the donet 6 pkg as a dependency. (#10348)"

This reverts commit 6de4e717e7.

There's no need to provision .NET 6, it's done automatically.
2021-01-14 14:07:28 +01:00
Rolf Bjarne Kvinge 4181593b15
[msbuild] Merge the iOS and Mac versions of the DetectSigningIdentity task. (#10407)
Mac Catalyst needs much of the Mac signing logic, so merge the iOS and Mac
versions of DetectSigningIdentity so that the Xamarin.iOS.Tasks assembly
contains what it needs for Mac Catalyst.
2021-01-14 07:49:30 +01:00
Rolf Bjarne Kvinge a54f948011
[msbuild] Unify handling of Sdks. (#10375)
* [msbuild] Unify handling of Sdks.

Create an Sdks class in Xamarin.MacDev.Tasks.Core, which handles both Xamarin.iOS
and Xamarin.Mac. Refactor the MacOSXSdks and IPhoneSdks classes to use the new Sdks
class.

This makes it possible to avoid some code duplication in MacOSXSdks and IPhoneSdks,
and also share code elsewhere.

This requires a bump of Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@fae0237 [Xamarin.MacDev] Add GetAppleDTSettings and GetSdkSettings to the IAppleSdk interface. (#85)

Diff: f665e3a0fc..fae0237704

* Translate exception message.

* Simplify according to review.

* Update list of non-translated strings.
2021-01-13 11:44:11 +01:00
Sebastien Pouliot 734b8a7f2a
[msbuild] Simplify resolving xcframeworks (#10376)
TD&LR: This PR simplifies how we refer to user frameworks and fixes both
warnings and non-optimal (app) output.

Much longer story:

Additional testing on macOS showed some build-time warnings and an
[extra (dupe) file](a20f8aba41 (diff-54fd7d9cd5deae57f30195be0a43133eace03c1132401741a317e0ae8d5e13fdR34)).

Logs shows that we referred to the xcframework several times, where once
should have been enough.

```
/native-reference:/Users/poupou/git/spouliot/xcframework/Universal.xcframework
/native-reference:/Users/poupou/git/spouliot/xcframework/Universal.xcframework/macos-arm64_x86_64/Universal.framework
/native-reference:/Users/poupou/git/spouliot/xcframework/Universal.xcframework/macos-arm64_x86_64/Universal.framework/Universal
```

The first `/native-reference` line produced a warning like:

```
MMP warning MM2006: Native library 'Universal.xcframework' was referenced but could not be found.
```

which makes sense as the tools (both `mmp` and `mtouch`) are not, by
design, aware of (unresolved) xcframeworks.

Removing `{NativeReference}` from `Xamarin.Mac.Common.targets` (and
`Xamarin.iOS.Common.targets`) as it has already been processed by
`_ExpandNativeReferences` solves this.

The other part of the issue (next two lines) is because `msbuild` does
not track changes to directories like it does for files - and the
workaround (in `_ExpandNativeReferences`) had to be copied in other
places (both XI and XM `_CompileToNative`) and that was not enough (and
would eventually need to be duplicated again and again).

This could lead to duplicate entries (i msbuild logs) like

```
NativeReferences
../../Universal.xcframework/macos-arm64_x86_64/Universal.framework
../../Universal.xcframework/macos-arm64_x86_64/Universal.framework/Univeral
```
which maps to our extra entries.

In order to simplify things we make the `_ExpandNativeReferences` resolve
the full path to the library name (not the `.framework` directory) which
simplifies both `_CompileToNative` and ensure a single way (at least for
`msbuild`) to provide this data to the tools (`mmp` and `mtouch`).

Using a file, instead of a directory, is also more consistent for the
existing `-framework` option, e.g. we provide the names like:

```
--framework=CoreLocation
--framework=ModelIO
```

So adding a full path that include the name is more appropriate, e.g.

``` --framework=/Users/poupou/git/master/xamarin-macios/tests/xharness/tmp-test-dir/xcframework-test760/bin/AnyCPU/Debug/bindings-xcframework-test.resources/XTest.xcframework/ios-i386_x86_64-simulator/XTest.framework/XTest
```

Finally for macOS applications it turns out we were embedding yet another
copy of the framework's library inside the `MonoBundle`, which is clearly
wrong, because of the last entry.

```
$ l bin/Release/xcf-mac.app/Contents/MonoBundle/Universal
-rwxr-xr-x  1 poupou  staff  167152  2 Dec 16:16 bin/Release/xcf-mac.app/Contents/MonoBundle/Universal
```

The tool now checks if a provided library is inside a framework (or not)
which is a good validation to have anyway when it gets called directly,
i.e. not thru `msbuild`.
2021-01-12 16:02:01 -05:00
Rolf Bjarne Kvinge 08cf9653df
[xtro] Make it possible to override the sharpie executable. (#10373)
Use a variable for the sharpie executable, so that it's easier to override
while doing testing.
2021-01-12 09:55:23 +01:00
vs-mobiletools-engineering-service2 603fdcd5ec
Bump the shared XHarness library (#10367)
Co-authored-by: Premek Vysoky <premek.vysoky@microsoft.com>
2021-01-11 17:04:56 -05:00
Rolf Bjarne Kvinge 22d65a560d
[tests] Add xtro support for Mac Catalyst. Fixes #10214. (#10289)
* [xtro] Add support for Mac Catalyst. Fixes #10214.

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

* Update xtro.

* Bump Objective-Sharpie.

* Delete .todo files for frameworks we don't support.

* And another one bites the dust.

* [xtro] Update.
2021-01-11 11:56:58 +01:00
Přemek Vysoký 1c34588487
[xharness] Bump the shared library version
This is mainly to bring in this fix: dotnet/xharness@841114a
(two parameters were swapped and BundleIdentifier was set to AppPath)

Other changes contained:

We don't log the full XML when listing devices anymore, just the file size
SimulatorLoader has a new method that accepts retryCount
2021-01-08 15:47:56 -05:00
Rolf Bjarne Kvinge 734c120bb0
[tests] Add a Xamarin.Forms test project using Mac Catalyst. (#10319) 2020-12-18 22:16:51 +01: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
Alex Soto 04461cd5c8
Merge pull request #10306 from dalexsoto/main-xcode12.3
[main] Merge xcode12.3 into main
2020-12-17 15:20:24 -05:00
Rolf Bjarne Kvinge 1582bf47cc
Add support for binding projects in Mac Catalyst. Fixes #10286. (#10295)
* [tests] Build test-libraries for Mac Catalyst.

* [msbuild] Add support for Mac Catalyst binding projects.

* [mtouch] Allow frameworks for Mac Catalyst apps.

* [mtouch] Put frameworks in the expected location for Mac Catalyst apps.

* [msbuild] Create the Resources directory before trying to put files in it.
2020-12-17 18:53:16 +01:00
Rolf Bjarne Kvinge c98b51feb7
[bgen] Avoid a NullReferenceException when reporting multiple attributes on a type. Fixes #10310. (#10311)
Fixes https://github.com/xamarin/xamarin-macios/issues/10310.
2020-12-17 15:12:32 +01:00
Rolf Bjarne Kvinge ef0763bbac
[tests] Use the FSharp.Core NuGet for Mac Catalyst. (#10307)
We're not shipping F# assemblies for Mac Catalyst, so just use the ones from
NuGet instead.

This is a partial fix for https://github.com/xamarin/xamarin-macios/issues/10217.
2020-12-17 15:01:20 +01:00
Alex Soto bd16f26f88 Merge remote-tracking branch 'xamarin/xcode12.3' into main 2020-12-15 23:50:18 -05:00
Sebastien Pouliot d7684319cd
[xtro] Fix nullability checks on parameters (#10279)
and fix most (append for AppKit) additional missing/extra null that this
fix detected in the bindings
2020-12-15 08:24:10 -05:00
Sebastien Pouliot 50e91deda7
[spritekit] Add nullability to (generated and manual) bindings (#10262)
See [HOWTO](https://github.com/xamarin/xamarin-macios/wiki/Nullability)
2020-12-14 08:32:17 -05:00
Alex Soto d5b500ff58 Revert "[tests] Ignore bcl-tests that causes a SIGFPE (#10235)"
This reverts commit 318ee8a3f5.
2020-12-10 14:31:18 -05:00
Alex Soto 051ffe51ad Revert "[tests] Ignore bcl-tests that causes a SIGFPE"
This reverts commit 2c3f8a69d2.
2020-12-10 09:59:42 -05:00
Rolf Bjarne Kvinge 38531bdcab
[CallKit] Add to macOS. (#10244) 2020-12-10 11:37:15 +01:00
Alex Soto 7a2ee467c6
[xcode12.3] Bump to Xcode 12.3 RC (#10240)
* [xcode12.3] Bump to Xcode 12.3 RC

* Remove the odds to make it even
2020-12-09 12:24:02 -05:00
Sebastien Pouliot aa73c33db9
[corebluetooth] Add nullability to (generated and manual) bindings (#10241)
See [HOWTO](https://github.com/xamarin/xamarin-macios/wiki/Nullability)
2020-12-09 09:10:55 -05:00
Sebastien Pouliot 14ad1a122b
[gamekit] Add nullability to (generated and manual) bindings (#10237)
See [HOWTO](https://github.com/xamarin/xamarin-macios/wiki/Nullability)
2020-12-08 21:37:26 -05:00
Sebastien Pouliot 4d53f14118
[tests] Re-enable ModelIO in Mac's introspection tests (fixed in 11.1 beta 2) (#10239) 2020-12-08 21:35:12 -05:00
Sebastien Pouliot 959aef9856
[network] Update for Xcode 12.2 beta 2 (#10238) 2020-12-08 17:15:26 -05:00
Alex Soto 318ee8a3f5
[tests] Ignore bcl-tests that causes a SIGFPE (#10235)
context: https://github.com/mono/mono/issues/20632
2020-12-08 12:52:04 -05:00
Sebastien Pouliot d5f9191eed
[coremotion] Update for Xcode 12.3 beta 1 (#10234) 2020-12-08 10:42:22 -05:00
Alex Soto 8830d0c088
Merge pull request #10196 from dalexsoto/xcode12.3-watchsim64
[Xcode12.3] [watchOS] Add x86_64 simulator support (#10059)
2020-12-08 08:04:53 -05:00
Sebastien Pouliot 16cd30a42c
[adservices] New in Xcode 12.3 beta 1 (#10229)
Annotations suggest that it's available on tvOS 14.3 but the headers
are not shipped in tvOS SDK.
2020-12-07 20:00:38 -05:00
Alex Soto 2c3f8a69d2 [tests] Ignore bcl-tests that causes a SIGFPE
context: https://github.com/mono/mono/issues/20632
2020-12-07 19:39:13 -05:00
Sebastien Pouliot dcc9a8322d
[gamecontroller] Update for Xcode 12.3 beta 1 (#10228) 2020-12-07 17:23:13 -05:00
Sebastien Pouliot a946610387
[healthkit] Update for Xcode 12.3 beta 1 (#10225) 2020-12-07 16:42:51 -05:00
Sebastien Pouliot 30f8156d23
[imageio] Update for Xcode 12.3 beta 1 (#10224) 2020-12-07 16:42:06 -05:00
Sebastien Pouliot bcc953bf50
[coregraphics] Expose CGColor.CreateByMatchingToColorSpace (#10223)
and add unit test

Fix https://github.com/xamarin/xamarin-macios/issues/10212
2020-12-07 16:40:29 -05:00
Rolf Bjarne Kvinge daa7e123e2
Add very early support for Mac Catalyst. (#10199)
* Install the Mac Catalyst versions of the mono libraries and BCL.
   * The BCL is the same as the one for Xamarin.iOS, which means it has to be post-processed a bit to work with a Xamarin.MacCatalyst.dll
* Build our runtime for Mac Catalyst.
* Build a Xamarin.MacCatalyst.dll with the Mac Catalyst API (it compiles, but I haven't looked at the API surface at all). This PR assumes we're going to have a new TargetFrameworkIdentifier for Mac Catalyst, but a final decision has not been made (see https://github.com/dotnet/runtime/issues/44882), so this may change.
* Build a Xamarin.iOS.dll that contains type forwarders to Mac Catalyst for all the types that exist in both Mac Catalyst and Xamarin.iOS.
* Add support to xharness for running introspection on Mac Catalyst (there are a lot of failures because the API surface is wrong)
* Add support to our msbuild tasks and mtouch for building Mac Catalyst apps. This basically comes down to adding a new case in numerous places to either do things the iOS way or the macOS way, depending on each case.
* Add a __MACCATALYST__ define (which is in addition to the __IOS__ define).
2020-12-04 18:27:37 +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 4f75b9e8da
[tests] Update test to cope with change in Xamarin.WatchOS.dll's location. (#10198)
Fixes this test failure:

* Xamarin.Linker.SdkTest.NoLLVMFailuresInWatchOS("../../32bits/Xamarin.WatchOS.dll"):
    AOT compilation
    Expected: 0
    But was: 1

This regresed in 87d04ac331.
2020-12-04 11:38:08 +01:00
Rolf Bjarne Kvinge b36b02c80e
[tests] Remove the MM0143 test, it doesn't look like VSMac is going to fix the bug. Fixes #8939. (#10183)
* [tests] Skip the MM0143 test, it doesn't look like VSMac is going to fix the bug. Fixes #8939.

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

* Remove more code.
2020-12-03 16:59:14 +01:00
Sebastien Pouliot 1d6cf0c46e
[scenekit] Add nullability to (generated and manual) bindings (#10195)
See [HOWTO](https://github.com/xamarin/xamarin-macios/wiki/Nullability)
2020-12-03 09:14:54 -05:00
Rolf Bjarne Kvinge aaf2818af5 [src] Fix availability for MPNowPlayingPlaybackState 2020-12-03 10:43:20 +01:00
Rolf Bjarne Kvinge eafa843ec2 [xharness] Add support for Mac Catalyst test suites. 2020-12-03 10:43:19 +01:00
Rolf Bjarne Kvinge 65e59b29da [msbuild] Don't generate archived-expanded-entitlements.xcent for catalyst apps 2020-12-03 10:43:19 +01:00
Rolf Bjarne Kvinge 9edb9e2885 [tests] Add test project 2020-12-03 10:42:25 +01:00
Alex Soto 2b1d0799aa [xcode12.3][watchOS] Add x86_64 simulator support
* Bumps mono binaries to include x86_64 watchOS support
* Build runtime/registrar x86_64 slices
* Produce a 64 bit version of Xamarin.WatchOS.dll
* Allow building x86_64 for watch simulators in mtouch
* Let xharness know about x86_64

* [tests] Add x86_64 arch to test-libraries

* Make dotnet package aware of x64

* [ObjCRuntime] Fix computing if we're calling a stret function or not in a 64-bit watchOS simulator.

* [xharness] Re-enable some watchOS tests.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

New commits in mono/mono:

* mono/mono@ac596375c7 Add support for OP_FCONV_TO_I to mini-arm64.c. (#20548)
* mono/mono@392fe5b87b [2020-02][watchOS] Add simwatch64 support (#20552)
* mono/mono@a22ed3f094 Fix potential crash for Encoder.Convert (#20522)
* mono/mono@970783731f Bump to F# 5.0 (#20511)
* mono/mono@32ab5066f7 Bump msbuild to fix a build issue
* mono/mono@93a7fe77e8 Ensure special static slots respect alignment. (#20506)
* mono/mono@3db5b35841 [debugger] Switch to GC Unsafe in signal handler callbacks (#20495)
* mono/mono@af315f44c4 [2020-02][corlib] ThreadAbortException protection for ArraySortHelper (#20468)
* mono/mono@ca11fb0fd8 [2020-02] Bump ikvm-fork to include https://github.com/mono/ikvm-fork/pull/20 (#20452)

Diff: be2226b5a1..ac596375c7
2020-12-02 22:23:45 -05:00
Alex Soto fa4b8dbb0a
[CoreImage] Update bindings to Xcode 12.3 Beta 1 (#10164) 2020-12-01 09:20:31 -05:00
Alex Soto 1a1b9cd78b
[Contacts] Update bindings to Xcode 12.3 Beta 1 (#10163) 2020-12-01 09:19:38 -05:00
Sebastien Pouliot 0473fce78d
[networkextension] Update to Xcode 12.3 beta 1 (#10166)
Mostly changes in Xcode 12.2 (beta 3)
https://github.com/xamarin/xamarin-macios/wiki/NetworkExtension-iOS-xcode12.2-beta3

and macOS-only changes from 12.3 beta 1
https://github.com/xamarin/xamarin-macios/wiki/NetworkExtension-macOS-xcode12.3-beta1
2020-11-30 23:11:27 -05:00
Sebastien Pouliot f07968f01b
[tvservices] Update for Xcode 12.3 beta 1 (#10184) 2020-11-30 17:16:44 -05:00
Alex Soto ba0465c2e6
[AVFoundation] Update bindings to Xcode 12.3 Beta 1 (#10162)
* [AVFoundation] Update bindings to Xcode 12.3 Beta 1

* Fix xtro
2020-11-30 14:53:20 -05:00
Sebastien Pouliot 8ad5d7bd29
[uikit] Update for Xcode 12.3 beta 1 (#10181) 2020-11-30 13:50:06 -05:00
Sebastien Pouliot 3bd14c3eef
[msbuild] Add support for `.xcframework` (#10046)
This is done early so we can resolve the inner framework, inside the
xcframework, and let the existing framework support do most of the
work.

The resolving code has unit tests. Custom projects for "NoEmbedding"
exists for all supported platforms and executed by xharness.

A sample `xcframework` with tests projects is also available 
[here](https://github.com/spouliot/xcframework).

The xcframework test case is based on Rolf's earlier/partial implementation.
https://github.com/rolfbjarne/xamarin-macios/commit/xcframework

Things to note:

Do not rename a framework (like XTest) to use it in an xcframework
(like XCTest). That will fail at codesign but won't give anything
useful. You might think signing the framework (instead of the inner
binary) would solve it. It does, as it codesign, but then the app
crash at startup. At some point you realize some symbols are still
using XTest (not XCTest) and then you can delete several other weird
workarounds (like for `ld`) because all of it was cause by this
never identified rename.

dSYM support (and tests) to be done in a separate PR.
2020-11-30 13:44:03 -05:00
Sebastien Pouliot edf1847405
[tests] Re-enable MediaAccessibility/ImageCaptioningTest.cs` `SetCaption` test (#10172)
This works fine with Xcode 12.3 beta 1 on 10.15.7 (Intel) and 11.0

ref: https://github.com/xamarin/xamarin-macios/issues/10165
2020-11-30 08:16:36 -05:00
Rolf Bjarne Kvinge 87d04ac331
[src/mtouch] Put implementation assemblies in a per-platform directory (#10169)
Currently we put the implementation assemblies for all Xamarin.iOS platforms
in the same directory. This makes it impossible to have different
implementations for the same assembly in different platforms: in particular,
we're going to want a special version of Xamarin.iOS.dll for Mac Catalyst
(that will just have type forwarders into Xamarin.MacCatalyst.dll), that that
assembly will go into the Mac Catalyst-specific directory of implementation
assemblies.
2020-11-27 18:53:25 +01:00
Alex Soto f9679cde8c
[ARKit] Update bindings to Xcode 12.3 Beta 1 (#10158)
* [ARKit] Update bindings to Xcode 12.3 Beta 1

* Update tests/introspection/ApiProtocolTest.cs
2020-11-26 10:26:04 -05:00
Sebastien Pouliot 229b6253a9
[mac] Add user-framework support for Xamarin.Mac (#10144)
* Move existing tests to iOS subdirectory and adjust reference paths
2020-11-26 08:47:41 -05:00
Sebastien Pouliot 3125f7ad73
[tests] Remove empty xtro files (#10157) 2020-11-25 14:15:47 -05:00
Sebastien Pouliot 0723e3cd20
[corevideo] Update for Xcode 12.2 RC (#10155) 2020-11-25 09:30:44 -05:00
Sebastien Pouliot 267495d0c9
[tests][monotouch] Fix recent CGColorSpace tests not to fail on macOS 10.15.x (#10142)
```
CreateExtendedTest: System.EntryPointNotFoundException : CGColorSpaceCreateExtended assembly:<unknown assembly> type:<unknown type> member:(null)
```

The API was added in iOS 14.0 (Xcode 12.0) but macOS 11.0 (Xcode 12.2)
and it does not exists on my Mac (10.15.7) even if I don't recall seeing
fail on the bots.
2020-11-24 16:30:14 -05:00
Alex Soto 54c91d3868
[xcode12.3] Initial bump to Xcode 12.3 Beta 1 (#10135) 2020-11-23 09:48:06 -05:00
Rolf Bjarne Kvinge a4a1fea868
[dotnet] Add an issue for a missing Mono.framework, which isn't on us for now. (#10126) 2020-11-23 09:44:03 +01:00
Alex Soto 72c7b1ffcc
[main][watchOS] Add x86_64 simulator support (#10059)
* [watchOS] Add x86_64 simulator support

* Build runtime/registrar x86_64 slices
* Produce a 64 bit version of Xamarin.WatchOS.dll
* Allow building x86_64 for watch simulators in mtouch
* Let xharness know about x86_64

* [tests] Add x86_64 arch to test-libraries

* Make dotnet package aware of x64

* [ObjCRuntime] Fix computing if we're calling a stret function or not in a 64-bit watchOS simulator.

* [xharness] Re-enable some watchOS tests.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-11-20 09:27:46 -05:00
Rolf Bjarne Kvinge f4c9327fac
[dotnet] Bump to .NET 6.0.100-alpha.1.20556.2 and net6.0 (#10079)
This involves a few changes:

* Change everything to reference net6.0 instead of net5.0
* Update various variables to be NET6* instead of NET5*
* Reorder build logic to account for that our targets are imported earlier in
  the build process:

   In the latest .NET 6, our Workloads.targets is imported earlier in the
   build. This requires a few changes, because we still need to run most of
   our logic later in the process, which we do by adding targets files we
   want imported later to the AfterMicrosoftNETSdkTargets property.

   What we're loading as soon as possible:

   * Our version information (Xamarin.Shared.Sdk.Versions.targets)
   * The supported OS versions
     (Microsoft.<platform>.Sdk.SupportedTargetPlatforms.targets)
   * The default OS version
     (Xamarin.Shared.Sdk.TargetFrameworkInference.targets).

   This is all information that the .NET build require early on.

   Changes:

   * Rename all files that are loaded early to *.props.
   * Updated documentations to reflect these changes.
   * Remove Microsoft.<platform>.TargetFrameworkInference.targets, these
     files aren't used and don't contain anything useful.
   * Move the logic to calculate _ComputedTargetFrameworkMoniker has been
     delayed to later, because it needs TargetFrameworkMoniker set.

* Add a StoreAttributesStep to store attributes that are removed by the
  linker, but that the static registrar needs.

   In particular, in .NET 6 the linker removes the
   System.Runtime.CompilerServices.ExtensionAttribute, which the static
   registrar needs to handle category methods properly.

   This involved copying and slightly modifying the RemoveAttributesBase
   code.
2020-11-19 15:01:55 +01:00
Manuel de la Pena 15a3060d65 [Tests] Fix msbuild tests after the test API changed. 2020-11-18 10:26:35 -05:00
Rolf Bjarne Kvinge 1570b2616d
[xharness] Bring back special processing of GuiUnit for Xamarin.Mac test projects. (#10103)
This code isn't necessary in main, because we've removed any GuiUnit usage,
but in d16-8 we're still using GuiUnit, which means we still need to process
GuiUnit project references correctly.

This fixes numerous build failures when building Xamarin.Mac tests (in
particular when building Xamarin.Mac tests for older macOS versions).
2020-11-18 15:48:33 +01:00
Manuel de la Pena f6010bee10 [AVFoundation] Fix merge issue. 2020-11-17 15:16:58 -05:00
Manuel de la Pena 999ddda01b [Xtro] Update xtro ignore files with the new mac os x bindings. 2020-11-17 12:07:19 -05:00
Manuel de la Pena a810f6954a [Security] Fix some tests after the bump to NUnitlite. 2020-11-17 11:14:04 -05:00
Manuel de la Pena 0f7bc75e50 Merge branch 'xcode12.2' into main-xcode12.2 2020-11-17 11:09:15 -05:00
Rolf Bjarne Kvinge 62a8c9ad46 [xharness] Don't generate into the same directory/files for macOS Modern and macOS Full. (#9121)
* [xharness] Don't generate into the same directory/files for macOS Modern and macOS Full.

This meant that we were overwriting some generated files, which meant that we
were executing the Modern set of tests instead of the Full set of tests for at
least some configurations.

* Add a few ignored tests to the System.Configuration test now that we actually run it.
2020-11-16 20:43:57 +01:00
Rolf Bjarne Kvinge 85c2d0a638 Fix merge conflict. 2020-11-16 19:10:46 +01:00
Rolf Bjarne Kvinge 3e14390ce6 [tests] Switch msbuild-mac to use package references. (#9245)
And don't specify the solution path anymore, because we can restore using just
the csproj just fine now.
2020-11-16 18:28:12 +01:00
Rolf Bjarne Kvinge 2cf58c57f0 [tests] Switch msbuild-mac and mmptest to use package references. (#9246)
And don't specify the solution path anymore, because we can restore using just
the csproj just fine now.
2020-11-16 18:25:57 +01:00
Rolf Bjarne Kvinge 5792c497d9 Merge remote-tracking branch 'origin/main' into dotnet-6.0.100-alpha.1.20559.4 2020-11-16 15:33:26 +01:00
Rolf Bjarne Kvinge 7218d51e1a One straggler! 2020-11-16 15:22:36 +01:00
Alex Soto fec5322de4 [tests] Fix mmp and MSBuild mac tests 2020-11-13 16:54:22 -05:00
Manuel de la Pena 02bfdcb559 Make things match. 2020-11-13 11:52:02 -05:00
Manuel de la Pena d8e21b6226 [Tets] Retarget the NUnit references in mac projects. 2020-11-13 11:48:00 -05:00
Přemek Vysoký 0fba63cdc7
[xharness] Remove Microsoft.DotNet.XHarness.iOS.Shared project and use NuGet instead (#9980) 2020-11-13 11:05:10 -05:00
Alex Soto 5173ebd456 [xharness] Manual revert of e4aaf6a8d6
Reverts: e4aaf6a8d6

This allows ApiTests to avoid issues like this https://gist.github.com/dalexsoto/0769ead003e5e501296a1861dc1aedc2
2020-11-12 21:42:26 -05:00
Alex Soto b589427668 [tests] Accomodate tests to Xcode 12.2 changes 2020-11-12 21:40:32 -05:00
Manuel de la Pena e5ea789738 [Tests][Network] Do not really check the value, just make sure that we are called. (#9901) 2020-11-12 19:38:26 -05:00
Alex Soto 1b243acbf9 Merge remote-tracking branch 'xamarin/xcode12.2' into d16-8-xcode12.2-merge 2020-11-12 18:52:53 -05:00
Sebastien Pouliot d4fb41b172
[tests] Update framework tests not to embed/zip the native binaries (#10073)
Manually added `NoBindingEmbedding` to bindings .csproj and removed
`[LinkWith]` attributes.

Also added support for NativeReference to harness and updated the
workaround for watchOS (since it can't link against ModelIO)

Fixed/adapted unit tests wrt change
2020-11-11 12:00:48 -05:00
Rolf Bjarne Kvinge d6756f4829 Merge remote-tracking branch 'origin/main' into dotnet-6.0.100-alpha.1.20559.4 2020-11-11 16:38:15 +01:00
Rolf Bjarne Kvinge bbc81dd80c
[dotnet] We're not doing anything with regards to the http handler, so we won't have a runtime-options.plist. (#10083) 2020-11-11 07:43:49 +01:00
Rolf Bjarne Kvinge db23ca881a
[dotnet] Add _CreateDebugSettings, _CreateDebugConfiguration and _CreatePkgInfo to the targets we run on app creation. (#10061) 2020-11-10 13:44:26 +01:00
Rolf Bjarne Kvinge ac36750f49
[tests] Add a tvOS version of the dotnet introspection test project. (#10066)
* [tests] Move the dotnet introspection test project to a new test directory.

A tvOS project will come soon too, this makes the separation nicer.

* [tests] Add a tvOS version of the dotnet introspection test project.
2020-11-10 13:44:05 +01:00
Rolf Bjarne Kvinge c640775699 [dotnet] Bump to .NET 6.0.100-alpha.1.20556.2. and net6.0
New commits in spouliot/Touch.Unit:

* spouliot/Touch.Unit@f8768d9 Advance into the world of net6.0

Diff: 9abe69e6f5..f8768d99ef
2020-11-10 11:41:06 +01:00
Sebastien Pouliot 7db9e66d87
[tests] Disable XM samples that use QTKit, ibtool won't compile their nib anymore (#10057) 2020-11-05 13:24:27 -05:00
monojenkins f7b13c49f2
[tests] Bump sampletester hashes to pick up fixes (#10054) 2020-11-05 11:32:05 -05:00
monojenkins 64166db9f4
[tests] Bump sampletester hashes to pick up fixes (#10042) 2020-11-05 10:30:51 -05:00
Rolf Bjarne Kvinge 0def89604d
[msbuild] Add Metal files to our items included by default. (#10049) 2020-11-05 15:36:36 +01:00
Rolf Bjarne Kvinge 8aa53ba943
[dotnet] Add app extension targets to our list of stuff to do during the build. (#10044)
That makes app extensions build in dotnet.

This required adding a RuntimeIdentifier property to all the extension test
projects.
2020-11-05 08:34:29 +01:00
Rolf Bjarne Kvinge 1c6cd0b439
[tests] Re-enable the ReleaseBuild.RebuildTest, since we're using msbuild exclusively now. (#10041)
This test also required a few changes to pass.
2020-11-05 08:24:50 +01:00
TJ Lambert c67a2d076c
[msbuild] Adding W0111 Translations (#10022)
Updating msbuild localization string translation for error code W0111
2020-11-04 09:55:06 -06:00
Rolf Bjarne Kvinge e7dd367125
[msbuild] Add CoreML models to our items included by default. (#10038) 2020-11-04 16:01:43 +01:00
Rolf Bjarne Kvinge 32f360ed42
[tests] Re-enable an that requires msbuild (as opposed to xbuild). (#10040)
Since we're using msbuild exclusively now.
2020-11-04 15:19:05 +01:00
Sebastien Pouliot 9eeeb5c512
[tests] Bump sampletester hashes to pick up fixes (#10020) 2020-11-04 09:01:47 -05:00
Rolf Bjarne Kvinge 781bc851a5
[dotnet] Add atlas textures to the our items included by default. (#9995) 2020-11-04 08:40:16 +01:00
Rolf Bjarne Kvinge d104a660ed
[tests] Update .NET unit tests to parse the binlog. (#10031)
Update the .NET unit tests to parse the binlog instead of standard output for
specific build output, since we're not printing a diagnostic build log to
standard output anymore.

This fixes numerous test failures in the .NET unit tests:

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest("watchOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBundledResources("iOS","monotouch"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildEmbeddedResourcesTest("iOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBundledResources("watchOS","monotouch"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest2("tvOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest("tvOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest("iOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBundledResources("tvOS","monotouch"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildMyTVApp: Linker did not executed as expected.
        Expected: String containing "Building target "_RunILLink" completely."
        But was: "Microsoft (R) Build Engine version 16.8.0-preview-20475-05+aed5e7ed0 for .NET [...]"

    * Xamarin.Tests.DotNetProjectTest.BuildMySingleView: Linker did not executed as expected.
        Expected: String containing "Building target "_RunILLink" completely."
        But was: "Microsoft (R) Build Engine version 16.8.0-preview-20475-05+aed5e7ed0 for .NET [...]"

    * Xamarin.Tests.DotNetProjectTest.BuildInterdependentBindingProjects("iOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildEmbeddedResourcesTest("tvOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest2("watchOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildFSharpLibraryTest("tvOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildFSharpLibraryTest("watchOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildEmbeddedResourcesTest("watchOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildBindingsTest2("iOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildInterdependentBindingProjects("tvOS"): Assemblies
        Expected: not <empty>
        But was: <empty>

    * Xamarin.Tests.DotNetProjectTest.BuildFSharpLibraryTest("iOS"): Assemblies
        Expected: not <empty>
        But was: <empty>
2020-11-03 18:20:33 +01:00
Sebastien Pouliot 1f0b89cd6a
[appkit] Fix introspection tests for NSAccessibility on macOS 10.9 (#10016)
This reverts parts of https://github.com/xamarin/xamarin-macios/pull/9993
and add a special case to the test looking for duplicate attributes
between members and the type.

Why ? Introspection fails because `bgen` inline the `NSAccessibility`
protocol (added in 10.10) into types that existed earlier. That's
normally not a problem since the type-level attribute is there.
However because of the 10.9 (type) vs 10.10 (protocol) issue that was
moved into the manual bindings (so `bgen` does not know it)

Even if built inside `COREBUILD` the issue exists since the protocol
interface does not really exists at that point (by default), so it's
the type (10.9) availability that is looked up.

In retrospect we should have created a new type, like Swift did (a
few years later), named `NSAccessibilityProtocol` for 10.10.

Fix https://github.com/xamarin/xamarin-macios/issues/10009
2020-11-02 08:15:47 -05:00
Sebastien Pouliot a18679b036
[metrickit] Add missing `MXMetricManager.MakeLogHandle` API (#10017)
and add unit test since it's _partially_ a manual binding as it
returns an non-ObjC type.

Fixes https://github.com/xamarin/xamarin-macios/issues/10004
2020-10-30 18:28:58 -04:00
TJ Lambert d51d34a0eb
[msbuild] Localization String Test for All Strings (#9971)
This test will run through all available strings in MSBStrings.Designer.cs in the each of the supported languages.
If any strings should fire in other languages but are still in english, an error will be thrown unless that error code is in an ignore file.

There are two types of ignore files introduced:

LocalizationIgnore/common-Translations.ignore
for error codes that are not yet translated in all languages
LocalizationIgnore/<LOCALE>-Translations.ignore
for error codes that are not yet translated in the specific locale

If an error code is in an ignore file and it turns out it is translated, an error will be thrown to remove the error code from the ignore file.

If there is a non-valid error code in any ignore file, an error will also be thrown.

Wiki will be updated for the team to reflect this test: https://github.com/xamarin/maccore/wiki/Localization
2020-10-30 10:19:55 -05:00
Rolf Bjarne Kvinge 6e5f39a5b5
[tests] Make sure there are no simulators lurking around when we start running the .NET unit tests. (#10013)
It seems actool can fail in interesting ways if there are other types of simulators running from earlier tests:

* com.apple.actool.errors
   * Failed to find newest available Simulator runtime, no available runtime found from:
        watchOS 7.0 (7.0 - 18R382) - com.apple.CoreSimulator.SimRuntime.watchOS-7-0 (unavailable, failed to open liblaunch_sim.dylib) ==> not available: Error Domain=com.apple.CoreSimulator.SimError Code=401 "The watchOS 7.0 simulator runtime is not available." UserInfo={NSLocalizedDescription=The watchOS 7.0 simulator runtime is not available., NSUnderlyingError=0x7ff2160359b0 {Error Domain=NSPOSIXErrorDomain Code=53 "Software caused connection abort" UserInfo={NSLocalizedFailureReason=XPC error talking to SimLaunchHostService: <error: 0x7fff958b89a0> { count = 1, transaction: 0, voucher = 0x0, contents =
        	"XPCErrorDescription" => <string: 0x7fff958b8b08> { length = 18, contents = "Connection invalid" }
        }}}, NSLocalizedRecoverySuggestion=Unable to open liblaunch_sim.dylib.  Try reinstalling Xcode or the simulator runtime., NSLocalizedFailureReason=failed to open liblaunch_sim.dylib}

        tvOS 14.0 (14.0 - 18J383) - com.apple.CoreSimulator.SimRuntime.tvOS-14-0 (unavailable, failed to open liblaunch_sim.dylib) ==> not available: Error Domain=com.apple.CoreSimulator.SimError Code=401 "The tvOS 14.0 simulator runtime is not available." UserInfo={NSLocalizedDescription=The tvOS 14.0 simulator runtime is not available., NSUnderlyingError=0x7ff216332580 {Error Domain=NSPOSIXErrorDomain Code=53 "Software caused connection abort" UserInfo={NSLocalizedFailureReason=XPC error talking to SimLaunchHostService: <error: 0x7fff958b89a0> { count = 1, transaction: 0, voucher = 0x0, contents =
        	"XPCErrorDescription" => <string: 0x7fff958b8b08> { length = 18, contents = "Connection invalid" }
        }}}, NSLocalizedRecoverySuggestion=Unable to open liblaunch_sim.dylib.  Try reinstalling Xcode or the simulator runtime., NSLocalizedFailureReason=failed to open liblaunch_sim.dylib},

        iOS 14.1 (14.1 - 18A8394) - com.apple.CoreSimulator.SimRuntime.iOS-14-1 (unavailable, failed to open liblaunch_sim.dylib) ==> not available: Error Domain=com.apple.CoreSimulator.SimError Code=401 "The iOS 14.1 simulator runtime is not available." UserInfo={NSLocalizedDescription=The iOS 14.1 simulator runtime is not available., NSUnderlyingError=0x7ff21a607c80 {Error Domain=NSPOSIXErrorDomain Code=53 "Software caused connection abort" UserInfo={NSLocalizedFailureReason=XPC error talking to SimLaunchHostService: <error: 0x7fff958b89a0> { count = 1, transaction: 0, voucher = 0x0, contents =
        	"XPCErrorDescription" => <string: 0x7fff958b8b08> { length = 18, contents = "Connection invalid" }
        }}}, NSLocalizedRecoverySuggestion=Unable to open liblaunch_sim.dylib.  Try reinstalling Xcode or the simulator runtime., NSLocalizedFailureReason=failed to open liblaunch_sim.dylib},
    ] when matching for <IBCocoaTouchPlatformToolDescription: 0x7ff216274910> System content for IBAppleTVFramework-fourteenAndLater <IBScaleFactorDeviceTypeDescription: 0x7ff21622c520> scaleFactor=1x, renderMode.identifier=(null), idiom=<IBAppleTVIdiom: 0x7ff219f898b0> runtime=<IBCocoaTouchTargetRuntime: 0x7ff216257050>
2020-10-30 15:40:28 +01:00
Rolf Bjarne Kvinge 957bb31838 Merge remote-tracking branch 'origin/main' into tests-msbuild-improve 2020-10-30 08:34:02 +01:00
Rolf Bjarne Kvinge b7ca87a344
[tests] Remove 10.15 version checks since we only run on 10.15+ now. (#9999) 2020-10-30 07:49:36 +01:00
Rolf Bjarne Kvinge acf4038386
[dotnet] Don't try to include any results from the AOT compiler unless we're on a Mac. (#9989)
Because the AOT compiler won't execute unless we're on a Mac.

Also add a test.
2020-10-30 07:48:34 +01:00
Rolf Bjarne Kvinge 69a171abff [tests] Clean up Xamarin.MacDev.Tests.
This is a pretty big refactoring, which:

* Always copies the test projects to a temporary directory before running any tests
  that use them.
* Runs all the tests using an out-of-process MSBuild instance.
* Logs to a binlog instead of writing text to stdout.
* Refactors all the code that used the MSBuild assemblies in memory to instead:
    * Tests that modified projects in memory now modifies them on disk instead. This
      won't affect the working copy because the tests are always working with a copy
      of the test projects.
    * Tests that inspected projects in memory afterwards now parses the binlog to get
      the same information.
* Significantly simplified the code to setup the test projects for testing.
2020-10-29 14:52:31 +01:00
Rolf Bjarne Kvinge ebb3da262b [tests] There's no need to reference the MSBuild assemblies from Xamarin.MacDev.Tests anymore, we're going out-of-process! 2020-10-29 14:52:31 +01:00
Rolf Bjarne Kvinge 0ba5faecb5 [tests] There's no need for Xamarin.MacDev.Tests to reference Xamarin.iOS.Tasks
But we still need a reference to Xamarin.MacDev, since we use some code from that assembly.
2020-10-29 14:52:31 +01:00
Rolf Bjarne Kvinge 6aa51156a2 [tests] Remove BundlePath from ProjectTest, it's not used 2020-10-29 14:52:31 +01:00
Rolf Bjarne Kvinge 4d9bbaf650 [tests] Add Platform/Configuration to TestBase.
This makes it easier to simplify some code later.
2020-10-29 14:52:30 +01:00
Rolf Bjarne Kvinge 915f96b885 [tests] Remove dead code 2020-10-29 14:51:53 +01:00
Rolf Bjarne Kvinge 1ea929ac48 [tests] Remove unused variable. 2020-10-29 14:51:53 +01:00
Rolf Bjarne Kvinge 16c60508c5 [tests] Remove outdated comment 2020-10-29 14:51:53 +01:00
Rolf Bjarne Kvinge 62af8c3fd9 [tests] Use binlog instead of text logs 2020-10-29 09:53:06 +01:00
Rolf Bjarne Kvinge d882a3e370 [tests] Drop AssemblyInitialization from Xamarin.MacDev.Tests, it's not needed 2020-10-29 09:53:06 +01:00
Rolf Bjarne Kvinge 8f2913b518
[dotnet] Add asset catalogs to the our items included by default. (#9841) 2020-10-29 09:18:20 +01:00
Rolf Bjarne Kvinge 1197c67ebe
[tests] Rewrite ValidateAppBundleTaskTests to not create a task in-process. (#9983)
This is a step towards making Xamarin.MacDev.Tests run tests out-of-process.

It requires adding '_GenerateBundleName' as a dependency for the
'_ValidateAppBundle' target, because we're invoking the '_ValidateAppBundle'
directly, and we can't depend on any other targets executing
'_GenerateBundleName', because there are no other executed targets.
2020-10-29 08:59:11 +01:00
Sebastien Pouliot c3d66bcdca
[tests][monotouch-tests] ModelIO tests can't be executed on old Mac (#9988)
even if broken/ignored on 12.2 beta 3 the original condition, to check
for Xcode 9, remains required.
2020-10-28 13:54:42 -04:00
Rolf Bjarne Kvinge 26e720943f
[tests] Bump Xamarin.MacDev.Tests to net472 (#9986) 2020-10-28 17:48:04 +01:00
Rolf Bjarne Kvinge d02a2c2c3f
[tests] Simplify WatchKit 1 test (since we don't support WatchKit 1 anymore) (#9987) 2020-10-28 17:47:51 +01:00
Rolf Bjarne Kvinge 139c11a190
[tests] Use MyiOSFrameworkBinding as a binding test project instead of bindings-test (#9985)
MyiOSFrameworkBinding is in our normal collection of test projects (in
tests/common/TestProjects), which means it doesn't need a lot of special
casing to make it work.
2020-10-28 17:21:40 +01:00
Rolf Bjarne Kvinge 2cfbb67d31
[tests] Fix assert in DetectAppManifest_LibraryProject. (#9982)
"Is.Not.Null.Or.Empty" is equal to "(value != null) || (value.Length == 0)", which
is the same as "value != null", i.e. "Is.Not.Null", which was clearly not the intention
of this code.

The fact is that the _AppManifest value is not set for library projects, so the correct
assert is to verify that the value is null or empty.
2020-10-28 13:13:22 +01:00
Rolf Bjarne Kvinge 9cf78cf399
[tests] Clean up Xamarin.MacDev.Tasks.Tests. (#9975)
* Remove a lot of dead code.
* Use TestBase.CreateTask<T> to create tasks (and set required properties for all
  tasks) instead of instantiating tasks directly. This required subclassing TestBase
  in a few places, as well as making a few helper methods instance methods instead
  of static methods.
* Bump to net472.
* A few other misc simplifications.
2020-10-28 08:13:18 +01:00
Rolf Bjarne Kvinge c72b320561
[tests] Set MSBuildEnableWorkloadResolver=true when running the .NET tests. (#9977)
This works fine when executed from xharness, because
MSBuildEnableWorkloadResolver is set by xharness, but without this the dotnet
tests fail when executed from the IDE.
2020-10-28 08:12:19 +01:00
Sebastien Pouliot 7e854827d4
[msbuild] Have `XcodeCompilerToolTask` use `xcrun` to start Apple tools (#9965) (#9972)
1. Use `xcrun` to run `ibtool` (and `actool`) and avoid toolchain mismatches

2. Set `DEVELOPER_DIR` so everyone (well `xcrun`) use the same toolchain

3. Workaround for `macos-arm64` issue (FB8827920)

	* Start `ibtool` as an `Apple` [Silicon] process
	* This will ensure the `ibtoold` daemon is also running as `Apple`
	* If `ibtoold` is run as `Intel` then `ibtool` asserts and build fail

```
LaunchScreen.storyboard : error : 2020-10-26 14:24:52.757 ibtoold[37142:6681382] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-17506/InterfaceBuilderKit/Utilities/IBAbstractInterfaceBuilderPlatformToolManager.m:481
LaunchScreen.storyboard : error : Details:  Failed to attach to IBAgent-iOS with error: Error Domain=com.apple.InterfaceBuilder Code=-1 "Encountered an error communicating with IBAgent-iOS." UserInfo={NSLocalizedFailureReason=IBAgent-iOS (37146) failed to launch and exited with status 10, NSUnderlyingError=0x7fa4e58fc760 {Error Domain=com.apple.InterfaceBuilder Code=-1 "Failed to launch IBAgent-iOS via CoreSimulator spawn" UserInfo={NSLocalizedDescription=Failed to launch IBAgent-iOS via CoreSimulator spawn, NSUnderlyingError=0x7fa4e5e8a900 {Error Domain=com.apple.InterfaceBuilder Code=-1 "Failed to handshake with platform tool" UserInfo={NSLocalizedFailureReason=Failed to open connection over FIFOs with platform tool, NSLocalizedDescription=Failed to handshake with platform tool, NSUnderlyingError=0x7fa4e5e237c0 {Error Domain=com.apple.InterfaceBuilder Code=-1 "" UserInfo=0x7fa4e5e8bba0 (not displayed)}}}}}, NSLocalizedRecoverySuggestion=Please check Console.app for crash reports for "IBAgent-iOS" for further information., NSLocalizedDescription=Encountered an error communicating with IBAgent-iOS.}
LaunchScreen.storyboard : error : Object:   <IBCocoaTouchToolManager>
LaunchScreen.storyboard : error : Method:   +_THREADSAFE_launchNewToolWithLaunchContext:executionContext:toolProxyClass:proxyDelegate:failureContext:requestingMethod:error:forReason:
LaunchScreen.storyboard : error : Thread:   <NSThread: 0x7fa4e341af70>{number = 1, name = main}
LaunchScreen.storyboard : error : Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
LaunchScreen.storyboard : error : 2020-10-26 14:24:52.766 ibtoold[37142:6681382] [MT] IBPlatformTool: *** Failed to launch tool with description <IBCocoaTouchPlatformToolDescription: 0x7fa4e5f34160> System content for IBCocoaTouchFramework-fourteenAndLater <IBScaleFactorDeviceTypeDescription: 0x7fa4e5f2fb50> scaleFactor=2x, renderMode.identifier=(null): Encountered an error communicating with IBAgent-iOS. (Failure reason: IBAgent-iOS (37146) failed to launch and exited with status 10): Failed to launch IBAgent-iOS via CoreSimulator spawn: Failed to handshake with platform tool (Failure reason: Failed to open connection over FIFOs with platform tool): : Failed to open FIFOs for handshaking with platform tool (Failure reason: IBAgent-iOS exited before we could handshake)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1425,3): error : ibtool exited with code 1
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1425,3): error :
LaunchScreen.storyboard : ibtool error : Encountered an error communicating with IBAgent-iOS.
```

Note: `main` has diverged quite a bit (net6 support) so this pull request
will need to be re-worked (it won't apply)

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

Foreport of #9965 since the source code diverged from `xcode12.2`
2020-10-27 21:11:08 -04:00
Rolf Bjarne Kvinge ebef5e3e6b
[xharness] Automatically run the msbuild tests if something in the msbuild or tests/msbuild directories changed. (#9976) 2020-10-27 21:45:57 +01:00
Sebastien Pouliot 93d8fa89a9
[msbuild] Have `XcodeCompilerToolTask` use `xcrun` to start Apple tools (#9965)
1. Use `xcrun` to run `ibtool` (and `actool`) and avoid toolchain mismatches

2. Set `DEVELOPER_DIR` so everyone (well `xcrun`) use the same toolchain

3. Workaround for `macos-arm64` issue (FB8827920)

	* Start `ibtool` as an `Apple` [Silicon] process
	* This will ensure the `ibtoold` daemon is also running as `Apple`
	* If `ibtoold` is run as `Intel` then `ibtool` asserts and build fail

```
LaunchScreen.storyboard : error : 2020-10-26 14:24:52.757 ibtoold[37142:6681382] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-17506/InterfaceBuilderKit/Utilities/IBAbstractInterfaceBuilderPlatformToolManager.m:481
LaunchScreen.storyboard : error : Details:  Failed to attach to IBAgent-iOS with error: Error Domain=com.apple.InterfaceBuilder Code=-1 "Encountered an error communicating with IBAgent-iOS." UserInfo={NSLocalizedFailureReason=IBAgent-iOS (37146) failed to launch and exited with status 10, NSUnderlyingError=0x7fa4e58fc760 {Error Domain=com.apple.InterfaceBuilder Code=-1 "Failed to launch IBAgent-iOS via CoreSimulator spawn" UserInfo={NSLocalizedDescription=Failed to launch IBAgent-iOS via CoreSimulator spawn, NSUnderlyingError=0x7fa4e5e8a900 {Error Domain=com.apple.InterfaceBuilder Code=-1 "Failed to handshake with platform tool" UserInfo={NSLocalizedFailureReason=Failed to open connection over FIFOs with platform tool, NSLocalizedDescription=Failed to handshake with platform tool, NSUnderlyingError=0x7fa4e5e237c0 {Error Domain=com.apple.InterfaceBuilder Code=-1 "" UserInfo=0x7fa4e5e8bba0 (not displayed)}}}}}, NSLocalizedRecoverySuggestion=Please check Console.app for crash reports for "IBAgent-iOS" for further information., NSLocalizedDescription=Encountered an error communicating with IBAgent-iOS.}
LaunchScreen.storyboard : error : Object:   <IBCocoaTouchToolManager>
LaunchScreen.storyboard : error : Method:   +_THREADSAFE_launchNewToolWithLaunchContext:executionContext:toolProxyClass:proxyDelegate:failureContext:requestingMethod:error:forReason:
LaunchScreen.storyboard : error : Thread:   <NSThread: 0x7fa4e341af70>{number = 1, name = main}
LaunchScreen.storyboard : error : Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
LaunchScreen.storyboard : error : 2020-10-26 14:24:52.766 ibtoold[37142:6681382] [MT] IBPlatformTool: *** Failed to launch tool with description <IBCocoaTouchPlatformToolDescription: 0x7fa4e5f34160> System content for IBCocoaTouchFramework-fourteenAndLater <IBScaleFactorDeviceTypeDescription: 0x7fa4e5f2fb50> scaleFactor=2x, renderMode.identifier=(null): Encountered an error communicating with IBAgent-iOS. (Failure reason: IBAgent-iOS (37146) failed to launch and exited with status 10): Failed to launch IBAgent-iOS via CoreSimulator spawn: Failed to handshake with platform tool (Failure reason: Failed to open connection over FIFOs with platform tool): : Failed to open FIFOs for handshaking with platform tool (Failure reason: IBAgent-iOS exited before we could handshake)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1425,3): error : ibtool exited with code 1
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1425,3): error :
LaunchScreen.storyboard : ibtool error : Encountered an error communicating with IBAgent-iOS.
```

Note: `main` has diverged quite a bit (net6 support) so this pull request
will need to be re-worked (it won't apply)

Fixes https://github.com/xamarin/xamarin-macios/issues/4634
2020-10-27 08:07:52 -04:00
Manuel de la Pena e64aeb4ada
[Xharness] Bring xharness changes to d16-8 (#9951)
* [xharness] Add support for skipping more test variations.

* [xharness] Add the dotnet introspection project file to our list of projects, and mark it as a .NET project.

* [xharness] Clearly label .NET projects as such.

* [xharness] Disable project generation for .NET projects for now.

* [xharness] Create DotNetBuildTasks when we need to build .NET projects.

* [xharness] Improve project cloning to take into account default inclusion behavior for .NET projects.

.NET projects will include files from the current directory by default, which
means that if we clone the project file and write the cloned project file in a
different directory, we'll have to add an automatically included files into
the cloned file manually.

* [xharness] Add a GetDotNetExecutable callback and an MSBuildPath property to [I]ProcessManager.

* [xharness] Retrieve a .NET project's OutputPath by running MSBuild.

.NET projects are vastly simplified, which means that the OutputPath can't be
determined by reading the project file itself, it has to be calculated by
MSBuild.

So that's exactly what we do: we run MSBuild on the project file and get it to
print the property we're interested in.

* [xharness] Skip the old simulator variation for introspection/dotnet for now.

* [xharness] Try to not have log directories with spaces in them. (#8976)

The simulators won't write stdout/stderr to a path with a space.

* [xharness] Don't generate makefile targets for .NET projects.

They end up with the same make targets as non-.NET targets, which prints
warnings in the terminal when running make.

We're not using the makefile targets much anymore, so postpone implementing
them for .NET until we need them for some reason.

* [xharness] Add support for generating a tvOS version of .NET iOS projects. (#9032)

* [xharness] Add support for generating a tvOS version of .NET iOS projects.

And use it to run the tvOS version of introspection for .NET.

* [xharness] Change according to reviews.

* [xharness] Use Cecil to inspect assemblies, instead of Reflection. (#9082)

This is slightly faster - ~0.95s vs ~1.4s - (probably because reflection tries
to load a lot of other referenced assemblies, which may or may not exist,
causing exceptions (if they don't exist) or spend time loading them (which
Cecil won't)).

It also avoids a lot of exception details showing up when tracing xharness
execution.

* [xharness] Don't group simulators when running in server mode. (#9098)

Grouping simulators means we have to wait until we know which simulators are
available, because we group by the simulator's UDID.

When running in server mode, we don't need to group simulator test runs,
because we run the as the user chooses, not in any particular order.

This way the test list loads faster at startup, since we don't have to wait
until we've loaded the simulators before we can show the list.

* [xharness] Fix finding testable types in test assemblies. Fixes #xamarin/maccore@2267. (#9103)

Apparently a null namespace when using Reflection can be an empty namespace in Cecil.

Fixes https://github.com/xamarin/maccore/issues/2267.

* [xharness] Parse NUnit v2 xml reports correctly. (#9110)

* [xharness] De-asyncify template expansion. (#9104)

This avoids:

* Getting the resource stream for every template expansion
* Reading the resource stream
* A lot of async code.

Instead just read the resource stream once, into a string, and return that.

This speeds up the startup by ~10% (from ~0.96s to ~0.83s on my machine).

* [xharness] Improve code to not throw exceptions in the first place instead of catching and ignoring. (#9118)

* [xharness] Try harder to make lldb quit after trying to get a backtrace. (#9119)

When a process times out, we try to print a stack trace for all threads. This
involves executing "lldb --source <script>", where the script contains:

	process attach --pid 1234
	thread list
	thread backtrace all
	detach
	quit

Basically we attach to the project, and ask lldb to print stack traces.

The problem:

    16:09:02.9522580 Printing backtrace for pid=25276
    16:09:02.9528060 /usr/bin/lldb --source /var/folders/q7/mkzwrzcn7bzf3g2v38f3c1cw0000gn/T/tmp58e75d85.tmp
    16:09:04.6127570 (lldb) command source -s 0 '/var/folders/q7/mkzwrzcn7bzf3g2v38f3c1cw0000gn/T/tmp58e75d85.tmp'
    16:09:04.6130020 Executing commands in '/var/folders/q7/mkzwrzcn7bzf3g2v38f3c1cw0000gn/T/tmp58e75d85.tmp'.
    16:09:04.6130200 (lldb) process attach --pid 25276
    16:09:05.6458750 error: attach failed: Error 1
    16:09:05.7529100 25276 Execution timed out after 1200 seconds and the process was killed.
    16:09:05.7588770 Execution timed out after 1200 seconds.

If any of those commands fail, the subsequent commands aren't executed. This
includes the final "quit" command, which means we end up waiting forever for
lldb to do its thing, when lldb doesn't think it needs to do anything at all.

The fix: pass two different scripts. It turns out subsequent scripts are
executed even if previous scripts fail, so we do the equivalent of:

     lldb --source <attach script> --source <quit script>

And now lldb will quit no matter what the attach script does (it still works
even if the attach script succeeds, in which case we'll ask lldb to quit
twice).

* [xharness] Improve process killing a bit. (#9120)

* Log what we're doing.
* Wait a bit after sending SIGABRT, to allow for the OS to create any crash
  reports.

* [xharness] Don't try to write cleaned xml into the same file as the dirty xml was. (#9122)

* [xharness] Don't replace existing files, instead add new files, when providing human-readable logs. (#9123)

This makes understanding what's going on much easier.

* [xharness] Fix BCL project generation for watchOS projects. (#9131)

Reading from a file named as the actual content of the watchOS template doesn't
_quite_ work. Instead just use the content directly.

* [xharness] Only try to parse the build log if we have a build log. (#9130)

* [xharness] Don't generate into the same directory/files for macOS Modern and macOS Full. (#9121)

* [xharness] Don't generate into the same directory/files for macOS Modern and macOS Full.

This meant that we were overwriting some generated files, which meant that we
were executing the Modern set of tests instead of the Full set of tests for at
least some configurations.

* Add a few ignored tests to the System.Configuration test now that we actually run it.

* [xharness] Disable default inclusion behavior for the introspection .NET tests. (#9137)

It gets too annoying to keep track of which files are where with the project
cloning we're doing, if files are implicitly included.

* [xharness] Generate BCL projects asynchronously. (#9083)

Split the BCL project generation in two: one part that figures out which
projects to generate, and which is done synchronously (because we need it to
compute the list of tests), then split out the actual generation and run it on
a background thread (since that doesn't have to happen until we want to
execute those tests).

This speeds up launching xharness in server mode significantly (from ~2s to
~0.2s).

* [xharness] Document the test loading process a little bit.

* [xharness] Generate projects into a subdirectory for each project.

Because it's cumbersome to keep the build working when the same directory has
multiple project files.

* [xharness] Remove a lot of special-casing for the mono-native tests.

It's not needed anymore.

* [xharness] Store attribute in local variable instead of fetching it twice.

* [xharness] Make ProjectFileExtensions.GetInfoPListInclude a bit clearer.

Add a comment to document what's supposed to happen, and simplify the code a little bit.

* [xharness] Add support for specifying whether variations should be generated for Xamarin.iOS projects.

* [xharness] Don't generate variations for BCL projects using the normal procedure, we generate them differently already.

This makes it possible to remove some dead code.

* [xharness] Add a TestPlatform value to TestProject, and use it to indicate that a TestProject might be of a specific platform already.

* [xharness] Make the templates path an input parameter for the BCL templates.

* [xharness] Make the BCL project generation generate each project file into its own subdirectory.

* [tests] Put the iOS and macOS mono-native templates in their own directory.

This makes it possible to remove a few conditions in the code.

* [xharness] Simplify the MonoNativeInfo class a bit by removing the custom Mac-specific subclass (there's almost no difference anymore).

* [tests] Move bindings-test[-mac].csproj to their own directory.

* [xharness] Fix compiler warning. (#9147)

* [xharness] Fix logic to not create makefile targets to run BCL tests. (#9148)

According to the existing code, we're already not supposed to create makefile
targets for BCL tests. However, the code to detect BCL tests wasn't quite
reliable, so we ended up creating makefile targets for some BCL tests.

So always use the same logic to detect BCL tests.

Also remove a lot of dead code to generate makefile code for BCL tests.

* [tests] Set the correct mono-native link mode and flavor defines in the csproj itself.

This makes it possible to simplify a lot of C# code.

* [xharness] Remove a redundant ToArray.

* [xharness] Allow for null environment variables to mlaunch. (#9140)

It's a valid scenario to set a null environment variable.

This happens when changing InCI to always return true (to test locally what's
done on the bots), in which case we try to forward BUILD_REVISION to mlaunch,
but BUILD_REVISION isn't necessarily set. Not forwarding it to mlaunch should
not cause problems in most tests, so just allow this scenario.

* [xharness] Generate makefile targets for non-executable projects. (#9158)

It turns out some Xamarin.Mac projects are library projects (for unit tests),
and we still need to generate makefile targets for those (because we use them
to build Xamarin.Mac tests to run on older macOS bots).

* [xharness] Backport Touch.Unit fix for command line parsing. (#9165)

Apply https://github.com/spouliot/Touch.Unit/pull/78 to the duplicated file.

* [tests] Info.plists should be inside LogicalName, not Link.

This makes it possible to simplify a bit more code inside xharness as well.

* Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project

* [xharness] Fix finding Info.plist, and add some tests too.

* [xharness] Fix how .NET projects are ignored. (#9168)

* [xharness] Fix how .NET projects are ignored.

Now they're actually ignored if .NET tests are not included.

* Fix compile error.

* Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project

* [xharness] If we're not generating projects in the Target class, the project path equals the template path.

* [xharness] Make restoring nugets the default for all test projects. (#9237)

But don't do it for .NET projects, since 'dotnet build' automatically restores.

* [xharness] Improve restoring NuGets for Xamarin.Mac projects in the makefile by depending on the csproj files in addition to the packages.conf files. (#9242)

Packages are listed in the csproj when we're using package references.

Also only list files in git, otherwise we pick up all the generated project files as well.

* [tests] Migrate the sample tests to use package references. (#9244)

* [tests] Switch msbuild-mac to use package references. (#9245)

And don't specify the solution path anymore, because we can restore using just
the csproj just fine now.

* [xharness] Mark the .NET tests project as a .NET project so that we don't try to call nuget restore on it. (#9251)

* [xharness] Mark the .NET tests project as a .NET project so that we don't try to call nuget restore on it.

* [xharness] Mark the .NET generator project as a .NET project as well.

* [xharness] Resolve relative project references using the referencing project's directory. (#9252)

Otherwise it would end up being resolved from the current directory, which is
not dependable.

* [xharness] Don't try to parse a build log that doesn't exist. (#9253)

* [xharness] Add support for generating/duplicating projects with a Touch.Client reference.

This also means removing support for generating/duplicating MonoTouch.NUnit references,
since we're not using those anymore.

* [tests] Remove dead code related to GuiUnit and the GuiUnit submodule.

* [xharness] Change how we run macOS unit tests to work with Touch.Client.

This is very similar to how we run iOS unit tests.

* [xharness] Add the Touch.Client projects to our solutions instead of MonoTouch.NUnitLite.

* [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.

* [xharness] Add support for finding/setting the main Xamarin import among multiple imports.

This is required for the previous commit, where we added an additional import to
a few project files to pass an xml definition to mtouch/mmp.

* [xharness] Use LogFile instead of ResultFile in macOS BCL tests to match the Touch.Client usage.

* [tests] Restore projects before building them from the command line.

* [xharness] Implement Log.GetReader for all loggers. (#9257)

This makes it easier to write code that parses logs, since that code won't
have to worry about if a particular log supports GetReader or not.

* [xharness] Fix main log parsing by not requiring it to come from a file. (#9258)

Not all types of logs have files, but all types of logs have a reader (or will
have soon due to PR #9257).

* [xharness] Improve parsing of NUnitV2 xml reports to fix an issue with failures in parameterized tests. (#9259)

We weren't properly reporting all failures when there were multiple failures
in parameterized tests, because we'd incorrectly skip too many xml nodes when
we were looking for the next test failure.

* Merge remote-tracking branch 'origin/main' into HEAD

* Remove wrongly added dir. (#9301)

Someone (Manuel) uses an IDE that uses .idea to store user settings and
that got added by accident.

* [Harness] Fix some typos. (#9303)

* [xharness] Make it possible to include .NET tests by setting a label. (#9298)

This also means that setting 'run-all-tests' enables the .NET tests, which
means they'll now start running on internal Jenkins (as was the intention from
the beginning).

* [xharness] Look at the exact NUnit version an NUnit project is referencing to figure out how to run it in a makefile. (#9322)

* [xharness] Add support for adding PropertyGroups for unknown platform/configuration values in a csproj. Fixes xamarin/maccore@2277. (#9347)

Fixes https://github.com/xamarin/maccore/issues/2277.

* [xharness] Add support for getting the default AssemblyName for projects. (#9369)

In .NET projects there's a default value for most properties, which means that
there won't necessarily be an AssemblyName property in a csproj. We need to know the
AssemblyName, so calculate it from the csproj filename (which is how .NET does it).

This turned out slighly complicated, because we're pass an XmlDocument around,
and the XmlDocument doesn't know the file from where it was loaded, so we need
to keep that information separately.

* [xharness] Add the .NET version of interdependent-binding-projects to our lineup

* [xharness] Enhance ResolveAllPaths to understand $(RootTestsDirectory).

This requires passing the root directory around in multiple places, since ResolveAllPaths
doesn't have access to the static class where we define the root directory.

Also call ResolveAllPaths in a few more places to ensure paths everywhere are resolved.

* [xharness] Do not mark DeviceLoaders as loaded when loading fails (#9367)

* [xharness] Make sure MSBUILD_EXE_PATH is not set when executing dotnet.

Something ends up confused, and dotnet hangs.

* [xharness] Bump timeout for the .NET tests.

More tests take longer to run!

* [xharness] Don't clone the same project multiple times when reached through different project references.

Problem:

1. interdependent-binding-project references binding-test and bindings-test2.
2. bindings-test2 references bindings-test.

This means bindings-test is reached through 2 projects: both
interdependent-binding-projects and bindings-test2, and previously we'd
process each of these references separately, effectively making two separate
clones of the bindings-test project.

Instead keep track of all referenced projects from the leaf project, and if we
encounter a project we've already cloned, use that directly.

* [dotnet] Add support for consuming binding projects. (#9376)

* Port the interdependent-binding-projects test to .NET (it's the simplest
  test project we have with binding projects).
* Add a lot of the shared source code for mtouch/mmp to dotnet-linker, and
  make it compile. Most issues were fixed by adding a few stubbed out classes,
  since there are large chunks of the mtouch/mmp code we're not using yet, so
  stubbing out while things are being implemented works fine.
* Add a step in dotnet-linker for loading the linker output (the linked
  assemblies) into our bundler code.
* Add another step in dotnet-linker to extract native resources from binding
  libraries.
* Augment the build process to take into account the native resources we found
  in any binding libraries.

* [xharness] Make it possible to make a project ignored by default from its initial definition.

Make it possible to make a project ignored by default from its initial definition,
and which takes precedence over any other selection criteria.

This way it's possible to make the .NET version of monotouch-test show up in the
web view, which makes it runnable locally (for testing), while at the same time it
will never be run on CI.

* [xharness] Add monotouch-test to the .NET lineup.

* [xharness] Improve resolving paths in project files.

* Properties may contain a list of files, separated by semi-colon, so if we find
  any semi-colons, treat each entry as a separate path.

* Treat anything that starts with a variable as a full path, because either the
  variable is a full path, or it will be updated according to the new project location
  and resolve correctly.

* [xharness] Process '$(RootTestsDirectory)' before bailing due to any other variables when resolving paths in project files. (#9467)

While keeping '$(RootTestsDirectory)' as-is works fine when building the
project using MSBuild, xharness itself may end up encountering it (in
particular when listing referenced projects), and at that point will end up
confused. So just always resolve '$(RootTestsDirectory)' to the actual
directory to keep other parts of xharness happy.

Fixes this problem (as seen in PR #9460):

    Harness exception for 'interdependent-binding-projects': System.IO.DirectoryNotFoundException: Could not find a part of the path "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/external/Touch.Unit/Touch.Client/dotnet/iOS/Touch.Client-iOS.dotnet.csproj".
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0015e] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:223
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean isAsync, System.Boolean anonymous) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:149
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:86
        at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess)
        at Microsoft.DotNet.XHarness.iOS.Shared.Utilities.PListExtensions.LoadWithoutNetworkAccess (System.Xml.XmlDocument doc, System.String filename) [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Utilities/PlistExtensions.cs:17
        at Microsoft.DotNet.XHarness.iOS.Shared.TestProject.CreateCopyAsync (Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, Microsoft.DotNet.XHarness.iOS.Shared.Execution.IProcessManager processManager, Microsoft.DotNet.XHarness.iOS.Shared.Tasks.ITestTask test, System.String rootDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] allProjectReferences) [0x0010c] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/TestProject.cs:98
        at Microsoft.DotNet.XHarness.iOS.Shared.TestProject.CreateCopyAsync (Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, Microsoft.DotNet.XHarness.iOS.Shared.Execution.IProcessManager processManager, Microsoft.DotNet.XHarness.iOS.Shared.Tasks.ITestTask test, System.String rootDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] allProjectReferences) [0x00811] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/TestProject.cs:168
        at Microsoft.DotNet.XHarness.iOS.Shared.Tasks.TestTasks.RunInternalAsync () [0x00117] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Tasks/TestTask.cs:274

* [tests] Port dont link to .NET (#9488)

There are a few test failures, so it's ignored by default in xharness for now.

* [xharness] don't link is now green on .NET!

* [tests] Port link sdk to .NET

* [xharness] link sdk is now green on .NET!

At least the Debug configuration is, there's still a test failure in the Release
configuration, so skip that for now.

* [tests] Port link all to .NET (#9515)

* [tests] Port link all to .NET

* [tests] Exclude link all tests in .NET that reference OpenTK-1.0.dll

OpenTK-1.0.dll isn't supported yet.

* [tests] Exclude link all tests using API that isn't available anymore in .NET.

* [xharness] Use the local 'ignore' variable instead of fetching 'test.TestProject.Ignore' for every test when generating test variations. (#9518)

* [xharness] Enable monotouch-test/.NET by default, but ignore all variations. (#9526)

* [xharness] Enable monotouch-test/.NET by default, but ignore all variations.

The default (Debug) configuration is green now, but the rest of the variations aren't yet.

* [tests] Ignore LocaleTest.InitRegionInfo in .NET because it needs globalization data.

Ref: https://github.com/xamarin/xamarin-macios/issues/8906

I can't reproduce locally, because it's ignored for me:

    [INCONCLUSIVE] InitRegionInfo : You can construct locale without countries
        at MonoTouchFixtures.Foundation.LocaleTest.InitRegionInfo() in [...]/xamarin-macios/tests/monotouch-test/Foundation/LocaleTest.cs:line 47

but this should fix this monotouch-test test failure (I'm guessing that 'IV'
stands for 'Invariant', which is all the current .NET version ships with):

    MonoTouchFixtures.Foundation.LocaleTest
        [FAIL] InitRegionInfo :   Name
            String lengths are both 2. Strings differ at index 0.
            Expected: "US"
            But was:  "IV"
            -----------^
                 :    at MonoTouchFixtures.Foundation.LocaleTest.InitRegionInfo() in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/monotouch-test/Foundation/LocaleTest.cs:line 49

* [xharness] Enable the .NET tests when a file containing 'dotnet' is modified. (#9510)

* [xharness] Enable the .NET tests when a file containing 'dotnet' is modified.

This also required adding support for using regex as file names when selecting
which tests to run.

* Remove redundant dotnet prefix.

* [xharness] Rename variables to match usage.

* [dotnet] Use net5.0-[ios|tvos|watchos|macos] TargetFrameworks. (#9532)

* [dotnet] Set TargetPlatformSupported when the right TargetPlatformIdentifier is used.

* [dotnet] Generate a list of valid OS versions for each platform, and add it to the SupportedTargetPlatform item group.

The generated files: https://gist.github.com/rolfbjarne/765c4e4b38b1b017380c9378d9666317

* [dotnet] Define and set the default platform version if it's not set in the TargetFramework variable.

* [dotnet] Switch to using the new-style TargetFramework values.

This includes bumping spouliot/Touch.Unit to get new-style TargetFramework values for Touch.Client.

* spouliot/Touch.Unit@89afaf7 [Touch.Client] Use the right TargetFrameworks for watchOS and macOS as well. (#92)
* spouliot/Touch.Unit@fd0e576 [Touch.Client] Use the right TargetFrameworks. (#91)
* spouliot/Touch.Unit@40f47db [Touch.Client] Add a macOS and watchOS version for .NET. (#90)
* spouliot/Touch.Unit@1d4b8c0 Add .gitignore for NuGet.config and global.json. (#89)
* spouliot/Touch.Unit@49441f3 Call `mlaunch` instead of `mtouch` (#88)
* spouliot/Touch.Unit@b157cf4 Fix a few markdown issues found by markdownlint. (#87)

Diff: d7f55a6167..89afaf7e05

* [dotnet] Document the script that generates the lists of the target platform versions a little bit better.

* [dotnet] Make the [Platform]SupportedTargetPlatform variables public.

This matches how Android and Windows do it:

* https://github.com/xamarin/xamarin-android/pull/5007
* 18ee4eac8b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSupportedTargetPlatforms.props

* [xharness] Update the TargetFramework value when creating project variations.

* [dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration. (#9599)

* [dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration.

Also call Application.InitializeCommon to initialize the application instance. The
important part here is that InitializeCommon calls Optimizations.Initialize to compute
the default optimizations. It also calls Set*ExceptionMode and sets the default EnableCoopGC
value (so we don't need to call/set those anymore), and it does a few other initialization
tasks which we don't need yet, but eventually will.

And finally remember to parse the bundler arguments before using them in the dotnet
build logic. How did this not cause problems before? 🤦

* [tests] Set the verbosity using the additional args instead of an internal variable.

The internal _BundlerVerbosity variable is overwritten now (with the verbosity
value from the additional args).

* [xharness] Disable tvOS generation for the introspection/.NET test, it incorrect and needs fixing.

* [dotnet-linker] Add OptimizeGeneratedCodeSubStep into the pipeline. (#9608)

Fixes these linkall tests:

    Linker.Shared.OptimizeGeneratedCodeTest
        [FAIL] IsARM64CallingConvention :   optimized: no ldsfld instruction
        Expected: 0
        But was:  1
            at Linker.Shared.BaseOptimizeGeneratedCodeTest.IsARM64CallingConvention() in /Users/rolf/work/maccore/main/xamarin-macios/tests/linker/BaseOptimizeGeneratedCodeTest.cs:line 527

    [FAIL] SetupBlockPerfTest :   At least 6x speedup
        Expected: greater than 6
        But was:  1.0876440665344851d
            at Linker.Shared.BaseOptimizeGeneratedCodeTest.SetupBlockPerfTest() in /Users/rolf/work/maccore/main/xamarin-macios/tests/linker/BaseOptimizeGeneratedCodeTest.cs:line 120

And linkall is now green for .NET/Debug.

* [xharness] Add support for adding PropertyGroups if none are applicable when adding a property. (#9616)

Some .NET test projects (monotouch-test) require this to set properties for
some test variations, and .NET projects are quite minimal, making it likely
that they won't have a particular property that needs to be set/modified.

This makes it possible to execute the various monotouch-test variations for
.NET in xharness (some of the variations still fail though, so they're still
ignored by default).

* [tests] Ignore a few link sdk tests in .NET for now. (#9614)

There are easier fish to fry right now, so implementing the linker support for
these tests to pass (metadata reduction and code removal) can wait.

This makes the link sdk/Release variation green for .NET.

Ref: https://github.com/xamarin/xamarin-macios/issues/9612
Ref: https://github.com/xamarin/xamarin-macios/issues/9613

* [xharness] The linkall tests are green for .NET/Release now. (#9629)

* [xharness] Skip the 'dont link / AssemblyBuildTarget: SDK framework (release)' variation by default for tvOS. Fixes #xamarin/maccore@2282. (#9659)

This test variation ends up being too big (1.5 GB), so it doesn't install
properly and the app crashes at startup.

So just skip it.

Fixes https://github.com/xamarin/maccore/issues/2282.

* [src] Build the .NET version of our product assemblies using a .NET 5 BCL. (#9637)

* [src] Build the .NET version of our product assemblies using a .NET 5 BCL.

We're not shipping the .NET product assemblies in any stable release, so we
can use a preview version of the .NET 5 BCL.

Also:

* Add all the nuget feeds we need to the top-level NuGet.config, even for .NET
  5/6, there shouldn't be any conflicts with stable feeds since we use exact
  version numbers.

* Generate a top-level global5.json which is copied to every directory that
  needs a .NET 5 global.json (overriding the .NET 3.1 global.json in the root
  directory).

* Use the expected dotnet binary during our local build.

* [tests] Fix the bgen tests to use .NET 5.

* [xharness] Set the current directory to the project directory when running .NET tests.

This way we end up using the dotnet version that's configured in global.json for the tests.

* [xharness] Fix typo in test case creating two identical test cases. (#9702)

* [xharness] Use XmlReaderSettings to ignore stuff we don't care about when parsing xml. (#9703)

At the very least this makes stepping through code while debugging much
faster, since stepping through whitespace and comments is useless.

* [xharness] Fix rendering human-readable results for parameterized tests. Fixes #9400. (#9704)

We weren't probably parsing nested test-suite elements in the xml, so
implement parsing of test-suite elements using recursion, which is easier and
less error-prone (and turns out to work fine too).

Also use TextReader/Writer instead of StreamReader/Writer in a few places.
This makes it easier to write tests, since TextReader/Writer can use in-memory
streams (no need to mess with temporary files).

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

* [dotnet-linker] Add a CollectUnmarkedMembersStep that will keep linked away types around for the static registrar. (#9722)

The static registrar may need access to types that have been linked away, so
store unmarked types so that the static registrar can access them later.

This also makes all the monotouch-test variations green, so enable them all.

Fixes this monotouch-test when all optimizations are enabled:

    MonoTouchFixtures.ObjCRuntime.RegistrarTest
        [FAIL] TestProtocolRegistration :   UIApplicationDelegate/17669
            Expected: True
            But was:  False
                at MonoTouchFixtures.ObjCRuntime.RegistrarTest.TestProtocolRegistration() in xamarin-macios/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs:line 1350

* [xharness] Only run xammac variations if macOS tests are included. (#9729)

This fixes a build error with a xammac test variation that is executed even if
the macOS build is disabled.

* [xharness] The dotnet version of introspection/iOS 10.3 works fine now. (#9728)

* [xharness] Disable iOS 32-bit simulator tests, they don't work on Xcode 12+. (Re)fixes #xamarin/maccore@2284. (#9732)

Fixes https://github.com/xamarin/maccore/issues/2284.

* Undo does changes that ship and we do not want to bring with us.

* Fix issues that do not allow compilation.

* Fix mtouch tests.

* Ignore generated files.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-10-26 16:05:40 -04:00
Rolf Bjarne Kvinge f22e143f1c
[tests] Make the baseline sample test pass the correct environment variables. (#9952)
This makes it so that we use the configured Xcode, and not the default (/Applications/Xcode.app), which may be a symlink, which doesn't work with Xcode 12:

    Tool /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool execution started with arguments: --errors --warnings --notices --output-format xml1 --minimum-deployment-target 8.0 --target-device iphone --target-device ipad --auto-activate-custom-fonts --sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk --compilation-directory /Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/obj/iPhone/Debug/ibtool /Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/LaunchScreen.storyboard
             (TaskId:13)
    Tool /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool execution finished (exit code = 134).
             (TaskId:13)
    LaunchScreen.storyboard : error : 2020-10-22 17:47:39.854 ibtoold[5120:92020] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-17515.1/DVTFoundation/PlugInArchitecture/DataModel/DVTPlugIn.m:232 [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
    LaunchScreen.storyboard : error : Details:  Requested but did not find required plug-in with identifier com.apple.rc.RCIDESupportCore [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
    LaunchScreen.storyboard : error : Object:   <DVTPlugIn: 0x7fe30d129560> [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
    LaunchScreen.storyboard : error : Method:   -awakeWithPropertyList: [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
    LaunchScreen.storyboard : error : Thread:   <NSThread: 0x7fe30780acc0>{number = 1, name = main} [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
    LaunchScreen.storyboard : error : Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide. [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
    LaunchScreen.storyboard : error : 2020-10-22 17:47:39.863 ibtoold[5120:92020] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition for extension Xcode.IBCocoaTouchBuildSupport.PlatformDefinition.MacCatalyst of plug-in com.apple.dt.IDE.IBCocoaBuildSupport [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
    LaunchScreen.storyboard : error : 2020-10-22 17:47:39.863 ibtoold[5120:92020] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition for extension Xcode.IBCocoaBuildSupport.PlatformDefinition.Cocoa of plug-in com.apple.dt.IDE.IBCocoaBuildSupport [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
    LaunchScreen.storyboard : error : 2020-10-22 17:47:39.880 ibtoold[5120:92020] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition for extension Xcode.IBCocoaTouchBuildSupport.PlatformDefinition.CocoaTouch of plug-in com.apple.dt.IDE.IBCocoaTouchBuildSupport [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
    LaunchScreen.storyboard : error : 2020-10-22 17:47:39.880 ibtoold[5120:92020] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition for extension Xcode.IBAppleTVBuildSupport.PlatformDefinition.AppleTV of plug-in com.apple.dt.IDE.IBAppleTVBuildSupport [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
    LaunchScreen.storyboard : error : 2020-10-22 17:47:39.883 ibtoold[5120:92020] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition for extension Xcode.IDEInterfaceBuilder.PlatformDefinition.WatchOS of plug-in com.apple.dt.IDE.IDEInterfaceBuilderWatchKitBuildSupport [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
    LaunchScreen.storyboard : error : 2020-10-22 17:47:39.979 ibtoold[5120:92020] [MT] DVTAssertions: ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-17506/InterfaceBuilderKit/Utilities/IBScopedSingletonRegistry.m:45 [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
2020-10-23 16:21:01 +02:00
Rolf Bjarne Kvinge 02ce88fa7f
[xharness] Create device variations for the .NET tests. (#9947)
They're all disabled by default for now, since device builds for .NET hasn't
been implemented yet.
2020-10-22 16:32:14 +02:00
Rolf Bjarne Kvinge 673e20e4b4
[xharness] Make the MSBuildTask capable of building .NET projects. (#9941)
Merge DotNetBuildTask into MSBuildTask to simplify creation of build tasks -
these tasks are very similar, and we instantiate MSBuildTasks in over a dozen
places, and this way we don't have to update every instantiation to check if
an MSBuildTask or a DotNetBuildTask should be created.

The end result is that code that does 'new MSBuildTask (...)' will just work
without updates for .NET projects.
2020-10-22 08:45:14 +02:00
Alex Soto 9d1988a3c8
[tests][xcode12.2] Fix xammac tests (#9935)
* [tests][xcode12.2] Fix xammac tests

* Update tests/common/TestRuntime.cs

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

* [xammac] Avoid multiple #if statements

* [xammac] Fix missing cases amd reduce amount of changes

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-10-21 17:12:48 -04:00
Manuel de la Pena 5595ab78e7
Merge pull request #9933 from mandel-macaque/main-xcode12.1
[Main] Bring Xcode12.1 support.
2020-10-21 07:25:47 -04:00
Rolf Bjarne Kvinge 565003d3a3
[xharness] Give the MSBuild tests 30 more minutes to finish. Fixes #xamarin/maccore@2623. (#9927)
Fixes https://github.com/xamarin/maccore/issues/2326.
2020-10-21 08:56:33 +02:00
Manuel de la Pena 00e25199ae [Main] Bring Xcode12.1 support. 2020-10-20 17:55:31 -04:00
Manuel de la Pena 18963f0983 [Xcode12.1] Bring Xcode12.1 support. 2020-10-20 17:27:14 -04:00