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

429 Коммитов

Автор SHA1 Сообщение Дата
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
Rolf Bjarne Kvinge 42c87ab2f7
[runtime] Make Runtime.Arch a readonly field in .NET. Fixes #5518. (#14076)
* Make Runtime.Arch a readonly field.
* Tell the AOT compiler Runtime.Arch is a constant value.
* Tell the linker to stub out the method we use to fetch the current
  architecture from native code (it turned out a bit complicated to set the
  Arch field when it's readonly - the solution I came up with was to call a
  P/Invoke).

Test case (size of the main executable): link all (debug)

* Before:  33.522.704 bytes
* After:   33.506.112 bytes
* Difference: -16.592 bytes (-0.05 %)

There were no size differences in release mode, nor were there any size
differences in the "don't link" test, neither for debug nor release mode.

Fixes https://github.com/xamarin/xamarin-macios/issues/5518.
2022-02-07 08:05:41 +01:00
Rolf Bjarne Kvinge 9efcac2eb7
[dotnet] Update breaking changes docs. (#14044)
Make note about:

* Caveat with regards to IntPtr constructors having to be manually changed to
  be NativeHandle constructors.
* Moving NSFileProvider types.
2022-02-04 15:36:30 +01:00
Rolf Bjarne Kvinge 83e113f8f8
[CFNetwork] Remove the MessageHandler type from .NET. (#14056)
This type has been obsolete for over 3 years, it hasn't been updated in many
more years, and there are multiple newer and better alternatives available.

This meant we could remove a few more other (private/related) types as well.
2022-02-04 07:54:39 +01:00
Rolf Bjarne Kvinge 0bcb737d8a
[dotnet] Update docs about default inclusion in binding projects. (#14035)
Binding projects enable default compile items now, so the documentation saying
otherwise is outdated and must be rectified.

Ref: 499a69e772
2022-02-03 17:22:45 +01:00
imhameed adff9df98d
Link against the Compression framework. (#14034)
Mono will eventually use functions from the Compression framework to
decompress ICU data files during the runtime's initialization. Prepare
for this by linking against the compression framework.

Also see https://developer.apple.com/documentation/compression?language=objc.
2022-02-03 10:05:57 +01:00
Rolf Bjarne Kvinge 68aaef9ff7
[dotnet] Ask the linker to not mark copied assemblies if we're in a 'don't link' scenario. (#14011)
This speeds up builds significantly when the linker is disabled.

Test case: building tests/dotnet/MySimpleApp for macOS.

* Before: 37s
* After: 9s
* Difference: 26s (4x faster)

Test case: run the .NET tests

* Before: 2h55
* After: 1h43
* Difference: 1h12 (1.7x faster)

Contributes towards https://github.com/xamarin/xamarin-macios/issues/10251.
Ref: https://github.com/dotnet/linker/issues/2089
2022-02-02 08:36:17 +01:00
Rolf Bjarne Kvinge b1ce33ba51
[Foundation/ObjCRuntime] Use 'ObjCException' as the native exception type name for all platforms in .NET. Fixes #13855. (#13915)
* Use 'ObjCException' instead of 'MonoTouchException' as the managed exception
  type wrapping an NSException for all platforms in .NET (that was already the
  case for macOS, so no change there).
* Make the ObjCException class behave like the MonoTouchException class does.
* Move the ObjCException type to the ObjCRuntime namespace in .NET.

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

Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
2022-02-01 17:24:57 +01: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 aaee4d9f27
[ModelIO] Adopt XAMCORE_4_0 changes in .NET. (#13941)
This turned out a bit complex, because numerous ModelIO APIs were initially bound
with wrong matrix types, and had to be rebound later (our matrix type was transposed
with regards to the native matrix type). The new versions often had to use worse
names, so that's being fixed now. This means that numerous tests had to be updated,
because the original API now returns non-transposed matrices.
2022-02-01 08:08:50 +01:00
Sebastien Pouliot 9e639d51d0
[net][objcruntime] Remove `UseAutoreleasePoolInThreadPool` in net profile (#13960)
and add it to the `BreakingChanges.md` document
2022-01-31 16:45:05 +01:00
Rolf Bjarne Kvinge a14712d6e3
[dotnet] Convert windows dir separators to mac dir separators for relative paths in the _StripAssemblyIL target. Fixes #13838. (#13919)
It seems that MSBuild doesn't always automatically convert directory
separators for relative paths, so we have to do it ourselves.

Thanks to @lauxjpn for diagnosing this and coming up with a fix.

Fixes https://github.com/xamarin/xamarin-macios/issues/13838.
2022-01-28 10:28:47 +01:00
Vlada Shubina 4a98896977
Ensure PackageType = Template for template packages (#13894)
## Problem

Template package does not appear on nuget.org correctly, as `packageType` in nupkg is set to `DotnetPlatform`.

## Solution

Disabled loading Microsoft.DotNet.SharedFramework.Sdk for template package build.
it doesn't seems to be needed and overwrites PackageType to DotnetPlatform, even though initially it is correctly set to 'PackageType'
2022-01-28 10:17:31 +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 fa2173e5ef
[CFNetwork] Move the CFHost and CFHTTP* types to the CFNetwork namespace in .NET. (#13761)
These types come from the CFNetwork.framework, but for some reason they were bound inside CoreServices many years ago.

This resolves a potential issue where we might end up linking with the
CoreServices framework instead of CFNetwork framework (because we use the
namespace of types to determine which framework they belong to).
2022-01-19 08:07:06 +01:00
Rolf Bjarne Kvinge 6564841c6a Merge remote-tracking branch 'origin/main' into dotnet-resolvedfiletopublish 2022-01-14 11:00:16 +01:00
Rolf Bjarne Kvinge 9894605c4f
[SceneKit] Make SCNMatrix4 column-major in .NET. Fixes #4652. (#13695)
* Implement a column-major version of SCNMatrix4 in .NET to match native code.
* This was done by copying the existing SCMatrix4 implementation, and modify it
  as required (doing it with conditional compilation in the same file turned out
  to be quite messy, so I opted for using different files for legacy Xamarin and
  .NET).
* There was one major change: the matrix inversion algorithm is new (copied from
   .NET instead), because the legacy Xamarin version showed strange results with
  some test values.
* Add setters for SCNMatrix4.Column[0-3] for legacy Xamarin to match the .NET API.
* Add CreateFromColumns methods for legacy Xamarin to match the .NET API.
* Add tests for all the new API.

Fixes https://github.com/xamarin/xamarin-macios/issues/4652.
2022-01-14 07:30:19 +01:00
Rolf Bjarne Kvinge b5908a72d2 [dotnet] Use a task to collect decompressed *.[xc]frameworks. 2022-01-13 22:36:41 +01:00
Mauro Agnoletti 5c342f0283
Include Broker satellite assemblies to the sign list (#13688) 2022-01-13 16:30:33 -05:00
Rolf Bjarne Kvinge a2e4438536 Merge remote-tracking branch 'origin/main' into dotnet-resolvedfiletopublish 2022-01-13 22:13:00 +01:00
Rolf Bjarne Kvinge 4c2d0fe103 [dotnet] Split decompressing zip files and figuring out what was inside the zip files in two different tasks.
Split decompressing zip files and figuring out what was inside the zip files
in two different tasks, so that we do the second part even if the first part
isn't done (it could have been done in a previous build).

This is required for rebuilds to work correctly.
2022-01-13 22:11:58 +01:00
Rolf Bjarne Kvinge 205f22ff75 [dotnet] Touch all the destination files when copying a directory to an app bundle.
This fixes the following problem:

* App with framework is built and signed.
* App is rebuilt, and the framework is copied in again.
* This time, the framework's executable's timestamp will be earlier than the
  timestamp when it was last signed, and as such it won't be signed again.

Fix this by touching all the copied files when copying a directory to the app bundle.
2022-01-13 22:09:02 +01:00
Rolf Bjarne Kvinge 473df24a2e
[dotnet] Update breaking changes documentation to talk about nint/nuint. (#13675) 2022-01-12 12:45:52 +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
James Parsons 321ceb62a4
Remove xamarin iOS designtime targets import (#13659)
These files are no longer used by the XamarinVS extension and the import is therefore unnecessary.
2022-01-10 13:03:33 +01:00
Rolf Bjarne Kvinge fa8f6a6f5c [dotnet] Update comment. 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge acdd27a9ef [dotnet] Update the relative path of every item left in ResolveFileToPublish.
Update the relative path of every item in the ResolveFileToPublish item group to
be relative to the root of the app bundle.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 62e5655009 [dotnet] Collect binding resource packages and remove them from the ResolvedFileToPublish item group.
Collect all the binding resource packages, add our binding resource packages to the
items that need to be resolved, and remove them from the ResolvedFileToPublish item
group.

Depending on the resolved content (static library, dynamic library, framework) of
a binding resource package, we must do different things , so these items must be
removed from the ResolvedFileToPublish item group.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 007bd92830 [dotnet] Collect dynamic libraries, add them to the _FileNativeReference item group, and remove them from the ResolvedFileToPublish item group.
Any dynamic libraries in _FileNativeReference will be copied to the app bundle elsewhere.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 6331fc6f23 [dotnet] Link with any static libraries, but remove them from the ResolvedFileToPublish item group.
Static libraries are not copied to the app bundle.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 434178fa2d [dotnet] Collect compressed plugins and remove them from the ResolvedFileToPublish item group.
The _DecompressPlugIns target will process all the items in the _CompressedPlugIns
item group, decompress them and add them to _DirectoriesToPublish. The compressed
file itself is not copied to the app bundle.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge b27ef8033d [dotnet] Collect plugins and remove them from the ResolvedFileToPublish item group.
We can't keep plugins in the ResolvedFileToPublish item group, because plugins are
usually directories, which may contain symlinks, which the built-in publish logic
doesn't handle correctly.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 5423457fd8 [dotnet] Collect compressed frameworks into the _CompressedAppleFrameworks item group and remove them from ResolvedFileToPublish.
The _DecompressAppleFrameworks target will process all the items in the _CompressedAppleFrameworks
item group, decompress them and add them to _FrameworkNativeReference. The compressed
file itself is not copied to the app bundle.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 2244a45e56 [dotnet] Collect and resolve .xcframeworks into .frameworks and add the result to the _FrameworkNativeReference item group. 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge c61c71409a [dotnet] Add frameworks to the _FrameworkNativeReference item group, and remove them from ResolvedFileToPublish. 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 010e7e216b [dotnet] The first thing we do after computing the bundle location for each path, is to re-populate the ResolvedFileToPublish item group with the results. 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 583230824d [dotnet] Remove _BundleResourceWithOutputPath from ResolvedFileToPublish, we're already handling those files elsewhere. 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 86b9fb4ea9 [dotnet] The 'createdump' executable goes in the same directory as all the assemblies 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 7096d7626d [msbuild] Remove the static libraries (.a) we ship with Xamarin from ResolvedFileToPublish 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 07f0f3eefb [dotnet] Only publish a single icu*.dat file 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 59096ba942 [dotnet] We're not bundling the runtimeconfig.json file.
It's parsed at build time (in the _CreateRuntimeConfiguration target), and stored
in a binary format, so we don't need the original json file.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 22220b149c [dotnet] Start using the new ComputeBundleLocation task 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 3dc0fe881a [dotnet] Add target to decompress compressed binding resource packages.
This new target will process all the items in the _CompressedAppleBindingResourcePackage
item group, decompress them, and then resolve the extracted results.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge ee55170feb [dotnet] Add target to decompress compressed plugins.
This new target will process all the items in the _CompressedPlugIns item group,
decompress them, and add them to _DirectoriesToPublish for later copying into the
app bundle.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge e617903fac [dotnet] Add target to decompress compressed frameworks.
This new target will process all the items in the _CompressedAppleFrameworks item
group, decompress them, resolve them if necessary (for .xcframeworks) and add them
to _FrameworkNativeReference.
2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 0d0b0bc86b [dotnet] Always set 'UseAppHost' and '_RuntimeIdentifierUsesAppHost' to 'false' in .NET.
Otherwise .NET might want to include an app host in the app, which ends up with a
build warning, because we don't use apphosts.
2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 86a3689b77 [dotnet] Make sure that MSBuild doesn't strip away our PublishFolderType metadata 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 19de8ca69e [dotnet] Add documentation about how we determine where files go in the app bundle 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 94b1536ba8 [dotnet] There's no need to compute the publish location if we're not building a (publishable) app 2021-12-22 10:17:34 +01:00