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

8550 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 026a58b6c4
[monotouch-test] Second attempt at fixing the broken UrlRequestTest.Mutability_30744 test. (#9116)
This has been tested on:

* macOS 10.9, 10.10, 10.11, 10.12, 10.13, 10.14 and 10.15.
* iOS device:
	* iOS 8.2
	* iOS 9.3.5
	* iOS 11.4.1
	* iOS 13.6
2020-07-17 15:26:38 +02:00
Rolf Bjarne Kvinge c394c12c54
[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).
2020-07-17 11:09:09 +02:00
Rolf Bjarne Kvinge 965245086d
[apitest] Sleep for 0.05s instead of 0.5s. (#9108)
This makes these tests exactly 3.6s faster.
2020-07-17 11:00:51 +02:00
Rolf Bjarne Kvinge d0241e1707
[apitest] Refactor tests to not be async. (#9109)
* [apitest] Refactor tests to not be async.

The macOS tests will soon be upgraded to use the official NUnit[Lite], and in
that case we can't use async tests, because they end up deadlocking the
processes.

So refactor the two tests this affect to not be async, but instead use other
methods of accomplishing the same thing.

* Fix grammar

Co-authored-by: Whitney Schmidt <whschm@microsoft.com>
2020-07-17 08:51:53 +02:00
Rolf Bjarne Kvinge 92821b5dec
[xharness] Parse NUnit v2 xml reports correctly. (#9110) 2020-07-17 08:50:00 +02:00
Rolf Bjarne Kvinge 2995cd086a
[tests] Update tests to make native type vs normal type comparison explicit (#9097)
We've modified our NUnitLite to special-case the native types, so that they
can easily be compared with the standard types, but that doesn't work anymore
when switching to the official NUnit[Lite], so change all asserts to
explicitly convert whenever needed.
2020-07-17 08:48:09 +02:00
Rolf Bjarne Kvinge 4235dfbff7
[mmp] Use the right pkg-config directory. (#9105) 2020-07-16 17:57:15 +02:00
Rolf Bjarne Kvinge 7509c6bfcd
[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.
2020-07-16 17:16:25 +02:00
Chris Hamons 5657a63539
Add support for arbitrary extensions to be bundled in XI/XM apps (#9048)
- This commit adds a hook, "AdditionalAppExtensions", to the msbuild to allow
extensions written in other languages, such as Swift, to be embedded and signed in an
Xamarin App bundle easily.
- Example:
<AdditionalAppExtensions Include="$(MSBuildProjectDirectory)/../../native">
	<Name>NativeTodayExtension</Name>
	<BuildOutput Condition="'$(Platform)' == 'iPhone'">build/Debug-iphoneos</BuildOutput>
	<BuildOutput Condition="'$(Platform)' == 'iPhoneSimulator'">build/Debug-iphonesimulator</BuildOutput>
</AdditionalAppExtensions>
2020-07-16 10:13:15 -05:00
Rolf Bjarne Kvinge 4b0fd5529c
[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.
2020-07-16 08:20:51 +02:00
Rolf Bjarne Kvinge 839f586344
[monotouch-test] Fix broken UrlRequestTest.Mutability_30744 test. (#9096)
* [monotouch-test] Fix broken UrlRequestTest.Mutability_30744 test.

This test is supposed to assert that setting a header on an immutable
dictionary throws an exception.

The problem is that the tested code always throws an exception: either when
setting the header, or when asserting right after because no exception was
thrown, effectively always passing.

This showed up with current versions of NUnit[Lite], which keeps track of
assertion failures, and fails a test even if those assertion
failures/exceptions are caught in exception handlers.

So remove the whole exception verification logic, and just try to set the
value. We'll see if the test start failing somewhere (I've already tested both
on device and simulator, and no problems found so far).

* Remove a simulator condition.

It works on device for me (iPhone 7 with iOS 11.4.1)... maybe Apple changed
something?
2020-07-16 08:20:09 +02:00
Rolf Bjarne Kvinge e344698612
[tests] Use Assert.Throws instead of the ExpectedException attribute. (#9092)
* [tests] Use Assert.Throws instead of the ExpectedException attribute.

The ExpectedExceptionAttribute doesn't exist in newer versions of NUnit[Lite] anymore.

* [monotouch-test] Rework some CaptiveNetwork tests.

They need permissions, and entitlements, and something else I couldn't figure
out, so just assert they're returning null instead.
2020-07-16 08:19:33 +02:00
Rolf Bjarne Kvinge 3ac93d2330
[monotouch-test] Comparing uint to int for inequality doesn't work newer versions of NUnit[Lite]. (#9094)
So make sure we pass two values of the same type to Assert.AreNotEqual.
2020-07-16 08:19:01 +02:00
Manuel de la Pena fcc410f36a
[DevOps] Add debugging messages from when we fail the ./configure (#9102)
Some bots are giving error with this step. Try to add some verbosity and
ensure that $? is 0 when done.
2020-07-15 20:13:57 -04:00
Manuel de la Pena 3fccc1e3e0
[DevOps] If we cannot clear the hd, continue. (#9101)
Few things:

1. Move from Write-Error to Write-Debug so that we do not set the exit
code and an error.
2. Ig we fail in the Clear-HD step, continue, we should be ok or cancel
if not enough space is found.
2020-07-15 20:13:34 -04:00
Manuel de la Pena f13fe4ba30
[DevOps] In a self-hosted pool we need to specify the os. (#9100) 2020-07-15 18:51:37 -04:00
Rolf Bjarne Kvinge a59742a8ec
[monotouch-test] Use Is.EqualTo instead of Is.EquivalentTo for equal arrays. (#9093)
The latter is much, much, *much* slower when using a recent version of NUnit[Lite].

I have no idea exactly how much slower, because it was so slow that I got
tired of waiting, and stopped the tests.

So use EqualTo instead, since the arrays should be equal in the first place.
2020-07-15 18:07:57 +02:00
monojenkins 22ff73b52c
[msbuild] Allow overriding CompileAppManifestTaskBase Execute method (#9090)
If the Execute method of a task is sealed the Windows side tasks won't be able to "inject" the code that executes the tasks remotely.

Co-authored-by: emaf <ema@xamarin.com>
2020-07-15 16:50:48 +02:00
Rolf Bjarne Kvinge 93b5c223d6
[tests] Provide an ignore reason for Ignore attributes. (#9091)
Newer versions of NUnit[Lite] require this.
2020-07-15 14:50:54 +02:00
Rolf Bjarne Kvinge 6c4e357d3b
[monotouch-test] Fix debug naming. (#9084) 2020-07-15 09:05:34 +02:00
Rolf Bjarne Kvinge 7beb88089a
[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.
2020-07-15 09:01:31 +02:00
Matthew Leibowitz b70d25d011
Include assembly refs in _CompileToNative Inputs (#9071)
* Include assembly refs in _CompileToNative Inputs

Fixes #9014

* Unify with iOS

Sort of match this: 64c63279b3/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets (L573-L595)

* Update Xamarin.Mac.Common.targets
2020-07-14 14:54:26 +02:00
Rolf Bjarne Kvinge 64c63279b3
[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.
2020-07-13 17:12:11 +02:00
Rolf Bjarne Kvinge 96327dee88
[monotouch-test] Use a normal thread instead of MulticastDelegate.BeginInvoke in AVAssetImageGeneratorTest. (#9067)
MulticastDelegate.BeginInvoke isn't supported in .NET.

Ref: https://github.com/dotnet/runtime/issues/16312
2020-07-13 15:07:05 +02:00
Rolf Bjarne Kvinge b46aae7fd6
[msbuild] Make the ParseExtraMtouchArgs task platform-agnostic, and share it between Xamarin.iOS and Xamarin.Mac. (#9061)
* Change the parsing code slightly, to make it easier to parse other arguments
  (coming soon).
* Add the parsing task to Xamarin.Mac projects, and use it there as well. The
  parsed result isn't used yet, but it will be soon.
* Unify a few related MSBuild properties (MtouchNoSymbolStrip and
  MtouchNoDSymUtil).
2020-07-13 14:56:34 +02:00
kiddailey 97d09a7b24
Add AutoFill CredentialProvider NSExtensionPoint support (#9030)
* Fix unrecognized extension build warning for credential providers

* Bump Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@5e08f5f Add AutoFill CredentialProvider NSExtensionPoint support (#75)

Diff: a1bc6f39b3..5e08f5f2fd

* Add IDE deployment target for credential provider

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-07-13 14:50:23 +02:00
Manuel de la Pena 773df34fde
[DevOps] Fix issues with the xm storage path. (#9043)
* [DevOps] Fix issues with the xm stroage path.

For some reason, and it is very probably a bug in the azurepipelines,
the following bash code creates a path with an extra single quote at the
end:

```bash
 P=jenkins/xamarin-macios/$BUILD_LANE/$BUILD_REVISION/$ID/device-tests

echo "##vso[task.setvariable variable=XM_STORAGE_PATH]$P"
```

* Should it do it? Not, it should not.
* Does it do it? Yes, it does.

We work around it via td -d \'\" and remove all single and double quotes
in the string. How long did it take to discover this? More than it
should have.

There is another interesting bug with the variable expansion, the
following
```bash
echo '##vso[task.setvariable variable=XAMARIN_STORAGE_PATH;isOutput=true]$P'
```
Does not equal
```bash
echo '##vso[task.setvariable variable=XAMARIN_STORAGE_PATH;isOutput=true]'$P
```

The first will not expand the variable, the second one will. We do need
the value of $P not '$P'.


Co-authored-by: Whitney Schmidt <51677938+whitneyschmidt@users.noreply.github.com>
2020-07-10 17:19:59 -04:00
Manuel de la Pena 9eff2f2964
[DevOps] Move back to self hosted windows pools. (#9040)
The microsoft hosted images have a limit of 10gb, or logs are getting
close to that size when expanded, therefore we will get into issues.
Move back to the self-hosted pool before we have problems.
2020-07-08 18:57:56 -04:00
Rolf Bjarne Kvinge 80c3cc0028
[src] Create a Constants.cs file for Constants that are in all platforms. (#9031) 2020-07-08 18:04:38 +02:00
Rolf Bjarne Kvinge 400d0f65fa
[AVFoundation] Ignore a few compiler warnings about missing overrides for comparison support. (#9033) 2020-07-08 18:04:28 +02:00
Sebastien Pouliot 1b09465acf
[tests][xtro] Fix NSUrl-based categories (#9029)
We were using the managed name, e.g. `NSUrl`, instead of the native name,
e.g. `NSURL`, when dealing with categories.

To fix this we must resolve the type and this caused issues as other
assemblies (e.g. OpenTK) were not already loaded/cached and some type
could not be resolved (and this throw exceptions)

The runner now loads all assemblies before starting to visit them.

The fix solved a known issue (iOS-NetworkExtension.ignore), some API
that were already bound (common-Foundation.ignore) and also caught an
additional API where we missed a `[NullAllowed]` on a return value
2020-07-08 09:26:54 -04:00
Manuel de la Pena f4d165863a
[DevOps] Clean all workspaces and try to fix our space problems. (#9028) 2020-07-07 18:45:50 -04:00
Rolf Bjarne Kvinge e193ed7316
[msbuild] Unify all the UsingTask statements. (#8998)
Some of these have been duplicated across various targets files, and when
adding a new task it's annoying to forget to add it somewhere.

So just have them all in the same place, so that they're loaded in every file.

There are still duplicates between the iOS and Mac tasks, but those will be
unified in a later PR.
2020-07-07 15:52:06 +02:00
Rolf Bjarne Kvinge ac36305a2d
[msbuild] Unify the _GenerateBindings target and a few properties related to binding projects. (#8997) 2020-07-07 15:46:23 +02:00
Rolf Bjarne Kvinge 4e2d612dae
[msbuild] Unify XamarinMacFrameworkRoot and MonoTouchSdkRoot into _XamarinSdkRoot. (#8995) 2020-07-07 15:45:42 +02:00
Manuel de la Pena edd8a2c896
[Foundation] Avoid LINQ in bindings. Fixes #8773 (#8991)
LINQ was giving issues in a client application with the Link SDK
enabled. The root cause is that we had issues in the LINQ operations
that are used to create the headers for the native request.

We fix this by:

1. Do not modify the managed request headers. Do not modify an object we
   do not own.
2. Remove the use of LINQ

This issue was probelmatic when the client application was setting the
headers that are used by the HttpContent. If headers were not added in
the content, the issues did not happen.

Co-authored-by: Alex Soto <alex@alexsoto.me>
2020-07-06 10:51:50 -04:00
Manuel de la Pena e1d537107f
[Foundation] Do expose server errors. (#8990)
Creating a good API is hard. The delegate DOES return two different
errors.

1. Client errors in the error variable in the delegate method.
2. Server errros in the error in the task in the delegate method.

We need to expose both of them to the user in case there is an issue in
any of them. An exception should be thrown ig any is not null.

PD: As per apple docs:

> The only errors your delegate receives through the error parameter are
> client-side errors, such as being unable to resolve the hostname or
> connect to the host. To check for server-side errors, inspect the
> response property of the task parameter received by this callback.
2020-07-06 10:51:06 -04:00
Rolf Bjarne Kvinge 9a17e053b7
[dotnet] Add some project capabilities. (#9013)
* [.NET 5] Start adding some project capabilities (#3)

Aligned with XA too, see https://github.com/xamarin/xamarin-android/pull/4383.

We'll start using Apple instead of iOS for these things at the IDE level since many
behaviors don't actually depend on iOS but also apply to tvOS, watchOS, and so on.

These capabilities go before other imports just in case additional packages/targets
from the SDK need to access them too.

* Remove the LaunchProfiles capability for the CPS integration (#8472)

Implements https://work.azdo.io/1112733 as a workaround for the conflicts between
the built-in launchsettings.json-based .NET Core debugger and our Mono debugger.

Co-authored-by: Daniel Cazzulino <daniel@cazzulino.com>
2020-07-06 14:31:27 +02:00
Rolf Bjarne Kvinge 31f4a2e22a
[tests] Skip a few networking tests on macOS 10.9. Fixes #xamarin/maccore@2221. (#9012)
Fixes https://github.com/xamarin/maccore/issues/2221.
2020-07-06 13:26:09 +02:00
Rolf Bjarne Kvinge 739ab8dfd4
Merge pull request #8980 from rolfbjarne/dotnet-xharness-introspection
[dotnet] Make the introspection tests pass in the 64-bit iOS simulator.
2020-07-06 11:14:40 +02:00
Rolf Bjarne Kvinge 46b6d3787d
[mtouch] Regenerate Errors.designer.cs after some entries were removed from Errors.resx. (#8994) 2020-07-03 17:40:25 +02:00
Rolf Bjarne Kvinge 4dabb46d92 Bump Touch.Unit.
New commits in spouliot/Touch.Unit:

* spouliot/Touch.Unit@b4e8606 [TouchRunner] Turns out NUnitLite.OutputWriter.WriteResultFile needs an actual test filter, so provide one.
* spouliot/Touch.Unit@5dc251a [TouchRunner] Turns out NUnitLite.OutputWriter.WriteResultFile needs an actual test filter, so provide one.

Diff: 6c5bb930b3..b4e8606a85
2020-07-03 16:25:08 +02:00
Rolf Bjarne Kvinge 2e11f0bf4e [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.
2020-07-03 11:31:45 +02:00
Rolf Bjarne Kvinge 5d5a47b990 [tools] Don't link with a framework that isn't available in the simulator. 2020-07-03 11:14:03 +02:00
Rolf Bjarne Kvinge 6f6b8e281b Merge remote-tracking branch 'origin/main' into dotnet-xharness-introspection 2020-07-03 11:12:50 +02:00
Rolf Bjarne Kvinge 8d7cd46652
[msbuild] Share a few binding variables: BaseLibDllPath, BTouchToolPath and BTouchToolExe. (#8988)
Also switch to invoking bgen instead of the btouch-native/btv/bwatch wrapper
scripts, since the wrapper scripts just call bgen with an additional
--target-framework argument, which our BTouch task already does anyway, which
means it's not necessary to call the wrapper scripts anymore.

This also required:

* Moving the code to detect which Xamarin.Mac profile we're building for into
  Xamarin.Shared.props, since the binding variable logic need to know which
  Xamarin.Mac profile we're building for.

* Setting IsBindingProject property earlier in the build process, to make sure
  it's set before importing Xamarin.Shared.props.
2020-07-03 11:01:01 +02:00
Rolf Bjarne Kvinge 4eff2c3700
[msbuild] Unify the logic to copy bundle resources to the app. (#8987)
* For Xamarin.Mac, this means using the _ComputeBundleResourceOutputPaths and
  _CopyResourcesToBundle targets from Xamarin.iOS instead of the
  _CopyContentToBundle target (which is now unused and thus removed).

* Adapt the Xamarin.iOS logic (now shared) to handle the fact that the
  resources shouldn't always go into the root appbundle directory (since they
  go into Contents/Resources/ for macOS apps), by using the
  '_AppResourcesPath' variable to specify just this.

Once upon a time the Xamarin.iOS logic was identical to the Xamarin.Mac logic,
but then we implemented support for asset packs
(a98693f07e)
and the code diverged. This means that unifying the logic again is a step
towards making asset packs work for Xamarin.Mac apps.
2020-07-03 11:00:36 +02:00
Rolf Bjarne Kvinge 4ed68336d7
[msbuild] Share the MSBuild logic for CollectBundleResources and a few related properties. (#8983)
* [msbuild] Share the MSBuild logic for CollectBundleResources and a few related properties.

* [msbuild] Fix/unify more resource collection code.

* Remove the _CollectBundleResources target for Xamarin.iOS binding projects,
  we now have a single one for all project types.
* Add an IsBindingProject property to distinguish binding projects from other
  projects.
* Use the IsBindingProject to only depend on the other _Compile<ResourceType>
  targets when we're not building a binding project (which seems to be the
  reason why the _CollectBundleResources target was duplicated between normal
  projects and binding projects for both Xamarin.iOS and Xamarin.Mac: the
  binding project version didn't have any dependencies).
2020-07-01 20:13:05 +02:00
Rolf Bjarne Kvinge d621e3a854
[dotnet] Use the exact same dotnet version in our global.jsons as in Make.config. (#8984)
This avoids a possible difference in behavior, because in our system
dependency check we verify that the system has a specific version (which might
succeed), but if we don't pick a specific dotnet version in global.json,
dotnet will pick the latest version, which may behave differently than the one
we have in Make.config.

Thus always use the exact same version, so that we don't run into a difference
in behavior between developers and/or bots.
2020-07-01 17:08:46 +02:00
Rolf Bjarne Kvinge 551ae06f4a
Bump .NET 5 version to preview 7.20317.11. (#8985)
This gets a version with the old library names for mono
(libmonosgen-2.0.dylib) instead of libmono.dylib, which makes it easier to
re-use the existing libxamarin.dylib (since libxamarin.dylib tries to load
libmonosgen-2.0.dylib).
2020-07-01 14:20:36 +02:00