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

211 Коммитов

Автор SHA1 Сообщение Дата
Sebastien Pouliot a9251bb9ae
Bump MSBuild.StructuredLogger to 2.1.404 (#11182)
Required to bump dotnet runtime to preview 4 as the binary log format
was updated (and this affects our ability to run some tests)

https://vsdrop.corp.microsoft.com/file/v1/xamarin-macios/device-tests/20210407.33/4632319/sim/;/tests/vsdrops_index.html
2021-04-09 19:58:28 -04:00
Sebastien Pouliot 4e5f5fe030
[tests[ Add app bundle size comparison between legacy and dotnet (#11149)
Based on Rolf's earlier work [1] and a copy of my `app-compare` code [2]

[1] https://github.com/rolfbjarne/xamarin-macios/tree/dotnet-size-comparison-helloworld
[2] https://github.com/spouliot/dotnet-tools/tree/master/app-compare
2021-04-07 16:10:40 -04:00
Peter Collins 5c12fdfac9
[build] Use arcade dependency management tooling (#10890)
* [build] Use arcade dependency management tooling

* Apply feedback

* Apply second round of feedback

* Always make dotnet.config before trying to read it

* Debugging

* Update dependencies, trim tabs and spaces

* [dotnet] Remove the existing workload shipped with .NET and install our locally built ones.

The new version of .NET ships with our workloads, but those aren't
the workloads we want to use, so replace them with our own.

* Update .gitignores.

* Bump to 6.0.100-preview.3.21181.5

That required renaming simulator runtime packs...

* More rename for simulator packages

* moar (hopefully all)

* Bump to 6.0.100-preview.3.21201.11

This fix the issue with `Wait` that failed several tests in monotouch-tests

However it does not include the fix for AppConext.GetData on device (AOT)

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Sebastien Pouliot <sebastien@xamarin.com>
2021-04-02 00:02:27 -04:00
Sebastien Pouliot 747cc9a2b8
[dotnet] Fix device builds (#11036)
With P3 addition on ICU we must now link the native executable as C++.

Remove an old workaround, in many tests, referencing old (5.0/previews)
packages that caused native link time failures.

ref: https://github.com/mono/linker/issues/1139
2021-03-31 12:59:07 -04:00
Rolf Bjarne Kvinge b30777f420
Bump to .NET 6.0.100-preview.3.21161.23 (#10772)
* Bump to .NET 6.0.100-preview.3.21152.10

* Bump to 6.0.100-preview.3.21152.10.

* Bump to 6.0.100-preview.3.21161.7.

* Bump to .NET 6.0.100-preview.3.21161.23.

* [dotnet-linker] Bump ILink and use the supported method of getting an assembly's location.

* Bump to MSBuild.StructuredLogger 2.1.364 to get support for newer binlog versions.

* Fix build failure

Fixes:

    TestHelpers/BuildEngine.cs(161,24): error CS0433: The type 'ProjectEvaluationFinishedEventArgs' exists in both 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'StructuredLogger, Version=2.1.0.0, Culture=neutral, PublicKeyToken=d4c7181801cb6448' [/Users/builder/azdo/_work/1/s/xamarin-macios/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj]

* Update parsing binlog properties.

* Be more defensive.

* [tests] Make sure the InternalsVisibleToAttribute constructor isn't linked away.

* [tests] Implement better printing of binlogs.

The latest MSBuild.StructuredLogger made some internal changes to the Message
property which confuses some of our test logic. So implement manual printing
of the log entries that we care about to make sure they conform to the
expected format by the tests (the output is mimicing what 'msbuild /v:diag
foo.binlog' would show).
2021-03-24 16:59:33 +01:00
Sebastien Pouliot 00a69e1654
[dotnet] Update `Min*` constants and fix builds for tests (#10835)
We're bumping the minimum OS versions for all supported platforms
https://github.com/dotnet/core/blob/master/release-notes/6.0/6.0-supported-os.md

Intro's `Introduced` test is ignored as it require (a lot of) changes. This
will be fixed in separate PRs and gradually re-enabled.

iOS
```
[FAIL] Introduced : 7573 API with unneeded or incorrect version information
```

tvOS
```
[FAIL] Introduced : 299 API with unneeded or incorrect version information
```

Tracking progress in https://github.com/xamarin/xamarin-macios/issues/10834
2021-03-13 10:38:46 -05:00
Rolf Bjarne Kvinge 61ef956d2b
[msbuild] Make actool work correctly for Mac Catalyst apps by passing '--ui-framework-family uikit'. Fixes #10804. (#10815)
Also

* Fix the Mac Catalyst sample to use the correct contents.json and images sizes
  for Mac Catalyst app icons.
* Fix the contents.json and image sizes for the Mac Catalyst test project as well.
* Add unit test for Mac Catalyst that ensures that Assets.car is in the final app.

Fixes https://github.com/xamarin/xamarin-macios/issues/10804.
2021-03-10 15:47:16 +01:00
Rolf Bjarne Kvinge 23bdf61230
[tests] Add unit tests for building Mac Catalyst for ARM64. (#10768)
* [dotnet] Use the expected case for ARM64.

We use case-sensitive comparisons somewhere else, so make sure to use the same casing
for the architecture as other platforms do.

* [tests] Add tests to verify that Mac Catalyst builds successfully for ARM64.

* [msbuild] Fix platform name in condition.

* [msbuild] Pass -isysroot when building Mac Catalyst apps as well.

Ohterwise clang will use the SDK from the command line tools, which may have
nothing to do with the SDK we want to build with.
2021-03-04 17:44:55 +01:00
Rolf Bjarne Kvinge 54324173d3
Bump the stable .NET to 5.0.200. (#10769)
* Bump the stable .NET to 5.0.200.

* Update global.json
2021-03-04 07:46:38 +01:00
Rolf Bjarne Kvinge 88505f85f1
[tests] Add makefile target to run the .NET unit tests. (#10697) 2021-02-24 11:20:29 +01:00
Rolf Bjarne Kvinge a97d95b0f9 [tests] Add test projects for .NET 6/Mac Catalyst. 2021-02-23 07:59:13 +01:00
Rolf Bjarne Kvinge 913b612d6d [tests] Add unit tests for Mac Catalyst on .NET 6. 2021-02-23 07:59:13 +01:00
Rolf Bjarne Kvinge e71be2a09b Add MyCatalystApp test project. 2021-02-23 07:59:13 +01:00
Rolf Bjarne Kvinge 85fe6340f6
Bump .NET to 6.0.100-preview.2.21114.3. (#10666)
* Bump .NET to 6.0.100-preview.2.21114.3.

* [dotnet-linker] Several steps are now gone, so load our custom step before the new first step (MarkStep).

* [dotnet-linker] Dump the current steps if we fail to call InsertBefore/InsertAfter.

* [dotnet-linker] Load the CollectAssembliesStep as the first step, and make it load every assembly.

* [dotnet] Set InvariantGlobalization=true because that's the only thing .NET supports for now.

* [dotnet-linker] Use recommended workaround for linker's inability to do load assemblies in custom step.

* [tests] Bump version of MSBuild.StructuredLogger to get support for new log version.

Otherwise this happens in tests that read binary logs:

    System.NotSupportedException : Unsupported log file format. Latest supported version is 9, the log file has version 10.

* [introspection] Ignore P/Invokes to QCall for LogThreadPool* P/Invokes.

* [dotnet-linker] Inject a dummy implementation of mono_config_parse_memory as a temporary solution for mono's removal of the same method.
2021-02-23 07:49:09 +01:00
Rolf Bjarne Kvinge b8d98a499c
[dotnet] Disable watchOS. (#10625)
* [dotnet] Disable watchOS.

* [tests] Ignore watchOS tests when the watchOS build is disabled.
2021-02-12 21:52:27 +01:00
Rolf Bjarne Kvinge 9d4e1ae32a Merge remote-tracking branch 'origin/main' into dotnet-interpreter 2021-02-03 12:52:24 +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 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 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 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
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