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

181 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 42d561c623
[tests] Execute tests on older macOS bots with a timeout. (#14593)
This prevents a single test hang from breaking the entire test run.

Also bump timeout to 45 minutes.
2022-04-04 19:16:48 +02:00
Rolf Bjarne Kvinge 6e348f0e65
[dotnet] Port the iOS tabbed app template to .NET. (#14592)
Ref: https://github.com/xamarin/xamarin-macios/issues/10747
2022-04-04 10:05:08 +02:00
Rolf Bjarne Kvinge 08978fa4b1
[dotnet] Rename hardcoded 'net6.0' to use a 'DOTNET_TFM' variable instead. (#14524)
This makes things easier for .NET 7.
2022-04-01 13:48:09 +02:00
Rolf Bjarne Kvinge 6fa6b75f19
[dotnet] Don't include @(Compile) and @(EmbeddedResource) items in @(BundleResource) items by default. Fixes #14442. (#14571)
Fixes https://github.com/xamarin/xamarin-macios/issues/14442.
2022-03-31 08:17:53 +02:00
Alexander Köplinger b8c493c3e1
Set IsImplicitlyDefined="true" on the System.Runtime.InteropServices.NFloat.Internal PackageReference (#14532)
* Set IsImplicitlyDefined="true" on the System.Runtime.InteropServices.NFloat.Internal

This unbreaks Central Package Management via https://github.com/microsoft/MSBuildSdks/tree/main/src/CentralPackageVersions which is being worked on for NuGet, see https://github.com/NuGet/Home/issues/6764

* Add test case

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-03-30 10:13:39 +02:00
Rolf Bjarne Kvinge 0802e2c359
[tests] Store symlinks in zips. Fixes #xamarin/maccore@2548. (#14459)
Fixes https://github.com/xamarin/maccore/issues/2548.
2022-03-28 08:59:29 +02:00
Rolf Bjarne Kvinge 321f171744
[tests] Don't try to parse stderr from assetutil. Fixes #xamarin/maccore@2559. (#14478)
Hopefully fixes https://github.com/xamarin/maccore/issues/2559.
2022-03-25 09:00:44 +01:00
Rolf Bjarne Kvinge 78963700e7
[dotnet] Only add a global nfloat using if we're compiling for C# 10 or later. Fixes #14434. (#14475)
Fixes https://github.com/xamarin/xamarin-macios/issues/14434.
2022-03-24 10:14:16 +01:00
Rolf Bjarne Kvinge d9e3206125
Merge branch 'main' into dotnet-dsyms 2022-03-23 22:24:51 +01:00
Rolf Bjarne Kvinge 18fa252f1d
[msbuild] Show a better error when a bundle identifier isn't provided. Fixes #14283. (#14402)
Fixes https://github.com/xamarin/xamarin-macios/issues/14283.
2022-03-23 16:49:06 +01:00
Rolf Bjarne Kvinge a04e653d24 [tests] Augment .NET tests to verify .dSYM presence at the end of a build 2022-03-22 16:14:26 +01:00
Rolf Bjarne Kvinge e369f466f7
[dotnet] Rename the DOTNET6 make variable to DOTNET. (#14441)
This is the follow-up to where the DOTNET variable was renamed SYSTEM_DOTNET.
2022-03-21 15:56:57 +01:00
Rolf Bjarne Kvinge 4fadad76af
[tests] Add better diagnostics for failure to parse json document in AssetTest. (#14439)
Ref: https://github.com/xamarin/maccore/issues/2559
2022-03-21 12:15:36 +01:00
Rolf Bjarne Kvinge 9c4c3213e1
[registrar] Fix comparing full token references. Fixes #11641. (#14313)
The static registrar usually stores a compressed version of metadata tokens in
the generated code. However, when there are many assemblies in the app (>127),
we can't use the compressed version anymore, and fall back to a full version.

In this case, we weren't comparing type metadata tokens correctly when looking
for a type in our table of types, and thus we weren't finding the type we were
looking for.

The result is an exception like this:

> Can’t register the class MyClass when the dynamic registrar has been linked away.

In the generated table of types we're storing the full metadata token, which
includes a few bits indicating which type of token it is (in this particular
case a TypeDef token). When going through the table looking for a type, we
need to compare with those few bits set on the input type token as well to
find what we're looking for.

Also make it possible to use the remove-dynamic-registrar optimization on
macOS (which is useful by itself, but it also makes adding a test case
easier).

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1476585.
Fixes https://github.com/xamarin/xamarin-macios/issues/11641.
2022-03-11 07:30:01 +01:00
Manuel de la Pena e07b7bef79
[CI] Move tests outside of the build machine. (#14105)
Move the execution of tests to a diff bot to be compliant with the latests EO.
2022-03-10 23:36:37 -05:00
Rolf Bjarne Kvinge 1a21e1ee5c
[msbuild] Make the CollectBundleResourcesDependsOn property public. Fixes #11984. (#14330)
Make the CollectBundleResourcesDependsOn property public, so that custom
targets can inject themselves into the build early enough to add additional
BundleResource or Content items (by adding their custom target's name to the
CollectBundleResourcesDependsOn property).

Fixes https://github.com/xamarin/xamarin-macios/issues/11984.
2022-03-09 18:19:48 +01:00
Rolf Bjarne Kvinge bb655a3840
[dotnet] Only validate the RuntimeIdentifier if we need/use it. Fixes #13482. (#14339)
Fixes https://github.com/xamarin/xamarin-macios/issues/13482.
2022-03-09 08:22:52 +01:00
Rolf Bjarne Kvinge 5103060d72
[tests] Long live Xamarin! (#14336)
And a few other minor updates to test Info.plists.
2022-03-09 08:19:48 +01:00
Sebastien Pouliot e6e4ddbab2
[appcompare] Remove old/local copy of the tool and update comparison documentation (#14190)
There's a newer version of the tool availble as a (tool)
[nuget](https://www.nuget.org/packages/appcompare/)

The nicest part, for this use case, is that it can map renamed files
between the two app bundles being compared.
[Example](https://gist.github.com/spouliot/68a43a4f514315d52b35446016ba0d2e)
2022-02-18 13:04:28 +01:00
Rolf Bjarne Kvinge e25163f573
[.NET] Rename our product assemblies. Fixes #13748. (#13847)
Rename our product assemblies to:

* Microsoft.iOS.dll
* Microsoft.tvOS.dll
* Microsoft.macOS.dll
* Microsoft.MacCatalyst.dll

This makes it easy to distinguish between legacy Xamarin and .NET whenever the
product assembly is mentioned, and I've also chosen the platform part of the
name to match how the platforms are named elsewhere (this also makes it
possible to simplify our build logic, since we can remove a lot of special
casing).

Fixes https://github.com/xamarin/xamarin-macios/issues/13748.
2022-02-16 21:30:32 +01:00
Rolf Bjarne Kvinge 5b8250486f
[dotnet/msbuild] Run install_name_tool to fix the id for dylibs. Fixes #13999. (#14147)
Fixes https://github.com/xamarin/xamarin-macios/issues/13999.
2022-02-16 21:13:40 +01:00
Rolf Bjarne Kvinge a404081365
[dotnet] Add support for the PublishFolderType metadata on Content and BundleResource items. (#14162)
Add support for the PublishFolderType metadata on Content and BundleResource
items, which makes it possible to change the location in the app bundle for
these items (this was possible to do before with the Link metadata), but most
importantly it also makes it possible to choose to *not* bundle these items in
the app bundle (which was not possible before with the Link metadata, nor any
other means).

At first I thought setting CopyToPublishDirectory /
CopyToOutputDirectory=Never would accomplish that, but it turns out we don't
honor those, and since we already have this behavior of ignoring
CopyToPublishDirectory / CopyToOutputDirectory in legacy Xamarin, I didn't
want to change it in .NET.

So I added support for honoring the PublishFolderType metadata instead, which
is new and we already support for other item groups. This is accomplished by
adding all Content and BundleResource items with PublishFolderType set to the
ResolvedFileToPublish item group (where we already handle any
PublishFolderType values), and then we ignore such Content and BundleResource
items in our CollectBundleResources task.

Also update the documentation and add tests.
2022-02-16 20:54:14 +01:00
Rolf Bjarne Kvinge 404b6e9af5
[msbuild/dotnet] Set NoBindingEmbedding to 'true' by default in .NET. Fixes #12530. (#12694)
Not embedding third-party libraries in the binding assembly is the future, and
let's try to enable it by default starting with .NET.

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

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-02-16 10:30:41 +01:00
Rolf Bjarne Kvinge 5e462b1c21
[dotnet] Fix non-bundling of debug files for release builds. Fixes #14085. (#14103)
Fixes https://github.com/xamarin/xamarin-macios/issues/14085.
2022-02-09 16:46:04 +01:00
Rolf Bjarne Kvinge 352a0d818a
[dotnet] Include all files in the Resources subdirectory as bundle resources. Fixes #13808. (#14018)
Include all files in the project's Resources subdirectory as BundleResource
items (except .DS_Store files, which are pretty omnipresent on macOS).

Also, contrary to the other default includes, add a condition so files are
only included if we have a resource prefix (typically "Resources"), otherwise
the entire hard drive might be included, and that's not really what we want.

Fixes https://github.com/xamarin/xamarin-macios/issues/13808.
2022-02-07 18:55:31 +01:00
Chris Hamons 0a57125ccc
[tests] Add ILStrip with satellite assemblies lib (#13973)
- Part of investigation of https://github.com/xamarin/xamarin-macios/issues/13922
2022-02-02 09:01:32 -06:00
Rolf Bjarne Kvinge 4d2db6463b
[dotnet] Fix templates to use NativeHandle instead of IntPtr. Fixes #13979. (#14001)
Also make the (NativeHandle) constructor protected instead of public, to make
it clearer that it's not for public consumption.

And modify the template tests to execute the template if we can.

Fixes https://github.com/xamarin/xamarin-macios/issues/13979.
2022-02-01 17:22:53 +01:00
Rolf Bjarne Kvinge d1989b63c4
[tests] Simplify makefiles by using shared code. (#13990) 2022-01-31 21:11:08 +01:00
Rolf Bjarne Kvinge ba555b2fcc
[tests] Use the local .NET for running unit tests. (#13836)
This hopefully solves a few problems on M1, where we'd want to execute with
.NET 5 (last stable .NET release), but that version only supports x86_64, and
then if an ARM64 version of .NET 6 was also installed, things would break in
mysterious ways.

This way we have full control over what happens, and also a consistent
environment across all machines.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-01-28 16:29:37 +01:00
Chris Hamons 6ce1ff7093
[NET6] Add binding project template for iOS and MacCatalyst (#13840)
- Fixes https://github.com/xamarin/xamarin-macios/issues/13578
- Uses older-style namespace with {} instead of top level due to https://github.com/xamarin/xamarin-macios/issues/13837
2022-01-25 10:05:56 -06:00
Rolf Bjarne Kvinge c6ee74377a
[msbuild] Unify some of the codesign dependency properties. (#13725) 2022-01-19 18:54:08 +01:00
Rolf Bjarne Kvinge d953b6f037 [tests] Augment tests to rebuild and make sure the result is as expected. 2022-01-13 22:07:57 +01:00
Rolf Bjarne Kvinge 753b3ee100 [tests] Simplify makefiles by deleting unused targets. 2022-01-11 17:35:20 +01:00
Rolf Bjarne Kvinge 214064d430 Merge remote-tracking branch 'origin/main' into dotnet-resolvedfiletopublish 2022-01-11 17:32:26 +01:00
TJ Lambert a0ad207ea7
[Dotnet] Automatically Allow Assets of all types and Test (#13346) 2022-01-10 08:32:05 -06:00
Rolf Bjarne Kvinge ecbeca5725 [tests] Adjust the IsNotMacBuild .NET test to not expect Xamarin.iOS.dll in the app bundle.
We're copying files differently to the bundle now, and we end up doing less
when not building on a Mac, which is why we're not copying Xamarin.iOS.dll
anymore.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 268620bd0e [tests] Add BundleStructure, a test project to verify how files end up in the app bundle. 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 0681dc1f4a [tests] Move some sharable code to a more generic location, so that it's easier to share 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 0cc54bd76e [tests] Add build logic to build NuGets for testing purposes. 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge b695c8c837
[dotnet] Don't add FileNativeReferences to the main libraries to link with. Fixes #13503. (#13598)
Don't add FileNativeReferences to the main libraries to link with, because we
pass that list of main libraries to the LinkNativeCodeTask, and we're already
passing the FileNativeReferences for a different task parameter.

This means that we end up adding the file native reference twice to the linker
arguments, and that's wasteful. It can also cause problems if those linker
arguments aren't always computed in the same way (once as a relative path,
once as an absolute path for instance).

Fixes https://github.com/xamarin/xamarin-macios/issues/13503.
2021-12-21 08:13:53 +01:00
Rolf Bjarne Kvinge 32b112bad9
[tests] Shutdown build servers when rebuilding. (#13581)
This makes sure that MSBuild picks up rebuilt task assemblies.
2021-12-16 17:40:12 +01:00
TJ Lambert c4e3ab85c2
[Dotnet] Fix building twice in a row issue (#13573) 2021-12-16 09:07:47 -06:00
Rolf Bjarne Kvinge b3c6218c5f
[msbuild] Improve logic to clean up the app bundle for macOS and Mac Catalyst apps before signing. (#13479)
There can't be any files in the root directory of the app bundle for macOS and
Mac Catalyst, otherwise code signing will fail. The problem is that Mono will
create a crash report in the current directory if the process crashes, and the
current directory is the root directory of the app bundle, which means that if
running an app crashes, the next build will likely fail because of the crash
report.

We had logic to detect this and remove any crash reports, but our crash report
detection pattern wasn't good enough and let some files through. This PR
updates that pattern, and also improves the code to report warnings for any
other files in the app bundle's root directory.
2021-12-07 21:33:22 +01:00
Rolf Bjarne Kvinge 44feba841e
[dotnet] Check for the x64 version of .NET. (#13481)
Check for the x64 version of .NET to see if it's installed if the default
dotnet location doesn't exist (the x64 version will exist on an ARM64 mac when
installing the x64 version of .NET).

Also allow the .NET unit tests to be executed using any recentish version of
.NET.
2021-12-03 07:56:23 +01:00
Rolf Bjarne Kvinge 3f44ad5d6c [tests] Fix platform for test to actually make the test work. 2021-12-02 09:02:42 +01:00
Rolf Bjarne Kvinge 9cf5964860 [tests] Update .NET unit tests to be aware that we can build for simulator/arm64 now. 2021-12-01 19:59:38 +01:00
Rolf Bjarne Kvinge 78f52e2fc2
[msbuild/tests] Add support for xcframeworks with static libraries in them. (#13459)
* [tests] Create a libtest.xcframework and libtest2.xcframework

* [tests] Make bindings-test and bindings-test2 use an xcframework instead of plain static library

* [msbuild] Add support for xcframeworks with static libraries in them.

* List the frameworks libtest needs.

* [tests] Update .NET unit tests according to test project changes.

* [tests] Add new test to verify that packing an old-style binding project doesn't work.
2021-11-30 18:19:22 +01:00
Rolf Bjarne Kvinge 2aa21751a6
[dotnet] Show an error if an app developer tries to publish a simulator architecture. (#13462)
* [dotnet] Show an error if an app developer tries to publish a simulator architecture.

* We can't publish a simulator build, so show an error in that case.
* We can't change the default runtime identifier when publishing (to a
  publishable runtime identifier), because by the time we know we're
  publishing, it's too late to change the runtime identifier. This means that
  it'll be required for app developers to specify a runtime identifier when
  publishing to a mobile platform, since the current default runtime
  identifier is for a simulator build.

Partial fix for https://github.com/xamarin/xamarin-macios/issues/12997.

* Fix typo and improve naming.

* [dotnet] Don't use '_UsingDefaultRuntimeIdentifier', it's already used elsewhere in .NET
2021-11-29 23:13:48 +01:00
Rolf Bjarne Kvinge b70e6f4674
Submodule MonoTouch.Dialog. (#13058)
* Submodule MonoTouch.Dialog.

Submodule MonoTouch.Dialog, so that we can easily build it using .NET. This
submodule will become redundant when/if we publish a .NET version of
MonoTouch.Dialog, but until that happens we need it at least for our own test
suites.

This also means we have to copy our NuGet.config and global.json files to the
MonoTouch.Dialog project directory so that we point msbuild to use our local
build.

New commits in spouliot/Touch.Unit:

* spouliot/Touch.Unit@cbda703 [Touch.Client] Use MonoTouch.Dialog from a submodule. (#109)

Diff: 3345db2f4e..cbda703583

* Use relative path for submodule.

And fix indentation and set the branch name.

* Don't use 'RootTestsDirectory' when it might not be defined yet.

* [tests] Our test projects don't need to reference MonoTouch.Dialog directly.

The projects get the MonoTouch.Dialog reference indirectly through the
Touch.Client project reference.

* [tests] Only validate unique errors in the .NET unit tests.

* [tests] No need to reference System.Json anymore, that's handled directly in the MonoTouch.Dialog project.

* [tests] Reference nunit.framework.targets so we get a workaround for an NUnit issue everywhere.

* [msbuild] Only try to create a package if we're able to create an app bundle.

This fixes an issue where a library project would try (and fail) to create a
package when 'CreatePackage=true' (which could be set for the executable
project, but inherited by the library project since the executable project
depends on it).

* [tests] Adjust PackTest.BindingXcFrameworksProject to not set the AssemblyName property.

MSBuild ends up being very confused when the project we're trying to build
depends on other projects, because AssemblyName is set for all the projects
being build, and MSBuild complains about ambiguous projects:

> error: Ambiguous project name 'bindings-xcframework-test'
2021-10-26 08:18:34 +02:00
Chris Hamons ab5c0c6b56
[net6] Fix ILStrip'ed apps to actually work again (#13098)
* [net6] Fix ILStrip'ed apps to actually work again

- In a late minute change to the ILStrip PR (https://github.com/xamarin/xamarin-macios/pull/12563) a change to support XVS support broke execution of Apps that were stripped
- Applications were broken because none of the stripped assemblies were actually copied into the bundle
- However, the tests still passed, because all assemblies that were there had no IL (zero assemblies total)

Now why did this happen?
- The stripped assemblies were changed to return via an msbuild Output Element
- Output Element can return an Property or ItemGroup, depending if you use the PropertyName or ItemName attributes
- Unfortunately I used PropertyName, when I expected an ItemGroup. So I silently had a property created instead.
- Thus zero items were added to the list of files to copy into the bundle
- Which was undetected as the test did not confirm files were copied in, and manual tests were not run so late into the PR (3 weeks after PR was opened)

How was it fixed?
- Correctly using ItemName on Output created a valid item group to reference
- However, that still failed with an absurdly confusing error:

 PATH/Microsoft.NET.Publish.targets(277,5): error MSB3024: Could not copy the file FILE to the destination file PATH, because the destination is a folder instead of a file. To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles.

- After a splunking through netcore targets, I found the metadata on these assemblies references really matters. Without it, they are not processed correctly at all.
- Thus, I updated ILStripBase to clone the existing metadata when changing the original assembly reference to the stripped path
- Finally, I corrected the test to assert that required files are copied in. I also manually ran our device test.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-10-25 11:31:42 -05:00