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

40 Коммитов

Автор SHA1 Сообщение Дата
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
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 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 8f2913b518
[dotnet] Add asset catalogs to the our items included by default. (#9841) 2020-10-29 09:18:20 +01:00
Rolf Bjarne Kvinge 062352ccae [tests] Use 'Microsoft.NET.Sdk' instead of 'Microsoft.<platform>.Sdk'. 2020-10-16 14:27:57 +02:00
Rolf Bjarne Kvinge 9da5db37b5 [tests] We don't need to point to our custom packages in global.json anymore, since we'll be using the installed workload. 2020-10-16 14:27:42 +02:00
Rolf Bjarne Kvinge 86cb7468b9
[tests] Fix ignoring dotnet tests when certain platforms have been disabled. (#9851)
Fixes an issue where some of the non-macOS dotnet tests where ignored because
the logic to disable the macOS ones were incorrect.
2020-10-13 17:55:20 +02:00
Rolf Bjarne Kvinge fa58a24161
[msbuild] Port the test projects to .NET, and add a test case that compares the built .app (#9706)
Port the iOS/tvOS/watchOS msbuild test projects to .NET, and add a unit test
that builds both the old-style and new-style test projects and compares the
output in the resulting .app directories.

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

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

There are a couple of test projects that can't be compared yet, because they
just don't build yet. Those are also TODOs.
2020-09-29 08:44:08 +02:00
Manuel de la Pena 764734d20a
[Main][Xcode12] Add support for Xcode 12 2020-09-25 12:58:29 -04:00
Manuel de la Pena 022f5d331c [DotNet] Ignore those tests that require Mac OS X if not enabled. 2020-09-24 17:46:22 -04:00
Rolf Bjarne Kvinge 22fe547944
[tests] Make the .NET bgen tests actually reference the .NET BCL. (#9693)
Make the bgen tests pass in the path to the attribute library, platform
assembly and all the .NET reference assemblies to bgen. This way we execute
these tests using the .NET version of everything.
2020-09-24 14:57:05 +02:00
Manuel de la Pena dcb0c93ab0 [Xcode12] Bring xcode 12 changes into main. 2020-09-23 16:05:22 -04:00
Manuel de la Pena d2677b36fb [Tests] Add better ignore using the configuration class. 2020-09-22 11:59:09 -04:00
Manuel de la Pena e7d2b3c041 [Tests] Ignore those test that expect Xamarin.Mac to be present.
Ignore all the tests until
https://github.com/xamarin/xamarin-macios/issues/9680 is fixed.
2020-09-21 18:09:20 -04:00
Rolf Bjarne Kvinge 39e3184f02
[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.
2020-09-21 13:22:44 +02:00
Rolf Bjarne Kvinge 941d65f016
[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.
2020-09-09 14:52:46 +02:00
Rolf Bjarne Kvinge d2788511b6
[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.
2020-08-31 09:27:19 +02:00
Rolf Bjarne Kvinge ab47edcb27
[dotnet] Implement resource bundling. (#9472)
* Port the BundledResources test to .NET.
* Fix a minor issue in the BundledResources test to make sure it works on macOS.
* Add a unit test to make sure resources are bundled as expected.
* Modify the .NET build logic to bundle/unbundle resources.
2020-08-25 13:14:01 +02:00
Rolf Bjarne Kvinge 92a3cd9a30
[dotnet] Bump .NET and the linker. (#9451)
* Bump .NET 5 and the linker.

The old linker run into a problem that seems fixed in the new linker, so bump.

* [tests] Add a workaround for a .NET bug in the fsharplibrary tests.

It's now the default to produce reference assemblies, but the F# compiler
doesn't support producing reference assemblies, so when there's no reference
assembly afterwards the MSBuild tasks complain. So explicitly disable
reference assemblies for our F# library.

* [tests] Skip reference assemblies when iterating over produced assemblies in the .NET unit tests.

Also simplify the code a little bit.

This happens because producing reference assemblies is now the default.
2020-08-24 08:20:46 +02:00
Rolf Bjarne Kvinge 6f911a2259
[dotnet] Put NuGet packages in a directory which will not be picked up by default item inclusions / globs. (#9440)
Put NuGet packages in tests/dotnet, instead of a directory next to the project
file, so that default item inclusions / globs don't pick up anything from
them.

This fixes an issue where the build would pick up a Program.cs that ships with NUnitLite,
and include it in the build, which would then cause build failures because that Program.cs
has a Main method, which would conflict with our Main method.
2020-08-21 14:55:24 +02:00
Rolf Bjarne Kvinge 98b52c7c3a [tests] Port interdependent-binding-projects to .NET. 2020-08-14 18:33:28 +02:00
Rolf Bjarne Kvinge 8814e8ca24 [tests] Port bindings-test2 to .NET. 2020-08-10 16:14:52 +02:00
Rolf Bjarne Kvinge d883eb4725 [tests] Add a tvOS and watchOS version of the bindings-test project for .NET 2020-08-10 16:12:42 +02:00
Rolf Bjarne Kvinge 43d234de52 [tests] Add a macOS version of the bindings-test project for .NET
This required disabling some Xamarin.Mac-specific binding code in .NET mode.
2020-08-10 16:12:42 +02:00
Rolf Bjarne Kvinge c583cfd01e [dotnet] Add bindings-test to our unit tests. 2020-08-10 16:12:42 +02:00
Rolf Bjarne Kvinge 19e53376dd
[dotnet] Port the fsharplibrary project to .NET (#9339) 2020-08-10 16:12:19 +02:00
Rolf Bjarne Kvinge d0f426b731
[tests] Port the EmbeddedResources test project to .NET and add a test to build it. (#9324) 2020-08-10 10:48:29 +02:00
Rolf Bjarne Kvinge 4a5dc20338
[dotnet] Only pass a single custom step to the linker. (#9173)
* [dotnet] Only pass a single custom step to the linker.

The linker will load the assemblies with the custom steps once per custom step
argument, which means that each step is effectively in a different assembly,
making it impossible to share state between steps.

This behavior is filed as a linker bug: https://github.com/mono/linker/issues/1314

Until this is fixed, we can just have a single step that injects all the other
steps programmatically.

* [tests] Adjust .NET tests according to new behavior.
2020-07-24 09:20:52 +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 ce94d5545d [tests] Simplify MySingleView test to work without a storyboard. 2020-06-19 17:47:49 +02:00
Rolf Bjarne Kvinge c3bcfac582
Unify code for executing processes. (#8848)
* Create a simple Xamarin.Utils.Execution class that can handle all our
  process execution needs:
    * Captures or streams stdout/stderr (in UTF8).
    * Supports async
    * Supports a timeout
    * Does not depend on any other source file we have, only uses BCL API.
* Have the execution helper classes from mtouch/mmp
  (Xamarin.BundlerDriver.RunCommand) and the tests
  (Xamarin.Tests.ExecutionHelper) use this new class.
* Some simplifications were made:
    * All API that took a string array for the environment now takes a
      Dictionary<string, string>.
    * The Driver.RunCommand methods were split out to a separate file. This
      file also contains a Verbosity field, which is conditioned on not being
      in mtouch nor mmp, which makes including this file from other projects
      simpler (such as bgen - in particular bgen was modified to use this
      Verbosity field instead of its own).
2020-06-18 12:34:07 +02:00
Rolf Bjarne Kvinge 24117c5180
[dotnet] Rebuild nugets and global.json when we switch branches or commit something, or change any of the project files involved in package creation. (#8834) 2020-06-11 11:57:28 +02:00
Rolf Bjarne Kvinge ab6b418483
[dotnet] Detect, compile and publish Info.plist into the app. (#8752)
* [dotnet] Detect, compile and publish Info.plist into the app.

* Automatically detect any property lists in the root project directory, and
  include them into the build.
* Introduce the existing build targets to detect and compile Info.plist into
  the .NET build.
* Add documentation for default inclusion. This document will grow over time
  as more file types are automatically included.
* Add some tests.

* [dotnet] Adjust default inclusion behavior.

* Use a single platform-specific variable to control all types of
  platform-specific inclusions.

* [dotnet] Move the default inclusion to .targets instead of .props, so that .NET's default inclusion logic is already imported.

.NET sets EnableDefaultItems in their .targets: https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets#L16
2020-06-05 14:47:54 +02:00
Rolf Bjarne Kvinge cb637a08a0
Merge pull request #8733 from rolfbjarne/dotnet-linker
[dotnet] Add dotnet-linker, a project to contain custom linker steps for our net5.0 build.
2020-06-03 09:11:15 +02:00
Rolf Bjarne Kvinge 246b65fa6d
[tests] Add a global.json targeting dotnet 3.1.100 to the dotnet unit tests. (#8728)
Because VSfM isn't able to build this project otherwise:
https://developercommunity.visualstudio.com/content/problem/1056720/cant-build-net-5-project-error-net-core-31-sdk-is.html
2020-06-03 09:00:33 +02:00
Rolf Bjarne Kvinge 3589a3b99d [dotnet] Improve tests to verify that the linker has (or hasn't) run. 2020-06-02 16:00:04 +02:00
Rolf Bjarne Kvinge 7751708022
[dotnet] Add class library test project for every platform. (#8714)
And tests to make sure it builds successfully as well.
2020-06-01 11:28:23 +02:00
Rolf Bjarne Kvinge aec9c93bee
[dotnet] Add tests for our various platforms. (#8708)
* [tests] Add a unit test project to test our net5 support.

* [tests] Fix clearing environment variables when launching processes.

* [tests] Add net5 macOS test app.

* [tests] Add net5 tvOS test app.

* [tests] Add net5 watchOS test app.

* [msbuild] Exclude CreateAppBundleDependsOn from net5 builds as well.

* [msbuild] We're not required to know the signing identity to figure out the app extension bundle name.
2020-05-29 17:58:34 +02:00
Rolf Bjarne Kvinge f0aa8ea4ec
[dotnet] Add a KnownFrameworkReference node to the targets to tell the .NETCore build system about us. (#8665)
Also add another nuget source to get Mono's net5 runtime packs.

This makes the tests/dotnet/MySingleView test app:

* Compile managed code successfully, referencing Xamarin.iOS.dll.
* Resolve the correct targeting and runtime packs (aka Mono).

The compiled result is not put into an .app bundle as iOS expects, so the
result isn't actually executable.
2020-05-25 17:38:35 +02:00
Rolf Bjarne Kvinge 98788f8558
[dotnet] Add the Sdk build files to the Sdk NuGet. (#8644)
Also add a very simple net5 test app (which doesn't build yet).

Current (expected) build result:

    > xamarin-macios/tests/dotnet/MySingleView $ dotnet build
    Microsoft (R) Build Engine version 16.7.0-preview-20258-02+26f6d1d87 for .NET
    Copyright (C) Microsoft Corporation. All rights reserved.

      Determining projects to restore...
    xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj : error NU1102: Unable to find package Microsoft.NETCore.App.Runtime.ios-x64 with version (= 5.0.0-preview.6.20264.1)
    xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj : error NU1102:   - Found 1 version(s) in nuget.org [ Nearest version: 5.0.0-preview.4.20251.6 ]
    xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj : error NU1102:   - Found 1 version(s) in Nuget Official [ Nearest version: 5.0.0-preview.4.20251.6 ]
    xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj : error NU1102:   - Found 0 version(s) in local-dotnet-feed
    xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj : error NU1102:   - Found 0 version(s) in Dotnet arcade
      Failed to restore xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj (in 951 ms).

This fails because the .NET build logic isn't being told that it should look
for the mono runtime packs instead of the .NET Core runtime packs.
2020-05-25 15:22:29 +02:00