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

466 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 6f9a8ebbbd
[msbuild] Rename the GetMinimumOSVersion task to ReadAppManifest and make it read more properties from the app manifest. (#12485)
* Read CFBundleDisplayName and CFBundleVersion and use them in the
  _CompileITunesMetadata task.

* Read numerous other app manifest values and pass them to the ACTool and
  IBTool tasks.

This makes it possible to not parse the Info.plist in these tasks, which will
become more complicated in the future, when we might either not have an
Info.plist, or have many partial ones.

Also enable nullability.
2021-08-20 09:54:59 +02:00
Rolf Bjarne Kvinge d3c9f4b1b6
[dotnet] Make CoreCLR the only option for macOS. Fixes #12477. (#12480)
* [dotnet] Make CoreCLR the default for macOS.

* [dotnet] Show an error if trying to use MonoVM on macOS.

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

* [xharness] Remove CoreCLR variations for macOS tests.

The default is using CoreCLR for macOS, so having a specific variation for it
doesn't make sense.

* [tests] Adjust linker tests to work on CoreCLR as well.
2021-08-20 09:53:40 +02:00
Rolf Bjarne Kvinge f00b288529
[msbuild] Add a task to compute the path to the AOT compiler. (#12474)
The MonoAotCrossCompiler item group is empty when executing remotely from
Windows, so in that case we evaluate a csproj on the Mac side to compute the
AOT compiler path instead of relying in the task input from Windows.

Ref: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1362367
2021-08-19 15:48:53 +02:00
Jonathan Peppers 8d0c1c9031
[dotnet] use **FromWorkload** for targeting/runtime pack versions (#12449)
Context: https://github.com/dotnet/sdk/pull/19596
Context: https://github.com/xamarin/xamarin-android/pull/6184

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file when
building a .NET 6 app with a local build of xamarin-macios.

You will no longer need a feed such as:

    <add key="local-dotnet-feed" value="~/src/xamarin-macios/_build/nuget-feed" />

To further clean things up, I removed the need for:

* Any NuGet feed named `local-dotnet-feed`
* `$(DOTNET_FEED_DIR)`
* Generation of `dotnet/Workloads/NuGet.config`
2021-08-19 09:03:11 +02:00
Rolf Bjarne Kvinge ab88892fd1
[dotnet] Update logic for default global namespaces and fix the templates. Fixes #12457. (#12471)
* Add 'ImplicitUsings=true' to all the templates.
* Make the implicit global namespaces C#-only.
* Add the implicit global namespaces to the 'Using' itemgroup instead of the
  'Import' itemgroup.
* Make sure the global namespaces are set from AutoImport.props, so that the
  user may remove any global namespace they don't want in their project file
  (by doing something like: `<Using Remove="Foundation" />`)

Ref: https://github.com/dotnet/sdk/issues/19521
Ref: https://github.com/dotnet/sdk/issues/19793

Fixes https://github.com/xamarin/xamarin-macios/issues/12457.
2021-08-19 07:47:03 +02:00
Rolf Bjarne Kvinge 9930ddc6dd
[dotnet] Implement a workaround for .NET's lack of extensibility for 'dotnet run'. (#12458)
.NET doesn't support executing other targets/tasks when doing "dotnet run".
However, we need to (like we do for our current "Run" target), so implement a
rather simplistic/hacky workaround by making "dotnet run" just do "dotnet
build /t:Run".

It doesn't support everything that "dotnet run" does (for instance it doesn't
support the /no-build flag), but it should work for most use cases.

Ref: https://github.com/dotnet/sdk/issues/18436
2021-08-17 16:50:37 +02:00
Rolf Bjarne Kvinge 16ff955913
[runtime] Set the RUNTIME_IDENTIFER and APP_CONTEXT_BASE_DIRECTORY app context values. Fixes #12444. (#12446)
Mono and CoreCLR need this.

Fixes https://github.com/xamarin/xamarin-macios/issues/12444.
2021-08-17 15:30:27 +02:00
Rolf Bjarne Kvinge 716a5a7bd1
[msbuild] Add a property that specifies the final path to the Info.plist in the app bundle (#12433)
* Add an '_AppBundleManifest' property that specifies the final path to the
  Info.plist in the app bundle.
* Remove the '_AppBundleManifestPath' property, it's not used anywhere.
* Adjust the CompileAppManifest task to take the final path to the Info.plist,
  instead of computing it and returning it. This way the CompileAppManifest
  task does not output anything back into MSBuild (which is important, because
  the CompileAppManifest task won't execute if the output file is up-to-date,
  and if it's not executed, any output properties won't be set either).
2021-08-17 15:29:42 +02:00
Peter Collins b4e828c426
[ci] Opt in to auto .NET 6 VS PR creation (#12414)
Context: https://github.com/xamarin/yaml-templates/pull/124

The VS Insertion stage will now automatically open a PR against VS main
once approved.  The primary limitation with the current workflow is that
there is no good way to automatically create a PR against a branch other
than VS main.  This can be addressed at a later date, as we can still do
manual insertions into release branches during QB mode as needed
2021-08-16 18:29:46 +02:00
Rolf Bjarne Kvinge 961d80aedb
[dotnet] Don't use system resource keys if we're debugging. Fixes #12438. (#12439)
Fixes https://github.com/xamarin/xamarin-macios/issues/12438.
2021-08-16 10:51:16 +02:00
Rolf Bjarne Kvinge 987d8dff85
[dotnet] Fix exclusion of mono components. (#12421)
'_MonoRuntimePackPath' already contains a trailing slash, so adding another
one made two, and that was too much for MSBuild to realize that it was really
the same file as the one with only one slash in the path, and those files
weren't removed from the build correctly.
2021-08-12 17:15:08 +02:00
Peter Collins ddb699426a
[ci] Sign .NET 6 VS Hot Restart content (#12400)
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=5074495&view=logs&j=f8a716f9-5318-5935-19a4-149a64409b96&t=773a1aad-99f2-5f0b-eafa-0deb88171543
Context: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1366309
Context: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1366310

Commit 9dbf451d added files required to support Hot Restart in .NET 6
packages, however it did not update SignList.xml to also include these
new file additions.  This caused .nupkg signing issues:

    C:\a\_temp\artifact-signing\SignFiles.proj(66,5): error : Unknown assemblies:
    C:\a\_temp\artifact-signing\SignFiles.proj(66,5): error :     C:\a\_temp\artifact-signing\extracted\Microsoft.iOS.Windows.Sdk.15.0.100-ci.main.446\tools\msbuild\iOS\BouncyCastle.Crypto.dll;
    C:\a\_temp\artifact-signing\SignFiles.proj(66,5): error :     C:\a\_temp\artifact-signing\extracted\Microsoft.iOS.Windows.Sdk.15.0.100-ci.main.446\tools\msbuild\iOS\imobiledevice-x64\bz2.dll;
    C:\a\_temp\artifact-signing\SignFiles.proj(66,5): error :     C:\a\_temp\artifact-signing\extracted\Microsoft.iOS.Windows.Sdk.15.0.100-ci.main.446\tools\msbuild\iOS\imobiledevice-x64\getopt.dll;
    C:\a\_temp\artifact-signing\SignFiles.proj(66,5): error :     C:\a\_temp\artifact-signing\extracted\Microsoft.iOS.Windows.Sdk.15.0.100-ci.main.446\tools\msbuild\iOS\imobiledevice-x64\ideviceactivation.dll;
    ...

Fix signing by listing all new content that should be skipped or signed
with first/third party certs.

Additionally, content in nested .zip files also needs to be signed. I've
added a couple of targets to SignList.targets to unzip and rezip these
files before and after individual file signing runs.
2021-08-12 16:40:10 +02:00
Rolf Bjarne Kvinge 2972e1b715
Fix some whitespace issues in various files. (#12399)
* Remove BOM
* Add EOL at end of file.
2021-08-11 10:06:46 +02:00
Rolf Bjarne Kvinge 46afe81149
[dotnet] Add support for 'dotnet publish'. Fixes #11807. (#12397)
* Add support for 'dotnet publish'.
* Add support for a 'PkgPackagePath' for macOS and Mac Catalyst, an MSBuild
  property to specify the resulting .pkg path, to reflect the existing
  'IpaPackagePath' (for iOS and tvOS).
* Fix MSBuild logic that uses 'IpaPackagePath'. Looks like nobody has ever
  used this...
* Add tests.

Fixes https://github.com/xamarin/xamarin-macios/issues/11807.
2021-08-11 10:01:16 +02:00
Rolf Bjarne Kvinge 104ab12bdd
[dotnet/msbuild] Fix publishing user frameworks and dynamic libraries from binding projects. (#12396)
We extract frameworks from third-party libraries when running the linker, and
we need to store this information on disk and the reload it after the linker
has executed, and add it to the existing MSBuild variables that keep track of
the user frameworks and dynamic libraries that have to be copied to the app
bundle.

Fixes the framework-test tests.
2021-08-11 09:58:00 +02:00
Sebastien Pouliot a20d417bf7
[dotnet][linker] Enable the sealer optimization (#12009)
when (by default)
* the interpreter is not enabled (since new code might subclass or override the members analyzed at build time)
* building for release

Reverts c56b893b68
Fix https://github.com/xamarin/xamarin-macios/issues/9573

Notes

* Even if possible (in metadata) there is no point in setting `final` on
a method if we remove `virtual`. This match ILLink version of the sealer
and makes the same test pass on both.

* Don't apply optimization on non-AOT builds, e.g. simulators, since some
features (like XML serialization) checks for
`RuntimeFeature.IsDynamicCodeSupported` and that requires some types
to be subclassed thru SRE
2021-08-10 16:01:30 -04:00
Rolf Bjarne Kvinge 4371133cf7
[dotnet] Remove workaround for private symbols for AOT. (#12334)
* [dotnet] Remove workaround for private symbols for AOT.

* [tools] Make Application.AotArguments a list of string.

This is just a simple refactoring to make Application.AotArguments a list of
strings instead of a comma-separated list of values.

* [tools] Only use direct-icalls when linking mono statically.

Ref: https://github.com/dotnet/runtime/issues/55000

* [mtouch] Fix aot arguments comparison.

* [tests] Adjust mtouch test according to mtouch changes.

* [tests] Add minimum OS version to the Mac Catalyst variation of the MySimpleApp test case.
2021-08-09 09:45:58 +02:00
Rolf Bjarne Kvinge 576dbb9b35
[msbuild/dotnet] Don't overwrite the 'CreateAppBundleDependsOn' property, only add to it. Fixes #12325. (#12346)
Fixes https://github.com/xamarin/xamarin-macios/issues/12325.
2021-08-05 08:17:44 +02:00
Rolf Bjarne Kvinge 82af982bd0
[dotnet] Handle an absolute PublishDir. Fixes #12041 and #12224. (#12333)
Properly compute the path where to put the app bundle and its files, relative
to the publish directory. The _AppBundlePath variable contains the path to the
app bundle relative to the project directory, but we need it relative to the
publish directory for .NET.

Fixes https://github.com/xamarin/xamarin-macios/issues/12041.
Fixes https://github.com/xamarin/xamarin-macios/issues/12224.
2021-08-04 15:12:24 +02:00
Rolf Bjarne Kvinge eafe528591
[runtime/tools] Implement finding native support libraries when linking statically. Fixes #10950, #11145 and #12100. (#12323)
* Add support for Mono Components.

* Modify how we look up symbols from native libraries shipped with Mono: we keep
  track of which native libraries we linked with, and depending on how we linked
  to those assemblies, we look the symbols up at runtime in either the current executable
  (if linking statically), or the actual library (where the P/Invoke says they're
  supposed to be).

* This means that we have to propagate how libmono is linked from the MSBuild code
  to the Application class so that our existing logic is able to correctly determine
  which native mono lib to use.

* Modify how we list the P/Invokes we need to preserve by taking into account the
  list of native libraries from Mono we have to link with (for .NET). For legacy
  Xamarin, I've reverted the logic to how it was before we started adding .NET support.

Fixes https://github.com/xamarin/xamarin-macios/issues/10950.
Fixes https://github.com/xamarin/xamarin-macios/issues/11145.
Fixes https://github.com/xamarin/xamarin-macios/issues/12100.
2021-08-03 17:06:58 +02:00
Rolf Bjarne Kvinge 440ff7c706
[runtime] Implement computing and passing the NATIVE_DLL_SEARCH_DIRECTORIES runtime property. Fixes #10504. (#12309)
This adds support to compute the NATIVE_DLL_SEARCH_DIRECTORIES value and pass
it to the runtime. It's the last property listed in #10504, so this fixes that
issue.

Fixes https://github.com/xamarin/xamarin-macios/issues/10504
2021-08-02 09:25:54 +02:00
Rolf Bjarne Kvinge 9ae2e66a9c
[dotnet] Add support for using the concurrent SGen GC. (#12289) 2021-07-30 09:53:13 +02:00
Rolf Bjarne Kvinge 63f28c0c5c
[dotnet/msbuild] Fix packaging and archiving support in .NET. Partial fix for #10413. (#12244)
* Rearrange some MSBuild logic so that the packaging/archiving code for macOS
  can also be used for Mac Catalyst.
* Make the .NET build logic package/archive when requested to do so.
* Add tests.

Partial fix for https://github.com/xamarin/xamarin-macios/issues/10413.
2021-07-29 15:33:08 +02:00
Emanuel Fernandez Dell'Oca 7c66aa3829
[net6] Fixes build issues from VS for Preview 7 (#12281)
* [net6] Adds missing custom linker steps when building from Windows

To share the definition of the custom steps we need to specify the right path to the `dotnet-linker.dll`.

When building from macOS `_XamarinSdkRootDirectoryOnMac` will have the same value as `_XamarinSdkRootDirectory` (which is the local Xamarin SDK dir), but from Windows the former will be the path to the Xamarin SDK on the connected Mac. Essentially this new property is agnostic from the platform from which the build is being executed, and will always return the path to the Xamarin SDK on macOS (either local or remote), so it can be used on scenarios like this one where we know the resource we need should always be referenced from macOS.

* [net6] Updates .NET SDK path for remote tasks execution

This path needs to be updated because VS (from Dev17 Preview 3+) will install through XMA the .NET SDK and the iOS SDK on macOS in a custom dir. This should be the preferred path when building from Windows if it does exist.

* Adds missing spaces to TaskRunner.cs
2021-07-29 15:20:20 +02:00
Rolf Bjarne Kvinge 3d822de007
[runtime] List all assemblies in TRUSTED_PLATFORM_ASSEMBLIES as pass it to MonoVM/CoreCLR. Fixes #12265. (#12272)
List all the assemblies in the app bundle and pass them to MonoVM/CoreCLR's in
the TRUSTED_PLATFORM_ASSEMBLIES initialization property.

This way CoreCLR knows where to find System.Private.CoreLib.dll for fat apps
(it's in the runtimeidentifier-specific subdirectory, and by default CoreCLR
will only look next to libcoreclr.dylib).

Fixes https://github.com/xamarin/xamarin-macios/issues/12265.
2021-07-29 07:45:24 +02:00
Rolf Bjarne Kvinge 0bd4d1b101
[dotnet] Make it clearer that the linker is off by default for Mac Catalyst (like it already is for macOS). (#12242)
There's no real change here, the code did exactly this in before, but it was a
side effect of '_SdkIsSimulator' being 'true' for Mac Catalyst, which isn't
obvious. Now the logic is explicit for all platforms.
2021-07-28 09:28:13 +02:00
Rolf Bjarne Kvinge 25f19ae78a Merge remote-tracking branch 'origin/main' into dotnet-archive 2021-07-28 09:18:19 +02:00
Rolf Bjarne Kvinge 7986b2f2af
[dotnet] Globalization works for Mac Catalyst now. Fixes #11392. (#12247)
Fixes https://github.com/xamarin/xamarin-macios/issues/11392.
2021-07-28 09:12:22 +02:00
Peter Collins d886ae6d7a
[CI] Use NuGet to MSI conversion v2 (#12205) 2021-07-27 13:04:42 -04:00
Rolf Bjarne Kvinge 12f49a327e [dotnet] Add the CreateIpa, _CreateInstaller and Archive targets to the things we need to do at build time
* CreateIpa: only executed if 'BuildIpa' is set.
* _CreateInstaller: only executed if 'CreatePackage' is set.
* Archive: only executed if 'ArchiveOnBuild' is set.

We don't do this for inner builds of multi-rid builds, only single-rid builds or
outer builds of multi-rid builds.
2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge 0549af9736
[dotnet] Add support for the interpreter + AOT when needed. Fixes #11421 and #11724. (#12211)
* Add support for the interpreter everywhere.
* Add support for the AOT compiler everywhere we didn't support it before,
  because the interpreter needs it (at least System.Private.CoreLib.dll must
  be AOT-compiled when using the interpreter).
* Do FullAOT compilation on Mac Catalyst/ARM64 if we're not using the
  interpreter, since we can't use the JIT.
* Fix monotouch-test to be green on Mac Catalyst/ARM64.

Fixes https://github.com/xamarin/xamarin-macios/issues/11724.
Fixes https://github.com/xamarin/xamarin-macios/issues/11421.
2021-07-27 07:39:43 +02:00
Rolf Bjarne Kvinge c0651c92b1
[dotnet] Put the 'createdump' executable in the app bundle when using CoreCLR. Fixes #11432. (#12210)
So that CoreCLR can create crash dumps.

Fixes https://github.com/xamarin/xamarin-macios/issues/11432.
2021-07-26 16:16:10 +02:00
Rolf Bjarne Kvinge 6c06a9fa81
[dotnet/templates] Use file-scoped namespaces. Fixes #12085. (#12197)
Fixes https://github.com/xamarin/xamarin-macios/issues/12085.
2021-07-23 21:06:17 +02:00
Rolf Bjarne Kvinge a010778b30
[dotnet] Add support for implicit namespace imports. Fixes #12084. (#12173)
* [dotnet] Add support for implicit namespace imports. Fixes #12084.

Also update our templates to remove any using statements for implicitly imported
namespaces.

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

* [monotouch-test] Fix compilation error due to implicit namespace causing type conflict.

Fixes these errors:

    xamarin-macios/tests/monotouch-test/ImageIO/MutableImageMetadataTest.cs(54,54): error CS0104: 'CGImageProperties' is an ambiguous reference between 'CoreGraphics.CGImageProperties' and 'ImageIO.CGImageProperties'
    xamarin-macios/tests/monotouch-test/ImageIO/MutableImageMetadataTest.cs(54,88): error CS0104: 'CGImageProperties' is an ambiguous reference between 'CoreGraphics.CGImageProperties' and 'ImageIO.CGImageProperties'
    xamarin-macios/tests/monotouch-test/ImageIO/ImageMetadataTest.cs(40,54): error CS0104: 'CGImageProperties' is an ambiguous reference between 'CoreGraphics.CGImageProperties' and 'ImageIO.CGImageProperties'
    xamarin-macios/tests/monotouch-test/ImageIO/ImageMetadataTest.cs(40,88): error CS0104: 'CGImageProperties' is an ambiguous reference between 'CoreGraphics.CGImageProperties' and 'ImageIO.CGImageProperties'
2021-07-23 15:07:03 +02:00
dotnet-maestro[bot] 7dd7960f57
[main] Update dependencies from dotnet/installer (#12171)
* Update dependencies from https://github.com/dotnet/installer build 20210722.2

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-rc.1.21370.12 -> To Version 6.0.100-rc.1.21372.2

* [dotnet] Work around problem where the local .NET install contains an invalid workload.

We work around it by deleting the invalid workload.

* [dotnet] Fix merge failure - don't reference workloads that don't exist anymore.

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-07-22 22:13:03 +02:00
Rolf Bjarne Kvinge 1b357204ee
[dotnet/msbuild] Add support for using LLVM to build .NET apps. Fixes #11379. (#12136)
Fixes https://github.com/xamarin/xamarin-macios/issues/11379.
2021-07-22 15:49:22 +02:00
Peter Collins a150c1dfcc
[dotnet] Add runtime packs to workload manifests (#12168)
Runtime pack entries should be included in all workload manifest files,
even though they will not yet be resolved from the packs folder due to
https://github.com/dotnet/sdk/issues/14044.  These changes will also
allow us to start producing .msi files for the runtime packs for an
eventual inclusion in the Visual Studio installer.
2021-07-22 10:41:40 +02:00
Rolf Bjarne Kvinge 09e6c0329f [dotnet] Only list linker flags for assemblies after we've computed them.
This means not listing per-assembly linker flags for only binding projects, but delay
it until we've computed the linker flags for all assemblies (and reflect this in
variable names as well).
2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge d26bdf97bf [dotnet] Parse --dlsym and pass it to the dotnet-linker tasks. 2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge 24351db16c [runtime/tools] Implement finding native mono lib for Mac Catalyst.
This also meant propagating how libmono is linked from the MSBuild code to the Application
class so that our existing logic is able to correctly determine which native mono
lib to use.
2021-07-22 10:36:21 +02:00
Rolf Bjarne Kvinge 1dacea4d8c [dotnet] Refactor and extend the logic to determine whether we should run the AOT compiler or not.
We also can't link dynamically with libmonosgen-2.0.dylib if we AOT compile anything,
so make sure we don't do that.
2021-07-22 10:36:20 +02:00
Rolf Bjarne Kvinge 76c8461764
[main] Update dependencies from dotnet/installer (#12064)
This pull request updates the following dependencies

## From https://github.com/dotnet/installer

- **Subscription**: df3e6147-3e41-4928-6775-08d8f479343c
- **Build**: 20210720.12
- **Date Produced**: 7/21/2021 6:57 AM
- **Commit**: d7279fc09fcfb108c5fb97fa290dbbb11c4c441b
- **Branch**: refs/heads/main

- **Updates**:
  - **Microsoft.Dotnet.Sdk.Internal**: [from 6.0.100-preview.7.21330.1 to 6.0.100-rc.1.21370.12][1]
  - **Microsoft.NET.ILLink.Tasks**: [from 6.0.100-preview.6.21329.2 to 6.0.100-preview.6.21370.1][2]

[1]: 823ff33...d7279fc
[2]: f549b4e...6eae019

## Coherency Updates

The following updates ensure that dependencies with a *CoherentParentDependency*
attribute were produced in a build used as input to the parent dependency's build.
See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview)

- **Coherency Updates**:
  - **Microsoft.NET.ILLink.Tasks**: from 6.0.100-preview.6.21329.2 to 6.0.100-preview.6.21370.1 (parent: Microsoft.Dotnet.Sdk.Internal)
2021-07-22 10:32:32 +02:00
Peter Collins 2af23dbdfc
[CI] Add Prepare Release and VS Insertion stages (again) (#12157)
Context: xamarin/yaml-templates#117

Updates the .NET 6 NuGet packaging steps to exclude package metadata,
as the .msi conversion tooling does not process .nupkg file names with
the +sha.commit metadata.

Two new stages have been added to facilitate the Visual Studio setup
authoring process.

The first stage named "Prepare Release" will sign the .NET 6 NuGet
package content (inside and out), convert relevant packages to .msi
installers, generate Visual Studio manifests for the .msi installers,
and push the signed packages to the xamarin-impl feed.

The new SignList.xml file is required for our NuGet signing templates.

The new xamarin-workload.props file contains version information
and other metadata required to generate a Visual Studio manifest.

The second stage starts with a manual validation task. This task
will pause and wait for someone to click a "Resume" or "Reject" button
that will appear on the pipeline UI. This task is configured to be
rejected after waiting for two days, but it can be manually re-ran at a
later date if we want to trigger VS insertion for an older build.

If the manual validation task is approved, a VS Drop will be created
containing all .NET 6 .msi files. This Drop URL can then be used to
update our component versions in Visual Studio. This last piece is
currently manual as we will initially be introducing new components,
however we should be able to automate VS PR creation in the future.

Commit 09f911b missed adding the
PR build check condition to a step in sign-and-notarized.yml, causing
PR builds from forks to fail. We can fix this by adding in the missing
condition.
2021-07-21 13:09:29 -04:00
Rolf Bjarne Kvinge de7f08d642
[tests/dotnet] Add .NET/Mac Catalyst test projects for dont link, link sdk and link all. (#12154)
* Add proper .NET project files for dont link, link sdk and link all. This
  includes a Mac Catalyst variant, and adding helpful Makefile targets for
  simple execution.

* Adjust various tests to work with Mac Catalyst.

* Add the new Mac Catalyst variants to xharness.

This is a partial fix for #10833.
2021-07-21 17:16:03 +02:00
Sebastien Pouliot fccd43f0c2
[dotnet][linker] Remove unused backing fields (#12001)
Problems:

* `Dispose` set the generated backing fields to `null` which means
  the linker will mark every backing fields, even if not used
  elsewhere (generally properties) inside the class

* Backing fields increase the memory footprint of the managed peer
  instance (for the type and all it's subclasses)

* Backing fields also increase the app size. Not a huge problem as
  they are all declared _weakly_ as `NSObject` but still...

Solution:

* When the linker process a `Dispose` method of an `NSObject`
  subclass with the _optimizable_ attribute then we remove the
  method body. This way the linker cannot mark the fields.

* Before saving back the assemblies we replace the cached method
  body and NOP every field that were not marked by something else
  than the `Dispose` method.

```diff
--- a.cs	2021-06-22 16:56:57.000000000 -0400
+++ b.cs	2021-06-22 16:57:00.000000000 -0400
@@ -3107,8 +3107,6 @@

 		private static readonly IntPtr class_ptr = Class.GetHandle("UIApplication");

-		private object __mt_WeakDelegate_var;
-
 		public override IntPtr ClassHandle => class_ptr;

 		[DllImport("__Internal")]
@@ -3141,9 +3139,8 @@
 		protected override void Dispose(bool P_0)
 		{
 			base.Dispose(P_0);
-			if (base.Handle == IntPtr.Zero)
+			if (!(base.Handle == IntPtr.Zero))
 			{
-				__mt_WeakDelegate_var = null;
 			}
 		}
 	}
@@ -3209,10 +3206,6 @@
 	{
 		private static readonly IntPtr class_ptr = Class.GetHandle("UIScreen");

-		private object __mt_FocusedItem_var;
-
-		private object __mt_FocusedView_var;
-
 		public override IntPtr ClassHandle => class_ptr;

 		public virtual CGRect Bounds
@@ -3242,10 +3235,8 @@
 		protected override void Dispose(bool P_0)
 		{
 			base.Dispose(P_0);
-			if (base.Handle == IntPtr.Zero)
+			if (!(base.Handle == IntPtr.Zero))
 			{
-				__mt_FocusedItem_var = null;
-				__mt_FocusedView_var = null;
 			}
 		}
 	}
@@ -3254,10 +3245,6 @@
 	{
 		private static readonly IntPtr class_ptr = Class.GetHandle("UIView");

-		private object __mt_ParentFocusEnvironment_var;
-
-		private object __mt_PreferredFocusedView_var;
-
 		public override IntPtr ClassHandle => class_ptr;

 		public virtual CGRect Bounds
@@ -3303,10 +3290,8 @@
 		protected override void Dispose(bool P_0)
 		{
 			base.Dispose(P_0);
-			if (base.Handle == IntPtr.Zero)
+			if (!(base.Handle == IntPtr.Zero))
 			{
-				__mt_ParentFocusEnvironment_var = null;
-				__mt_PreferredFocusedView_var = null;
 			}
 		}
 	}
@@ -3315,12 +3300,6 @@
 	{
 		private static readonly IntPtr class_ptr = Class.GetHandle("UIViewController");

-		private object __mt_ParentFocusEnvironment_var;
-
-		private object __mt_PreferredFocusedView_var;
-
-		private object __mt_WeakTransitioningDelegate_var;
-
 		public override IntPtr ClassHandle => class_ptr;

 		public virtual UIView View
@@ -3363,11 +3342,8 @@
 		protected override void Dispose(bool P_0)
 		{
 			base.Dispose(P_0);
-			if (base.Handle == IntPtr.Zero)
+			if (!(base.Handle == IntPtr.Zero))
 			{
-				__mt_ParentFocusEnvironment_var = null;
-				__mt_PreferredFocusedView_var = null;
-				__mt_WeakTransitioningDelegate_var = null;
 			}
 		}
 	}
@@ -3376,8 +3352,6 @@
 	{
 		private static readonly IntPtr class_ptr = Class.GetHandle("UIWindow");

-		private object __mt_WindowScene_var;
-
 		public override IntPtr ClassHandle => class_ptr;

 		public virtual UIViewController RootViewController
@@ -3411,9 +3385,8 @@
 		protected override void Dispose(bool P_0)
 		{
 			base.Dispose(P_0);
-			if (base.Handle == IntPtr.Zero)
+			if (!(base.Handle == IntPtr.Zero))
 			{
-				__mt_WindowScene_var = null;
 			}
 		}
 	}
```

* Do not consider bindings with `[Dispose (...)]` as optimizable

Injected code makes it impossible for `bgen` to decide if it's optimizable (or not)
Filed https://github.com/xamarin/xamarin-macios/issues/12150 with more details (and for other similar attributes)
2021-07-21 09:03:25 -04:00
Rolf Bjarne Kvinge c0e9ca9673 [dotnet] Remove workaround for missing bits in the Mono runtime workload. 2021-07-21 09:33:33 +02:00
Manuel de la Pena eea8142e6b
Revert "[CI] Add Prepare Release and VS Insertion stages (#12015)" (#12156)
This reverts commit 09f911b504. The comit
made changes in the logic that is used to build the PRs in public bots
meaning that all PRs fail.
2021-07-20 16:17:13 -04:00
Peter Collins 09f911b504
[CI] Add Prepare Release and VS Insertion stages (#12015)
Context: https://github.com/xamarin/yaml-templates/pull/117

Updates the .NET 6 NuGet packaging steps to exclude package metadata,
as the .msi conversion tooling does not process .nupkg file names with
the `+sha.commit` metadata.

Two new stages have been added to facilitate the Visual Studio setup
authoring process.

The first stage named "Prepare Release" will sign the .NET 6 NuGet
package content (inside and out), convert relevant packages to .msi
installers, generate Visual Studio manifests for the .msi installers,
and push the signed packages to the `xamarin-impl` feed.

The new `SignList.xml` file is required for our NuGet signing templates.

The new `xamarin-workload.props` file contains version information
and other metadata required to generate a Visual Studio manifest.

The second stage starts with a [manual validation task][0].  This task
will pause and wait for someone to click a "Resume" or "Reject" button
that will appear on the pipeline UI.  This task is configured to be
rejected after waiting for two days, but it can be manually re-ran at a
later date if we want to trigger VS insertion for an older build.

If the manual validation task is approved, a VS Drop will be created
containing all .NET 6 .msi files.  This Drop URL can then be used to
update our component versions in Visual Studio.  This last piece is
currently manual as we will initially be introducing new components,
however we should be able to automate VS PR creation in the future.

[0]: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/manual-validation?view=azure-devops&tabs=yaml
2021-07-20 17:32:43 +02:00
Rolf Bjarne Kvinge 3f3698253b [dotnet] Quote the path to the app when launching it. 2021-07-20 15:54:47 +02:00
Rolf Bjarne Kvinge a3f9519ed1 Merge remote-tracking branch 'origin/main' into HEAD 2021-07-20 14:53:57 +02:00
Rolf Bjarne Kvinge 3c38f8ccd6
[dotnet] Enable autorelease pools for threadpools. Fixes #11750. (#12060)
Fixes https://github.com/xamarin/xamarin-macios/issues/11750.
2021-07-20 14:34:37 +02:00
Rolf Bjarne Kvinge c0a7bf5a0d Merge remote-tracking branch 'origin/main' into dotnet-llvm 2021-07-19 17:07:57 +02:00
Rolf Bjarne Kvinge d59c218a71 [msbuild/dotnet] Make sure target Outputs show up in a task Output to make the build work correctly on windows. 2021-07-19 17:05:48 +02:00
Rolf Bjarne Kvinge 2014bf68c3 [tools] Compute the llvm output file and pass it to the AOT compiler / native linker 2021-07-16 17:11:14 +02:00
Rolf Bjarne Kvinge 476d35909a [msbuild/dotnet] Use properties on the _AssembliesToAOT item group to specify output paths.
This deduplicates a little bit code to compute the output path.
2021-07-16 17:11:14 +02:00
Rolf Bjarne Kvinge ce15ba272e [dotnet] Remove unused AOTCompileTaskBase.AOTData property. 2021-07-16 17:11:14 +02:00
Rolf Bjarne Kvinge 2116ba59de [tools] Pass the AOTCompiler property to the ComputeAOTArguments linker steps.
So that the ComputeAOTArguments can compute the llvm-path value to pass to the AOT
compiler (the llvm-path value states where the opt and llc command-line tools are,
and they're next to the AOT compiler).
2021-07-16 17:11:14 +02:00
Rolf Bjarne Kvinge d307a844ad
[dotnet] Enable nullability in template projects. (#12118)
And fix any warnings that came up.
2021-07-16 16:17:14 +02:00
Rolf Bjarne Kvinge d775794fd2
[dotnet] Create and parse runtimeconfig.bin when using CoreCLR. (#12122)
We need to process the runtimeconfig.json file somehow when using CoreCLR, and
the embedding API we use (coreclr_initialize) won't parse it for us. So re-use
the logic we already have to process runtimeconfig.json for MonoVM (which
involves converting it to a binary format at build time, which we then process
at runtime).
2021-07-16 16:15:17 +02:00
Rolf Bjarne Kvinge 4048b83fdd [dotnet] Parse MtouchUseLlvm. 2021-07-16 14:50:55 +02:00
Rolf Bjarne Kvinge 7ac3417ee9
[dotnet/templates/tests] Update template code. (#12109)
* Move the templates to a common subdirectory.
* Add .NET unit test to verify that all the templates build and that they have
  no warnings.
* Modify the template code to:
   * Use the UIApplication.Main overload that takes a Type.
   * Use top-level statements for the Main method to simplify code.
   * Remove a few unnecessary usings.

Partial fix for #12085.
2021-07-14 17:58:31 +02:00
Rolf Bjarne Kvinge 423bd571ec Merge remote-tracking branch 'origin/main' into darc-main-2c3dc6cd-c245-4d20-9461-75a98d067b3b 2021-07-13 14:30:18 +02:00
Rolf Bjarne Kvinge f67a47f8a6 [dotnet] Import Microsoft.NET.Runtime.MonoTargets.Sdk instead of Microsoft.NET.Runtime.RuntimeConfigParser.Task
Microsoft.NET.Runtime.RuntimeConfigParser.Task doesn't exist anymore.
2021-07-13 14:30:13 +02:00
Jonathan Peppers 33f8143b97
[dotnet] no default $(RuntimeIdentifier) for class libraries (#12093)
Context: https://github.com/dotnet/maui/pull/1578

In the latest xamarin-macios bump, the dotnent/maui build started
failing because the `$(OutputPath)` of all the projects changed from:

    bin/Debug/net6.0-ios/
    bin/Debug/net6.0-maccatalyst/

To:

    bin/Debug/net6.0-ios/iossimulator-x64/
    bin/Debug/net6.0-maccatalyst/maccatalyst-x64/

Class library projects appear to have `$(RuntimeIdentifier)` set by
default. I don't think this is needed, because class libraries do not
need to be compiled as `--self-contained` apps.

On the Android side, we only set a default `$(RuntimeIdentifiers)` for
application projects:

7c5fab1332/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets (L49-L61)

I think the correct change here is to check:

    '$(OutputType)' == 'Exe' Or '$(IsAppExtension)' == 'true'

So Apple platforms only put a default `$(RuntimeIdentifier)` for
applications or extensions.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-07-13 13:14:08 +02:00
Rolf Bjarne Kvinge 236626f3a5 Merge remote-tracking branch 'origin/main' into darc-main-2c3dc6cd-c245-4d20-9461-75a98d067b3b 2021-07-13 00:36:45 +02:00
Rolf Bjarne Kvinge 235a0f4942 [dotnet] Partially remove workaround for problems when setting the default RuntimeIdentifier. 2021-07-12 23:39:20 +02:00
Rolf Bjarne Kvinge 6074ed5c04
[dotnet] Copy fewer runtime libraries to the publish directory. (#12059)
* Don't copy runtime dylibs to the publish directory if we're linking statically.
* Don't copy static libraries to the publish directory, they're never needed at
  runtime.
2021-07-12 17:09:45 +02:00
Jonathan Peppers 5434cfd936
[dotnet] don't import RuntimeConfigParser.Task for MacCatalyst (#12083)
Context: ae5ee8f02d/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets (L30-L32)

Building dotnet/maui, I get warnings for any MacCatalyst projects:

    WorkloadManifest.targets(22,9): warning MSB4011: "C:\src\maui\bin\dotnet\packs\Microsoft.NET.Runtime.RuntimeConfigParser.Task\6.0.0-preview.6.21352.12\Sdk\Sdk.props" cannot be imported again.
    It was already imported at "C:\src\maui\bin\dotnet\sdk-manifests\6.0.100\microsoft.net.sdk.maccatalyst\WorkloadManifest.targets (8,2)". This is most likely a build authoring error. This subsequent import will be ignored.

I believe we can remove this `<Import/>` now, as the Mono workload is
doing the importing for MacCatalyst.

It appears that this is still needed for the macOS workload, however.
2021-07-12 17:08:54 +02:00
Rolf Bjarne Kvinge 9ae7d236e6
[dotnet] aotdata files go in the same directory as the assemblies. (#12058)
aotdata files go next to the assemblies, not next to the executable. This does
not make a difference for mobile platforms (because it's the same location),
but it matters for Mac Catalyst / macOS, where assemblies are not located next
to the executable.
2021-07-12 15:52:11 +02:00
Rolf Bjarne Kvinge 2f50096a09
[dotnet] Remove dead code. (#12057) 2021-07-12 15:51:45 +02:00
Jonathan Peppers 801063d7bf
[dotnet] add missing workload dependencies (#12045)
Context: 36e0432547/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in

When using the MacCatalyst workload, you hit the build error:

    error NETSDK1147: To build this project, the following workloads must be installed: microsoft-net-runtime-maccatalyst

I found an `extends` was missing in `WorkloadManifest.json`.

I also found the macOS workload needs to extend
`microsoft-net-runtime-mono-tooling`, because of its usage of
`<RuntimeConfigParserTask/>`
2021-06-30 09:50:46 +02:00
Jonathan Peppers a64b030fcc
[dotnet] shorten workload ids (#12035)
Context: https://github.com/xamarin/xamarin-android/pull/6045

We are aiming to simplify the .NET workload ids to short names like:

    dotnet workload install maui
    dotnet workload install android
    dotnet workload install ios
    dotnet workload install maccatalyst
    dotnet workload install macos
    dotnet workload install tvos

Updated the workload ids here, as well as the `.stamp-install-workloads`
make target.

Other changes:

* Updated descriptions to match Android. Still waiting on an *official*
description we should be using for each workload.

* Fixed trailing `,` that showed up as JSON errors in VS Code.
2021-06-29 16:49:39 +02:00
Rolf Bjarne Kvinge ebf6c13bd1
[dotnet] Add support for universal apps. (#11983)
Add support for universal / fat apps for iOS, macOS and Mac Catalyst.

We detect if we need to build a universal app by checking if `RuntimeIdentifiers` (plural) is set, and in that case we do a complete inner build for every `RuntimeIdentifier`, and then once those inner builds are done, we merge the resulting .app bundles together (using a new MSBuild task called `MergeAppBundles`).

When merging app bundles together, we'll run into files that exist in both apps. Depending on the file type, we do different things:

* MachO flies: lipo'ed together.
* Managed assemblies: we do a binary comparison, if the assemblies are different, we put them in a RID-specific subdirectory. At runtime we know to look for assemblies in this directory.
* runtimeconfig.bin, icudt.dat: put in a RID-specific subdirectory.
* Info.plist: computed in the outer (fat) build, the one from the inner build is ignored.
* Other files: for identical files we just copy one, otherwise we show an error.

If we run into files that are different between apps, but we should handle somehow, then we'll have to decide on a case-to-case basis what to do.

Some code shuffling was required to increase code sharing between the tools/ code, the msbuild/ code, and tests.

I've also added support for a default `RuntimeIdentifier`.

Fixes https://github.com/xamarin/xamarin-macios/issues/10294.
Fixes https://github.com/xamarin/xamarin-macios/issues/10861.
2021-06-29 11:38:04 +02:00
Rolf Bjarne Kvinge 870ffa0117
[dotnet] Use TargetDir instead of OutputPath for resolving assembly output directory. (#12021)
OutputPath is relative to the project directory, so it doesn't work when the
current directory isn't the same as the project directory.

TargetDir is an absolute directory.

Ref: #11994 / 096c75f425 (same for Mac Catalyst).
2021-06-28 14:05:09 +02:00
dotnet-maestro[bot] 761566f583
[main] Update dependencies from dotnet/installer (#11852)
* Update dependencies from https://github.com/dotnet/installer build 20210606.2

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.6.21306.2

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21304.2 (parent: Microsoft.Dotnet.Sdk.Internal

* Update dependencies from https://github.com/dotnet/installer build 20210613.2

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.6.21313.2

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21304.2 (parent: Microsoft.Dotnet.Sdk.Internal

* Update dependencies from https://github.com/dotnet/installer build 20210615.23

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.6.21315.23

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21304.2 (parent: Microsoft.Dotnet.Sdk.Internal

* Fix custom step order

In response to https://github.com/mono/linker/pull/2082

* Update dependencies from https://github.com/dotnet/installer build 20210620.4

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.7.21320.4

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21317.4 (parent: Microsoft.Dotnet.Sdk.Internal

* Update dependencies from https://github.com/dotnet/installer build 20210621.2

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.7.21321.2

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21317.4 (parent: Microsoft.Dotnet.Sdk.Internal

* Remove unnecessary workaround.

* [dotnet] Update our code to get the path to the AOT compiler. Fixes #11905.

* [dotnet] Remove another workaround for runtime packs doing the wrong thing.

* Update dependencies from https://github.com/dotnet/installer build 20210622.1

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.7.21322.1

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21321.1 (parent: Microsoft.Dotnet.Sdk.Internal

* Update dependencies from https://github.com/dotnet/installer build 20210622.8

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.7.21322.8

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21321.1 (parent: Microsoft.Dotnet.Sdk.Internal

* Update dependencies from https://github.com/dotnet/installer build 20210623.2

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.7.21323.2

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21321.1 (parent: Microsoft.Dotnet.Sdk.Internal

* Update dependencies from https://github.com/dotnet/installer build 20210623.11

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.7.21323.11

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21321.1 (parent: Microsoft.Dotnet.Sdk.Internal

* Update dependencies from https://github.com/dotnet/installer build 20210624.6

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.7.21324.6

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21321.1 (parent: Microsoft.Dotnet.Sdk.Internal

* [dotnet] Install the microsoft-net-runtime-maccatalyst workload as well.

* Update dependencies from https://github.com/dotnet/installer build 20210625.1

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.7.21325.1

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21321.1 (parent: Microsoft.Dotnet.Sdk.Internal

* Update dependencies from https://github.com/dotnet/installer build 20210626.4

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.6.21280.2 -> To Version 6.0.100-preview.7.21326.4

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-preview.6.21277.2 -> To Version 6.0.100-preview.6.21322.1 (parent: Microsoft.Dotnet.Sdk.Internal

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Sven Boemer <sbomer@gmail.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-06-28 13:58:33 +02:00
Rolf Bjarne Kvinge fe1b2386bd
[dotnet] Fix launching macOS and Mac Catalyst apps with arguments. (#12019)
When we're using 'open' to launch apps, we need to use '--args ...' to pass any additional argument to the app, because otherwise 'open' will try to open those arguments as if they were files:

```
$ open "/Applications/Sublime Text.app" helloworld
The file /Users/rolf/test/helloworld does not exist.
```

(and doesn't launch Sublime Text).

while this works:

```
$ open "/Applications/Sublime Text.app" --args helloworld
```

in that it opens Sublime Text.

It's also possible to not append any other arguments, so this:

```
$ open "/Applications/Sublime Text.app" --args
```

while it looks weird, it works just fine.

Ref: https://github.com/dotnet/sdk/issues/18437
2021-06-25 16:53:13 +02:00
Jonathan Peppers 69698bea36
[dotnet] use copyOnly for .png files in templates (#12016)
Context: https://github.com/dotnet/templating/issues/3325
Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation

In current .NET 6 Preview 6 builds, there is an issue if a template
includes a binary file larger than ~8kb, it seems to get truncated when
`dotnet new` extracts the template.

A workaround is to use the `copyOnly` feature for binary files. Really,
we should be doing this anyway, because otherwise the templating system
considers replacing *text* in these binary files. It improves
performance to do this and would hopefully prevent a future bug of
random bytes getting replaced.
2021-06-25 08:18:56 +02:00
Rolf Bjarne Kvinge 6d6db24de4 [dotnet] Use relative paths in a few places.
To not cause problems on Windows.
2021-06-24 17:39:40 +02:00
Rolf Bjarne Kvinge 3497373b4d [dotnet] Compute 'ComputedPlatform' correctly for outer multi-rid builds as well. 2021-06-24 14:40:41 +02:00
Rolf Bjarne Kvinge 1fa1cf3650 [dotnet] Use the correct relative paths for Info.plist for all platforms.
Fixes this error:

> Unable to merge the file 'Contents/Info.plist', it's different between the input app bundles.
2021-06-24 11:59:35 +02:00
Rolf Bjarne Kvinge c5dad31fd0 [dotnet] Don't create debug settings / configurations for inner builds.
Fixes this error:

> error : Unable to merge the file 'Contents/Resources/MonoTouchDebugConfiguration.txt', it's different between the input app bundles.
2021-06-24 11:56:56 +02:00
Rolf Bjarne Kvinge 7f505c35d5 [dotnet] Rework how we compute the TargetArchitectures property.
Add a _MapRuntimeIdentifierToTargetArchitecture target that computes the
TargetArchitectures property from either the RuntimeIdentifier or
the RuntimeIdentifiers properties.

Also make sure this target is executed before _ComputeTargetArchitectures.

This is required so that we have a correct TargetArchitectures value for
multi-rid builds when compiling the app manifest (Info.plist).
2021-06-23 18:38:46 +02:00
Rolf Bjarne Kvinge e68831b560 [dotnet] Compile the app manifest in the outer build for multi-rid apps.
We're already not copying the Info.plists from the input app bundles.

The Info.plist file is computed differently, depending on the architecture(s), which
means we only know enough to compute it when building the outer app bundle.
2021-06-23 18:38:46 +02:00
Rolf Bjarne Kvinge a78be0af4e [dotnet] Ignore Info.plist files from the input app bundles when merging app bundles. 2021-06-23 18:38:46 +02:00
Rolf Bjarne Kvinge 608dfb37bc [dotnet] Make the globalization data file an architecture-specific file.
This was adapted from https://github.com/xamarin/xamarin-macios/pull/11320.
2021-06-23 18:38:46 +02:00
Rolf Bjarne Kvinge 2a203b53bb [msbuild] Compute input files slightly differently for CreateMergedAppBundle.
So that MSBuild doesn't execute CreateMergedAppBundle twice, each time with a
different input.
2021-06-23 18:38:46 +02:00
Rolf Bjarne Kvinge 889cf99b74 [dotnet] Compile entitlements before signing the merged app bundle. 2021-06-23 18:38:46 +02:00
Rolf Bjarne Kvinge 70d0f86099 Merge remote-tracking branch 'origin/main' into HEAD 2021-06-23 18:38:43 +02:00
Yusuke Yamada 096c75f425
[dotnet] Normalize run target assembly path on the Run target for Mac Catalyst (#11994)
* [dotnet] Normalize run target assembly path on the Run target for Mac Catalyst

* Use TargetPath instead of OutputPath for resolving assembly output directory
2021-06-23 14:40:28 +02:00
Rolf Bjarne Kvinge 5417f2e338
[dotnet] Only limit the default inclusion items with a condition on 'EnableDefault<Platform>Items'. Fixes #11990. (#11991)
* This is the way Android does it:
  15b40af7d6/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/Sdk/AutoImport.props (L23)
* Makes it easier for the default inclusion logic to be used by
  Xamarin.Legacy.Sdk (as explained in the fixed issue).

Fixes https://github.com/xamarin/xamarin-macios/issues/11990.
2021-06-22 15:52:50 +02:00
Rolf Bjarne Kvinge 7179cac047 [dotnet] Set the default RuntimeIdentifier earlier. 2021-06-21 13:24:49 +02:00
Rolf Bjarne Kvinge 81b139eab0 [dotnet] Ignore RuntimeIdentifier if RuntimeIdentifiers is set.
It's not clear what we're supposed to do if both RuntimeIdentifier and
RuntimeIdentifiers are set, so just handle this case as if only
RuntimeIdentifiers is set, by clearing out the RuntimeIdentifier value.

Also show a warning for this scenario.
2021-06-18 10:34:35 +02:00
Rolf Bjarne Kvinge 91311a0d55 [dotnet] Implement support for multiple RuntimeIdentifiers.
* Do an inner build per RuntimeIdentifier.
* In the outer build, execute the new MergeAppBundles task to
  merge the resulting app bundles from the inner builds.
2021-06-18 10:34:35 +02:00
Rolf Bjarne Kvinge 003cf30812 [dotnet] Don't execute ComputeResolvedFileToPublishList if we're in the outer build of a multi-rid build.
There's nothing to publish (except the merged app bundle, which we'll handle ourselves).
2021-06-18 10:34:35 +02:00
Rolf Bjarne Kvinge 724d0fe1b3 [dotnet] Set a default RuntimeIdentifier and validate that we get a valid RuntimeIdentifier. Fixes #10861.
Also add tests:

* Remove RuntimeIdentifier from a few sample projects. These projects should
  continue to build just fine.
* Add tests for invalid RuntimeIdentifiers.

Fixes https://github.com/xamarin/xamarin-macios/issues/10861.
2021-06-18 10:34:35 +02:00
Rolf Bjarne Kvinge 6fe54cb7f2 [dotnet] Only trim when building a specific RuntimeIdentifier. 2021-06-18 10:24:28 +02:00
Rolf Bjarne Kvinge 8766976b49
Remove the option of disabling the windows-specific part of the .NET build. (#11971)
* Having .NET enabled with the windows-specific parts disabled is not a
  scenario tested on CI (where we've always enabled both). This means it's
  prone to bitrotting.
* It's another configuration to keep track of and make work locally.
* It doesn't work right now anyway.

So just always enable the windows-specific parts of the .NET build, if the
.NET build is enabled.
2021-06-17 19:55:55 +02:00
Rolf Bjarne Kvinge c8e854c151
[dotnet] Add support for generating a binary version of runtimeconfig.json. Fixes #11745. (#11887)
Use Mono's RuntimeConfigParserTask to parse the *.runtimeconfig.json file and
produce a binary version of it.

This also means implementing support for finding the on-disk location of the
file at runtime, and passing it to mono.

Ref: 01b7e73cd3/docs/design/mono/mobile-runtimeconfig-json.md

Fixes https://github.com/xamarin/xamarin-macios/issues/11745.
2021-06-16 15:22:02 +02:00
Sven Boemer 045ccaf3a6
Fixes for .NET 6 linker (#11739)
* Pass custom steps separately from msbuild

* Remove reflection over linker pipeline

* Fix ListExportedSymbols ctor

* Add CoreTypeMapStep

* PR feedback

- Avoid unnecessary tracking of loaded assemblies
   (Use GetLoadedAssembly instead)
- Create extension method on LinkContext
   to avoid conditional code
- Rename dispatchers to reflect when they run

* Fix PreMarkDispatcher

* Fix DoneStep ordering

* Fix other order-dependent steps, test asserts

* Handle cyclic assembly references

* Simplify reference search

By using the already-loaded Assembly closure

* Fix warning number

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

* PR feedback

- Undo whitespace changes
- Move comment to a more appropriate place

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-06-14 20:10:29 -04:00
Rolf Bjarne Kvinge 5b15159fc0
[dotnet] Try to implement a workaround for xamarin/maccore#2427. (#11897)
We randomly run into a NuGet restore failure, which breaks the build, and is
quite annoying.

This might be due to a problem with multiple simultaneous restores, so this is
an attempt to first restore the packages we need, in a single serialized
restore, and once that's done we can process everything else in parallel.

Ref: https://github.com/xamarin/maccore/issues/2427
Ref: https://github.com/NuGet/Home/issues/10935
2021-06-11 15:22:31 +02:00
Rolf Bjarne Kvinge 8ca5d5ea5c
[dotnet] The MSBuildProjectDirectory variable doesn't contain a trailing slash, so make sure we always add one. (#11880) 2021-06-10 08:55:03 +02:00
Rolf Bjarne Kvinge 233497d791
[dotnet] Create binlogs when creating NuGets. (#11874)
Makes diagnostics easier when something goes wrong.
2021-06-09 19:22:29 +02:00
Rolf Bjarne Kvinge c79f1d626c
[dotnet] Add a data/UnixFilePermissions.xml file to the sdk packs. Fixes #11860. (#11869)
NuGet doesn't support preserving the executable bit for files in *.nupkgs
(which are just zip files), so .NET implemented a [temporary
workaround](https://github.com/dotnet/sdk/pull/17299) for workload installs,
where they hardcoded files that should be executable.

This isn't really sustainable, and they'll remove their workaround, so we need
to use their supported method of specifying the file permissions: a
data/UnixFilePermissions.xml file.

Fixes https://github.com/xamarin/xamarin-macios/issues/11860.
2021-06-09 07:54:18 +02:00
VS MobileTools Engineering Service 2 941d2d75e8
[dotnet] Fix the path to the workloads in one more location. (#11867)
This fixes a regression where the data/WorkloadManifest.* files were missing
from the Microsoft.NET.Sdk.<platform>.Manifest-6.0.100.<version> NuGets.

Updated contents are now:

    $ unzip -l nupkgs/Microsoft.NET.Sdk.iOS.Manifest-6.0.100.*sha*.nupkg
    Archive:  nupkgs/Microsoft.NET.Sdk.iOS.Manifest-6.0.100.14.5.100-preview.5.891+sha.130c40321.nupkg
      Length      Date    Time    Name
    ---------  ---------- -----   ----
          528  06-08-2021 20:38   _rels/.rels
          845  06-08-2021 20:38   Microsoft.NET.Sdk.iOS.Manifest-6.0.100.nuspec
         6434  09-27-2016 14:08   LICENSE
          656  06-08-2021 18:36   data/WorkloadManifest.json
          645  06-02-2021 06:24   data/WorkloadManifest.targets
          594  06-08-2021 20:38   [Content_Types].xml
          664  06-08-2021 20:38   package/services/metadata/core-properties/be25c66390ef48fa911d2e7a3f184c3c.psmdcp
    ---------                     -------
        10366                     7 files

Regressed in: e4e57c703f

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-06-09 07:53:37 +02:00
Jonathan Peppers 9dc24c721e
[dotnet] add @(SdkSupportedTargetPlatformIdentifier) (#11859)
Context: https://github.com/dotnet/sdk/pull/16208/files
Context: https://gist.github.com/sfoslund/12e1daff114bccc8a29ebb441bc461a5#detecting-installed-platforms
Context: https://github.com/xamarin/xamarin-android/issues/5941

The VS ProjectSystem needs a way to know during MSBuild evaluation
which platforms are supported by a workload--even if the workload is
not actually installed.

On Android, for example, we added the item group:

    <SdkSupportedTargetPlatformIdentifier Include="android" DisplayName="Android" />

This enables the IDE to know that Android is supported.

In this repo, we need to make this change for the iOS, MacCatalyst,
macOS, and tvOS workloads.
2021-06-08 07:56:27 +02:00
Rolf Bjarne Kvinge 8460ce6676
[dotnet] Only publish a single libxamarin-dotnet*.dylib file. (#11801)
Remove all the other ones from ResolvedFileToPublish.
2021-06-07 08:37:23 +02:00
Rolf Bjarne Kvinge 7ac5b95bd7
[dotnet] Remove workaround for dotnet/runtime issue with incorrect dylibs. (#11815)
The runtime issue has been fixed for a while now, so we don't need the
workaround anymore.

Ref: https://github.com/dotnet/runtime/issues/34637
2021-06-07 08:35:17 +02:00
Rolf Bjarne Kvinge 0c28f7f060
[dotnet] It's x86, not x84. (#11816) 2021-06-07 08:34:56 +02:00
Rolf Bjarne Kvinge fd500dc53c
Mono changed the location of the AOT compiler, so we have to update our code accordingly. (#11789)
* [tests] Augment the .NET unit tests to verify that more runtime identifiers build.

* [dotnet] Show a better error if the AOT compiler doesn't exist.

* [dotnet] Use the official path for the AOT compiler.

* [dotnet] Use platform-specific templates for WorkloadManifest.json.

* [dotnet] Generate the workload targets before the nupkgs.

This avoids a random build failure when doing parallel make.

* [builds] Install the runtime workloads for iOS and tvOS so that we have the AOT compilers downloaded for our local tests.

* [dotnet] Make the iOS and tvOS workloads load the AOT compiler packages from Mono.

* [dotnet] Move the workloads into a common subdirectory.

Also delete the watchOS workload, we're not shipping it for now.

* [dotnet] Set DOTNETSDK_WORKLOAD_MANIFEST_ROOTS when install workloads to get our local ones.

* Set DOTNETSDK_WORKLOAD_MANIFEST_ROOTS to where our local workloads are to use them when installing our locally built workloads into .NET (the local one).
* Stop installing workloads from builds/

* Get NuGet.config with local feed, and make sure those feed contain local build before running 'workload install'.

* Fix makefile logic.

* Another tweak.
2021-06-04 08:34:32 +02:00
Rolf Bjarne Kvinge 863a3dd2d3
[dotnet] Make sure to set CopyToPublishDirectory=PreserveNewest on files we add to 'ResolvedFileToPublish'. Fixes #11611. (#11797)
Make sure to set CopyToPublishDirectory=PreserveNewest on files we add to
'ResolvedFileToPublish', so that they're not copied unnecessarily (in the case
of the native executable it would also remove the code signature).

Fixes https://github.com/xamarin/xamarin-macios/issues/11611.
2021-06-03 18:43:13 +02:00
Rolf Bjarne Kvinge 71a0659207
[dotnet] Tell .NET to not generate files we don't need. Fixes #9687. (#11693)
Tell .NET to not generate files we don't need:

* Dependency file (*.deps.json).
* Reference assemblies for executable projects.

Fixes https://github.com/xamarin/xamarin-macios/issues/9687.
2021-05-31 18:06:42 +02:00
Jonathan Peppers 7bf450b987
[dotnet] publishing settings for NuGet.org (#11687)
* [dotnet] publishing settings for NuGet.org

Context: https://github.com/xamarin/xamarin-android/pull/5948

Microsoft has rules for submitting signed NuGet packages with the
namespace `Microsoft.*` under the Microsoft + Xamarin organizations.

Some of these rules include:

* Package must be signed.
* Must include a license.
* `$(Authors)` should be `Microsoft`
* `$(PackageProjectUrl)` can't be blank.
* `$(Copyright)` must *exactly* say `© Microsoft Corporation. All rights reserved.`

If any of these are wrong, you'll get errors during `nuget push` such as:

    Response status code does not indicate success:
    400 (The package is not compliant with metadata requirements for Microsoft packages on NuGet.org.
    Go to https://aka.ms/Microsoft-NuGet-Compliance for more information.
    Policy violations: The package metadata is missing required ProjectUrl.

We used a script to fix up these values and resign for .NET 6 Preview
4. This was painful but got us by for the current release.

Going forward, we should just fill out these values for .NET 6 .nupkg
files.

* Forgot $(PackageLicenseFile)
2021-05-26 21:35:05 +02:00
Rolf Bjarne Kvinge aa7e9d06d1
[configure] Add option to use a locally built dotnet/runtime. (#11643)
* Add a configure option to use a locally built dotnet/runtime.
* Add documentation how to build dotnet/runtime the way we need it built.
* Modify our build to consume the custom dotnet/runtime if so configured.

This is useful when trying to debug the runtime locally, or trying out new
features there are no packages for yet.

Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
2021-05-21 22:18:25 +02:00
Rolf Bjarne Kvinge 2d412041cb Merge remote-tracking branch 'origin/main' into issue-11061 2021-05-19 17:40:30 +02:00
Rolf Bjarne Kvinge 8b868607aa Pass the resolved native references to the LinkNativeCode task.
This makes xcframeworks work.
2021-05-19 17:32:43 +02:00
Rolf Bjarne Kvinge 94196bf767
[dotnet] Don't use an Output property to retrieve the list of native object files to link. (#11592)
If the task that creates the native object files doesn't execute (because the
native object files already exists and are up-to-date), the resulting list of
native object files to link will be empty.

This typically happens for a rebuild: if a native linker error occurs when
linking the main executable, building again will result in a successful build,
because we wouldn't try to link the main executable again.
2021-05-18 15:13:40 +02:00
Rolf Bjarne Kvinge e8678d5f1e [msbuild/dotnet] Add support for NativeReference items. Fixes #11061.
* Pass any native references to the LinkNativeCode task so that they're linked
  with the main executable.
* Copy frameworks and dynamic libraries to the app bundle (also add support for
  MSBuild metadata - the CopyToAppBundle property - to avoid copying a framework
  / dynamic library to the app bundle).
* Add tests.

Fixes https://github.com/xamarin/xamarin-macios/issues/11061.
2021-05-18 09:11:31 +02:00
Jonathan Peppers cb96817f07
[dotnet] rename workload to Microsoft.NET.Sdk._platform_.Manifest-6.0.100 (#11436)
* [dotnet] rename workload to Microsoft.NET.Sdk._platform_.Manifest-6.0.100

Context: https://github.com/dotnet/designs/pull/188/files#diff-8fcaa29d8e6f00b34b3cb1830d93f33e75f04424780a66a3c658c7021048e74fR125
Context: https://github.com/xamarin/xamarin-android/pull/5898

The `$(PackageId)` of our workload `.nupkg` needs to be:

    Microsoft.NET.Sdk._platform_.Manifest-6.0.100

While the `$(PackageVersion)` remains the same as before.

The layout on disk will change to:

    dotnet\sdk-manifests\6.0.100\Microsoft.NET.Sdk._platform_\
        WorkloadManifest.json
        WorkloadManifest.targets

Note that `.Manifest` and `-6.0.100` are not in the folder name on disk.

At the same time, let's also update the `version` in
`WorkloadManifest.json` so it contains the proper version for our
workload. This used to not be possible because `version` was a `long`,
but it now is a `string` where we can put our version.

* Use $(DOTNET6_VERSION_BAND)

* Pass in -p:VersionBand to 'dotnet pack'
2021-05-06 07:46:01 +02:00
Emanuel Fernandez Dell'Oca d5f1671184
[dotnet] Fix _DetectSdkLocations from Windows (#11451)
This task ends up setting as env variable the Xamarin Sdk root directory on the Mac, but when building from Windows it was setting the Windows path, so instead we need to override it with the proper value on macOS.

This should not change the original behavior when building from macOS.
2021-05-06 07:42:43 +02:00
Rolf Bjarne Kvinge 6225cac669
[msbuild/dotnet] Fix build logic when using .NET to not try to use nor require any version of installed Xamarin.iOS/Xamarin.Mac. Fixes #10827. (#11433)
* [dotnet] Ship the buildinfo file.

* [msbuild/dotnet] Fix build logic when using .NET to not try to use nor require any version of installed Xamarin.iOS/Xamarin.Mac. Fixes #10827.

We do this by setting the _XamarinSdkRoot variable in our .NET logic, which
our existing shared build logic reads, passes to the DetectSdkLocations task,
and then sets our override environment variable
(MD_MTOUCH_SDK_ROOT/XAMMAC_FRAMEWORK_PATH) to the install location, so that
existing code (which honors the override variable) continues to work as-is.

Fixes https://github.com/xamarin/xamarin-macios/issues/10827.
2021-05-04 21:36:48 -04:00
Sebastien Pouliot 5ef7fb2784
[dotnet][msbuild] Strip symbols from native executable (#11378)
We have to consider (setup and process) `libSystem.Globalization.Native`
in order not to remove the required symbols when stripping the native
executable.

Ignore `libSystem.Globalization.Native` for dotnet / catalyst
ref: https://github.com/xamarin/xamarin-macios/issues/11392
2021-05-02 15:06:11 -04:00
Rolf Bjarne Kvinge 6f743fd292
[build] Skip building stuff that isn't enabled. (#11385) 2021-04-30 07:51:58 +02:00
Alexander Köplinger d7d69a6bf8
[dotnet][msbuild] Fix property for native http handler (#11388)
We were documenting the wrong name (fix in https://github.com/dotnet/runtime/pull/52055) which lead Sebastien to change it to the wrong one in 095b7e1105
2021-04-29 15:40:41 -04:00
Sebastien Pouliot 8679482cc0
[dotnet] Fix release builds on devices (#11367)
Fixed by removal of
```
<InvariantGlobalization Condition="'$(InvariantGlobalization)' == ''">false</InvariantGlobalization>
```
which is (should be) the default.

All our local usage compare with it with `true` so this likely comes from
somewhere else (sdk / runtime).

It does not really have a huge impact on build size (and the small diff
is probably the source of the crash)

* fails (17,479,981): https://gist.github.com/spouliot/6f8defb8f940e68314ba167ea76dc9bf
* works (17,502,741): https://gist.github.com/spouliot/d06f0b1b95e114fe469ce49081c70e33

Also fix target to run a release (no debug) build, which is more helpful
"out of the box" :)

Tracking issue with: https://github.com/xamarin/xamarin-macios/issues/11366
2021-04-29 09:44:14 -04:00
Rolf Bjarne Kvinge 8cb8fd9a32
[dotnet] Fix casing for ARM64 architecture. (#11350) 2021-04-28 07:41:35 +02:00
Rolf Bjarne Kvinge e4960ad9e3
[dotnet] Build the partial static registrar for CoreCLR. (#11345)
* The generated static registration code will eventually be different.
* The generated code has to be compiled with different compiler flags.

This also required adding a new overload of xamarin_mono_object_release for the generated
code to compile.
2021-04-28 07:34:40 +02:00
Peter Collins b88c3bb031
[build] Create Microsoft.iOS.Windows.Sdk workload pack (#11251)
Converts the Microsoft.iOS.Windows.Sdk NuGet package into a proper
[workload SDK pack][0].  The entry point for this pack has been changed,
and it is now imported through the `WorkloadManifest.targets` file
included in `Microsoft.NET.Workload.iOS`, rather than being imported
directly from `Microsoft.iOS.Sdk`.

Import ordering has otherwise changed slightly.  The following files are
now imported before the majority of the `Microsoft.iOS.Sdk` (and the 
majority of the .NET SDK targets):

 * Xamarin.iOS.Common.Before.props
 * Xamarin.iOS.Common.Before.targets

After this the majority of the .NET SDK targets will load, followed by
the `Microsoft.iOS.Sdk` targets. Finally, everything declared in the
`<AfterMicrosoftNETSdkTargets/>` hook loads, which consists of:

 * Microsoft.iOS.Windows.Sdk.targets
 * tools/msbuild/*

[0]: https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workload-manifest.md#sdk-packs

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-04-27 07:44:51 +02:00
Jonathan Peppers b1080ee9bf
[catalyst] remove splash screens (#11300)
Context: https://github.com/dotnet/maui/pull/807

When implementing a new `@(MauiSplashScreen)` feature for .NET MAUI, I
found out that Catalyst doesn't have support for splash screens.

I even tested this in Xcode:

* Create a new Objective-C iOS app
* Make `LaunchScreen.storyboard` red and `Main.storyboard` green.
* Check the new `macOS` checkbox in project settings to enable
  Catalyst and be a multiplatform app.

I see red, then green on iOS but only green on macOS. I think Catalyst
completely ignores `UILaunchStoryboardName`.

This removes splash screens from the `dotnet new maccatalyst` template
as well as the `MyCatalystApp` sample project.
2021-04-23 07:38:05 +02:00
Sebastien Pouliot 095b7e1105
[dotnet] Enable more trimming switches (#11295)
Documentation
https://github.com/dotnet/runtime/blob/main/docs/workflow/trimming/feature-switches.md

Very small effect on the final app size.

Before
https://gist.github.com/spouliot/9f6fa4f15c117149905141f80fbad399

After
https://gist.github.com/spouliot/c9cefac8aa77c8c68edb9bbc77f553d0
2021-04-22 20:37:02 -04:00
Filip Navara be14188892
Use the SDK UseMonoRuntime property instead of _XamarinRuntime in MSBuild (#11255)
* Use the SDK UseMonoRuntime property instead of _XamarinRuntime in MSBuild

* Fix typo

* Update Xamarin.Shared.Sdk.targets

Mono -> MonoVM
2021-04-22 16:02:56 +02:00
Peter Collins 7a5c28f6cc
[msbuild] Rename $(_UsingXamarinSdk) to $(UsingAppleNETSdk) (#11270)
The `$(_UsingXamarinSdk)` property has been renamed to help improve
external usability.  This change increases parity with the Android SDK,
which currently defines `$(UsingAndroidNETSdk)` for internal and
external use.
2021-04-21 21:32:33 -04:00
Sebastien Pouliot 5accd102cf
[dotnet][tvos] Enable ICU (instead of using Invariant) and additional tests (#11247) 2021-04-21 20:19:05 -04:00
dotnet-maestro[bot] e8f437319a
[main] Update dependencies from dotnet/installer (#11175)
* Update dependencies from https://github.com/dotnet/installer build 20210408.1

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21208.1

* Update dependencies from https://github.com/dotnet/installer build 20210409.4

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21209.4

* Update dependencies from https://github.com/dotnet/installer build 20210410.1

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21210.1

* same P4 specific fix as ccb43cba56
but the ICU support was added based on P3 but merged after ^

* Update dependencies from https://github.com/dotnet/installer build 20210412.5

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21212.5

* Update dependencies from https://github.com/dotnet/installer build 20210413.70

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21213.70

* Update dependencies from https://github.com/dotnet/installer build 20210414.14

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21214.14

* Update to new package names

Thanks @pjcollins for the heads up https://github.com/xamarin/xamarin-macios/pull/11175#issuecomment-819936692

* Update dependencies from https://github.com/dotnet/installer build 20210415.1

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21215.1

* Fix build (path changed to include '.mono')

* remove more '.mono' special case that are not needed anymore

* Update dependencies from https://github.com/dotnet/installer build 20210415.12

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21215.12

* Fix building apps (it now finds the native libs)

Credits to @filipnavara

8325f8dadc

* Add back IsTrimmable (or nothing gets linked)

* Update dependencies from https://github.com/dotnet/installer build 20210418.6

Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-preview.3.21202.5 -> To Version 6.0.100-preview.4.21218.6

* Keep downloading the CoreCLR runtime packs.

* [runtime] Adjust the build to link with the correct runtime library for CoreCLR.

* [tests][monotouch-test] Ignore NSTimeZoneTest / All_28300 on dotnet as it hangs

Introduced with https://github.com/dotnet/runtime/pull/48931

Issue https://unicode-org.atlassian.net/browse/ICU-21591
PR https://github.com/unicode-org/icu/pull/1699

* [dotnet][msbuild] Add more (missing) '\'

Fix satellite/location assemblies and some unit tests

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Alex Soto <alex@alexsoto.me>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@gmail.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-04-20 09:09:56 -04:00
Sebastien Pouliot 289053b1e3
[dotnet] Use `[AssemblyMetadata ("IsTrimmable", "True")]` in platforms assemblies (#11228)
Fix https://github.com/xamarin/xamarin-macios/issues/10673
2021-04-16 15:08:19 -04:00
Sebastien Pouliot 7926009d7e
[dotnet][msbuild] Copy dylibs for macOS and Mac Catalyst (#11226)
Fix crash for monotouch-test running on macOS / dotnet

Fix https://github.com/xamarin/maccore/issues/2413
2021-04-16 09:59:21 -04:00
Jonathan Peppers 3b890b2d4b
[dotnet] move WorkloadManifest.* files to /data/ folder (#11221)
Context: https://github.com/dotnet/designs/pull/188/files#diff-8fcaa29d8e6f00b34b3cb1830d93f33e75f04424780a66a3c658c7021048e74fR125

The future `dotnet workload install` commands will be expecting that
the `.nupkg` for a workload will contain:

* `data/WorkloadManifest.json`
* `data/WorkloadManifest.targets`

This was done so that we don't interfere with NuGet's spec for layout
of a `.nupkg` file. You are allowed to put whatever you like in a
`/data/` folder.

The layout on disk in `/usr/local/share/dotnet`, etc. is unchanged, so
we don't need any changes to our installers, etc.

Android side:

https://github.com/xamarin/xamarin-android/pull/5843
2021-04-15 17:18:40 -04:00
Peter Collins 2dc113ea28
[CI] Upload build asset data to darc/maestro (#11189) 2021-04-14 17:34:30 -04:00
Sebastien Pouliot 2111ba32fc
[dotnet][msbuild] Stop publishing dylibs in release builds (#11210)
With https://github.com/xamarin/xamarin-macios/pull/11158 we do not
load symbols from the dylibs - so we do not have to ship them.

This makes the size comparison, between legacy and dotnet, more accurate
since the dylibs were large binaries.

https://gist.github.com/spouliot/9cad974b73b982404421e634f2a3a2b7
2021-04-14 16:43:14 -04:00
Sebastien Pouliot f85af095da
[dotnet] Add ICU support for iOS builds (#11163)
and re-enable some tests for dotnet

Part of the fix for https://github.com/xamarin/xamarin-macios/issues/8906

Known Issues
* [some Calendar are not the expected ones](https://github.com/dotnet/runtime/issues/50859)
* [No support for tvOS (bitcode)](https://github.com/dotnet/runtime/issues/48508)
2021-04-09 17:06:26 -04:00
Sebastien Pouliot ccb43cba56
[dotnet][msbuild] Fix RelativePath inside ResolvedFileToPublish (#11173)
This worked fine up to P3 but failed with an early bump [1] to P4
where paths became invalid (missing a `/`) like:

`bin/iPhoneSimulator/Debug/net6.0-ios/iossimulator-x64/publish/../dont link.applibxamarin-dotnet-debug.dylib`

and did not copy the required `.dylib` [2] (and other stuff) inside the
app bundle.

[1] https://github.com/xamarin/xamarin-macios/pull/11127
[2] .dylib where the first thing to crash at startup

```
Termination Reason:    DYLD, [0x1] Library missing

Application Specific Information:
dyld: launch, loading dependent libraries
DYLD_SHARED_CACHE_DIR=/Users/builder/Library/Developer/CoreSimulator/Caches/dyld/19G2021/com.apple.CoreSimulator.SimRuntime.iOS-14-4.18D46
DYLD_ROOT_PATH=/Applications/Xcode_12.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
DYLD_FALLBACK_FRAMEWORK_PATH=/Applications/Xcode_12.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks
DYLD_FALLBACK_LIBRARY_PATH=/Applications/Xcode_12.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib

Dyld Error Message:
  dyld: Using shared cache: C11E5D38-A0B0-37FA-AECD-28B337F6C0CA
Library not loaded: @rpath/libxamarin-dotnet-debug.dylib
  Referenced from: /Users/USER/Library/Developer/CoreSimulator/Devices/B3F9E3AC-227F-4B66-9F12-76C5B2CE4E34/data/Containers/Bundle/Application/379106D5-912C-47CC-A0E5-446C7C524706/dont link.app/dont link
  Reason: image not found
```
2021-04-09 08:37:15 -04:00
Sebastien Pouliot 578a80cbe1
[dotnet][msbuild] Do not copy `.pdb` files inside `.app` for release builds (#11153)
The original goal was to remove the `.dylib` from the app bundle.
However some are required, even in release, so that will need to be
fixed first [1]

[1] https://github.com/xamarin/xamarin-macios/issues/11145
2021-04-08 09:09:24 -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
Jonathan Peppers 5e18eae0ca
[dotnet] suppress IL2026 linker warning (#11043)
We started using `$(SuppressTrimAnalysisWarnings)` by default, because
ILLink started emitting warnings by default in .NET 6 Preview 3.

7bf3e8d8 fixed *most* of these warnings except for `IL2026`:

16aedd6e72/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ILLink.targets (L52-L57)

I get around 20 instances of this warning when building dotnet/maui.

`IL2026` occurs because this logic is evaluated much earlier than the
`PrepareForILLink` MSBuild target:

16aedd6e72/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ILLink.targets (L202)

The MSBuild evaluation order right now is:

* Sdk/Sdk.props
* Microsoft.[platform].Sdk.props
* Xamarin.Shared.Sdk.props
* Microsoft.NET.ILLink.targets
* Microsoft.[platform].Sdk.targets
* Xamarin.Shared.Sdk.targets

We need to set `$(SuppressTrimAnalysisWarnings)` earlier in
`Xamarin.Shared.Sdk.props` to solve the issue here.

On the Android side I got lucky, and it worked first try without
thinking too much. We import a `*.DefaultProperties.targets` before
`Microsoft.NET.ILLink.targets`, and that is why it worked.
2021-03-31 09:07:02 -05:00
Jonathan Peppers 7bf3e8d83a
[dotnet] default $(SuppressTrimAnalysisWarnings) to true (#10970)
Fixes: https://github.com/xamarin/xamarin-macios/issues/10887

After bumping to .NET 6 Preview 3, we get hundreds of ILLINK warnings.
This is because of:

https://github.com/dotnet/sdk/pull/16327

We need to default `$(SuppressTrimAnalysisWarnings)` to ignore these
warnings for now.

We should continue to use `TrimMode=link`, as that is the behavior
Xamarin developers get today.
2021-03-26 13:50:35 -05:00
Rolf Bjarne Kvinge c8b6bc6c85
[dotnet] Build macOS/.NET for ARM64 as well. (#10959)
Partial fix for #10959.
2021-03-25 07:26:48 +01:00
Rolf Bjarne Kvinge 1da2d452dd
[msbuild/dotnet] Add support for parsing --setenv from bundler arguments. (#10896)
Add support for parsing --setenv from bundler arguments and passing them to
dotnet-linker so that the environment variables can be baked into the app at
launch (like they would be for mtouch/mmp).
2021-03-18 15:15:02 +01:00
Rolf Bjarne Kvinge 32e4d05195
[dotnet] Add support for specifying the VM with the _XamarinRuntime property. (#10881)
Use a private property (prefixed with underscore) for now, until we can decide
on a better/general name.

Also add a variation to xharness to build monotouch-test with CoreCLR
(building works fine, but it crashes at startup, which is expected at this
point).
2021-03-16 18:32:04 +01:00
Juan Marcelo Tondato d13caa504f
[msbuild] make a way to keep LaunchProfile capability (#10868)
`$(_KeepLaunchProfiles)` will be defined on single projects to use `LaunchProfiles` capability required on VisualStudio, see:

https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1291515

When a single-project is loaded on VisualStudio, to enable the switch between target frameworks the LaunchProfiles capability need to be enabled.

By default, it is enabled but this capability is removed by our SDKs because the HEAD projects (Android and iOS) does not use this IDE feature to display devices on the start button.

`$(_KeepLaunchProfiles)` property avoids that removal in order to have LaunchProfiles enabled on VisualStudio.

MAUI targets adds `$(_KeepLaunchProfiles)` with the value true to enable it for single-project.
2021-03-15 16:35:50 -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
Jonathan Peppers 98c8649d0c
[dotnet] remove +sha from templates in installers (#10816)
I noticed the new templates did not actually work from the installer
unless I did:

    % sudo mv \
        /usr/local/share/dotnet/template-packs/Microsoft.iOS.Templates.14.4.100-ci.main.1180+sha.bccef33d3.nupkg \
        /usr/local/share/dotnet/template-packs/Microsoft.iOS.Templates.14.4.100-ci.main.1180.nupkg

I checked other templates like Android or ASP.NET, and they do not
currently have a hash like `+sha.bccef33d3` in the file name.

To fix this problem, I updated the file in the installers so we now
remove the `+sha.bccef33d3` portion from file name:

    $(subst +$(NUGET_BUILD_METADATA),,$(notdir $(TEMPLATE_PACKS_$(4))))

I also found the `Microsoft.iOS.Bundle.*.zip` did not contain
`template-packs` at all, so I fixed this as well.
2021-03-09 16:56:26 -06:00
Jonathan Peppers 94fb7823f2
[dotnet] produce .nupkg files for Workload packs (#10786)
Fixes: https://github.com/xamarin/xamarin-macios/issues/10620

I have a prototype where I figured out how Maui would consume the iOS &
Android workloads:

https://github.com/jonathanpeppers/maui-workload

One issue I ran into was there isn't a `Microsoft.NET.Workload.iOS`
package on the NuGet feed:

    <add key="xamarin" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" />

We will also need these packages to insert them in the dotnet/installer
repo, when they are ready for us to do "real" insertions for .NET 6.

To make this work, I mostly had to create a `package.csproj` for the
workload packs and fix up the `Makefile`.

Now I get additional `.nupkg` files produced in:

    % ls _build/nupkgs | grep Microsoft.NET.Workload
    Microsoft.NET.Workload.MacCatalyst.14.3.100-ci.workload-nupkgs.299+sha.692087e74.nupkg
    Microsoft.NET.Workload.iOS.14.4.100-ci.workload-nupkgs.1154+sha.692087e74.nupkg
    Microsoft.NET.Workload.macOS.11.1.100-ci.workload-nupkgs.1207+sha.692087e74.nupkg
    Microsoft.NET.Workload.tvOS.14.3.100-ci.workload-nupkgs.1207+sha.692087e74.nupkg
2021-03-04 16:33:42 -06: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
Emanuel Fernandez Dell'Oca 834b088885
[dotnet] Fixes -t:Run and illink.dll path for Windows (#10744)
* [dotnet] Adds support for dotnet build -t:Run from Windows

What was essentially needed was to execute the command remotely, using the right mlaunch path on the Mac

* [dotnet] Fixes illink.dll location when building from Windows

The property `_ILLinkTasksDirectoryRoot` does not exist anymore so we need to get the path in a different way. Essentially it is located in the same directory as the ILLink Task, so we can get it from `ILLinkTasksAssembly`.
2021-03-03 07:43:34 +01:00
Jonathan Peppers 11ca5a8619
.NET 6 templates for iOS, macOS, tvOS, & MacCatalyst (#10741)
Context: https://docs.microsoft.com/dotnet/core/tutorials/cli-templates-create-template-pack
Context: https://github.com/dotnet/templating/wiki
Context: https://github.com/dotnet/designs/pull/120
Fixes: https://github.com/xamarin/xamarin-macios/issues/10252

To implement templates in a .NET workload:

1. Make `.nupkg` files that follow the structure of the `dotnet new`
   templating system, using `$(PackageType)` of `Template`.
2. Install the `.nupkg` files in in `dotnet/template-packs/`
3. Update `WorkloadManifest.json`, to be part of the workload:

    "Microsoft.@PLATFORM@.Templates": {
      "kind": "template",
      "version": "@VERSION@"
    }

These are a starting point, for what I would consider the minimum for
the xamarin-macios repo to provide for now:

    Template Name                                 Short Name      Language    Tags
    --------------------------------------------  --------------  ----------  ----------------------
    iOS Controller template                       ios-controller  [C#]        iOS
    iOS Application                               ios             [C#]        iOS
    iOS Class library                             ioslib          [C#]        iOS
    macOS Application                             macos           [C#]        macOS
    MacCatalyst Application                       maccatalyst     [C#]        macOS/Catalyst
    tvOS Application                              tvos            [C#]        tvOS

We will probably need PM input on what the final templates will be.

To use these, you might do:

    $ mkdir MyApp && cd MyApp
    $ dotnet new ios
    $ dotnet new ios-controller --name LoginController --namespace MyApp

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-03-02 09:23:05 -06:00
Rolf Bjarne Kvinge 7ab7e25138
[runtime] Build a .NET-specific libxamarin-dotnet[-debug].[a|dylib]. (#10723)
This also means linking with the runtime packs from .NET instead of the mono archive
(thus we have one less reliance on the mono archive).

We're also using the Xamarin.iOS code for our macOS launch sequence now, since
(at least at first) we're only going to support self-contained .NET macOS apps
(so no need to support a system-installed runtime, which simplifies things a
bit).
2021-02-26 14:42:30 +01:00
Rolf Bjarne Kvinge 3a69beae53
[dotnet] Fix the Run target for Mac Catalyst to run the app directly instead of using mlaunch. (#10724) 2021-02-26 07:40:18 +01:00
Rolf Bjarne Kvinge 6e8e5da301 [dotnet] Add all assemblies in the ref package to the FrameworkList.xml. 2021-02-23 07:59:14 +01:00
Rolf Bjarne Kvinge 724e70f6a1 [dotnet-linker] Set Driver.SdkRoot to the Xcode path. 2021-02-23 07:59:13 +01:00
Rolf Bjarne Kvinge 77a1fda11e [dotnet-linker] Add SdkRootDirectory property so that we can set Driver.FrameworkCurrentDirectory correctly. 2021-02-23 07:59:13 +01:00
Rolf Bjarne Kvinge 321050d817 [dotnet] Add support for Mac Catalyst to our MSBuild logic. 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
Steve Pfister 434c1caff4 Feedback 2021-02-22 09:56:00 -05:00
Rolf Bjarne Kvinge 103ce01cf7
[dotnet] Update after the AOT compiler moved location. (#10656) 2021-02-18 07:26:11 +01:00
Emanuel Fernandez Dell'Oca f87ff16047
[dotnet] Execute ReadItemsFromFile remotely (#10638)
The session id was missing when trying to read items from _AssembliesToAOT.items, which breaks the build from Windows
2021-02-15 07:34:56 +01:00
Emanuel Fernandez Dell'Oca d337f0deac
[dotnet] Initial support for .NET6 from Windows (#10590)
These changes add support for executing iOS and MacDev tasks remotely (on a Mac) when running a build from Windows, and creates a specific .NET6 pack for Windows that's only included in the MSI.

For now this only enables builds for the iOS Simulator, physical devices are not yet supported.

- Each task decides if it should run locally or remotely depending on the SessionId property, which will only have a value on Windows.
- The XMA Build agent is now part of this repo and will be included in the iOS .NET6 Windows pack.
- On this first version we're including some Windows specific tasks and references into the Xamarin.iOS.Tasks project for simplicity, but those will be moved to the Windows specific project.

------------

* [msbuild] Adds support for executing Xamarin.iOS tasks from Windows

* [msbuild] Adds support for executing Xamarin.MacDev tasks from Windows

* Added XMA Build Agent to Xamarin.MacDev.Tasks.sln

* Fixes some MSBuild versioning problems

* Makes the XMA Build agent load Xamarin.iOS tasks

We need to load a type from the iOS tasks assembly so we can run the tasks requested by MSBuild from Windows. We only need to load Xamarin.iOS.Tasks.dll since MacDev.tasks is already embedded in that one.

There's a little trick on the csproj, we can't directly use the Xamarin.iOS.Tasks project ref assemblies because that includes both Xamarin.iOS.Tasks.dll and Xamarin.MacDev.Tasks.dll, so the MacDev tasks will collide. We use the project ref only for build dependency purposes but we add an assembly reference to Xamarin.iOS.Tasks.dll.

* Added Xamarin.iOS.Tasks.Windows project

* Removed unnecessary references on Xamarin.iOS.Tasks.Windows.csproj

* Adds Messaging assemblies when ILRepacking Xamarin Tasks

The Xamarin Task assemblies now depend on Messaging, so we need the Messaging assemblies to be packed into Xamarin.Mac.Tasks and Xamarin.iOS.Tasks. Also had to remove the direct Messaging dependencies from the build agent since those are already contained in Xamarin.iOS.Tasks

* Adds a reference to Messaging.Core targets to the Agent's project

* [msbuild] Adds Xamarin iOS Windows targets

* [msbuild] Adds missing dependencies to Xamarin.iOS.Tasks

This should fix build errors because of missing dependencies. Had to move System.Net.Mqtt.Server from the Build agent project to the tasks one to avoid conflicts with System.Diagnostics.Tracer.

* [dotnet] Creates iOS Windows pack

Creates a new pack for Windows specific (targets, build agent, etc.) files that shouldn't be installed on the Mac. We have a separate package for this to avoid increasing the core pack size with things that are not needed when using it from macOS.

* Fixes type in dotnet makefile

* [dotnet] Fixes the iOS Windows pack generation

- The windows pack should not include the Sdk and Targets folders
- For now we'll just create an iOS pack
- Fixes the path to the files to include on the Windows Sdk pack

* Added reference to the Windows iOS SDK from the Xamarin.iOS.Common.targets

Added a property to navigate to the Windows iOS SDK folder, based on a naming convention that assumes that both packs will always have the same version

* Added reference to the core iOS SDK from the Windows iOS SDK

Added a property to navigate to the core iOS SDK folder, based on a naming convention that assumes that both packs will always have the same version

* Updated Messaging version

* Override MessagingBuildClientAssemblyFile property and correctly imported props from targets

* [dotnet] Make Windows pack using target files from the output dir

We need to take the target files from the output dir to include targets that are part of nuget packages, otherwise we will only include targets from our source

* [dotnet] Adds the Windows Sdk pack to the workload manifest

* [msbuild] Fixes the Windows Sdk pack name

* [dotnet] Merge Mqtt instead of Mqtt.Server

We only need System.Net.Mqtt to be merged into Xamarin.iOS.Tasks

* Updated Messaging version

* [dotnet] Several fixes for the Windows Sdk

- Adds missing task CollectMonotouchReferences
- Merges more dependencies into Xamarin.iOS.Tasks.dll needed by XMA
- Updates the msbuild/Makefile to include files from both the output dir and the source dir
- Overrides the agents directory to look for them on the Windows pack

* [dotnet] Fixes the XMA Build agent

- The build agent is an app so it cannot target ns2.0
- The MSBuild dependencies should be copied into the agent zip file
- Avoids copying all the Xamarin iOS SDK core targets into the build agent, since those are not needed
- Ensures the broker zip file is copied into the Xamarin.iOS.Windows.Tasks output dir so its included in the Windows pack

* Bumps Xamarin.Messaging to 1.2.102

* Adds net6-win branch to trigger builds

* Adds Messaging.Client missing dependency to Xamarin.Mac.Tasks

* Added Xamarin.Messaging.Apple.Tasks project and VerifyXcodeVersion Task

* Fix unloaded Xamarin.Messaging.Build project

* Added Build contracts project and unified Xamarin.Messaigng.Apple.Tasks in Xamarin.iOS.Tasks.Windows

Also added missing tasks and changes .After.targets

* Updated Xamarin.Messaging version

* Build agent - reference MSBuild assemblies from the framework

Since the assemblies will be included in the build agent we need those to be the ones that come from the framework to be compatible with macOS

* [msbuild] Fixes _UpdateDynamicLibraryId target

The tasks con this target need to be executed remotely (when building from Windows).

* Updates resources

* Bump Xamarin.Messaging

Fixes problems when executing Exec task remotely

* [dotnet] Overrides Publish targets to execute them remotely from Windows

The `_CopyResolvedFilesToPublishPreserveNewest` and `_CopyResolvedFilesToPublishAlways` targets essentially copy files into the app bundle. Since those are part of the .NET SDK we need to override those so we can pass to the Copy task the SessionId parameter and then it will be executed remotely when building from Windows.

This is done in a Windows.After.targets file so it won't affect builds on macOS.

* Added ILMerge to Xamarin.iOS.Tasks.Windows

Also modified ILMerge.targets to not include System assemblies because we don't need them on the Windows package

* Bumps Messaging

This new version of messaging fixes a problem when copying task inputs from Windows to the Mac

* [dotnet] Fixes copying files to the Mac when building from Windows

When building from Windows there are .NET SDK targets that copy dynamic libraries from the SDK to the intermediate output directory or other files to the publish directory, since we can't control those we can't run them remotely so we need to copy those files to the Mac to ensure other targets will find those.

* [dotnet] Fixes how files are copied to the output dir

- Before executing `_CopyResolvedFilesToPublishPreserveNewest` and `_CopyResolvedFilesToPublishAlways` we copy the input files for those targets to the Mac
- Then we override the original targets to execute the same copy task as the original ones but on the Mac, so the output files are placed in the right location for the following targets to pick them up.

* Fixes typo on Xamarin.iOS.Common.After.targets

* Bumps Xamarin.Messaging

* [msbuild] Fixes VerifyXcodeVersion and ResolveUTIs tasks

Both tasks were not being able to connect to the Mac mostly because of ILRepack, there were kind of 2 versions of Xamarin.Messaging, one merged into Xamarin.iOS.Tasks and another one merged into Xamarin.iOS.Windows.Tasks. Because of this the build connection object registered on the task could not be casted to the build connection type.

This essentially moves both tasks into the Xamarin.iOS.Tasks assembly to avoid this issue, and as part of that also includes the Messaging contracts into that same project.

* [msbuild] Fixes warnings when building from Windows

* [dotnet] Adds missing assemblies to merge into Xamarin.iOS.Tasks

Those 2 new assemblies will only be used from Windows and we need their implementation instead of the ref assemblies. In the future we will need to find a way of doing this on the Windows only pack insted of doing it on the core Xamarin.iOS.Tasks assembly.

* [dotnet] Compute PublishTrimmed on a target

We need to do this so the property is evaluated after VS on Windows connects to the Mac, otherwise by default IsMacEnabled is false from Windows.

* Bumps Messaging to 1.2.111

* [dotnet] Execute ILLink remotely when building from Windows

- Overrides the ILLink task and _RunILLink target to add the hability to execute it remotely, adding input and output properties so files are copied to the server and output files are created on Windows.
- This "custom" ILLink task will only be executed from the Windows targets so when building from a Mac it will execute the core SDK task.

* [dotnet] Fixes intput/output files creation for linker tasks

- Custom Linker options file should be created on the Mac so we need to execute WriteLinesToFile remotely
- All the *.items files from the linker are created on the Mac so we need to execute ReadItemsFromFile remotely
- CompileNativeCode: fixes the OutputFile metadata path, otherwise the execution fails; also copies all the files in the declared "IncludeDirectories" to the Mac
- Avoids copying input files from Windows to the Mac when running LinkNativeCode since the real input files already exist on the Mac, and Windows contains only empty files just to make MSBuild inputs/outputs check work. If we copy those empty files to the Mac we brake the build.

* [msbuild] Minor fixes after merging from main

* [dotnet] Adds missing output files to the Xamarin.iOS.Tasks.Windows project

The output of this project was missing Messaging build targets and the build agent zip file that are needed to create the dotnet Windows specific pack

* [dotnet] Fixes dotnet Windows specific pack generation

Ensures the Windows projects are built and the files are copied to the dotnet pack directory before creating the package.

It also adds a variable to enable building this pack.

* [dotnet] Adds iOS Windows specific pack to iOS only MSI

There's only a Windows specific pack for iOS available for now, so we should only add it to the iOS SDK MSI

* [dotnet] Create a separate bundle for the iOS Windows MSI

We need to do this to avoid including the Windows specific pack in the pkg. Also for now we'll only create an MSI for iOS since it's the only supported platform from Windows.

* Fixes spacing issues in Xamarin.iOS.Tasks.csproj

* Bumps Touch.Unit back to 05db76

* Fixes formatting problems

* [msbuild] Replaces error E0176 by E0186

Because there's a warning W0176 that will overlap with the error

* [msbuild] Fixes CompileEntitlements task

There were 2 problems:
1- The if statement on the DefaultEntitlementsPath was wrong, because we should return the base value if there's no SessionId (which means the task is running on a Mac)
2- We should copy to the Mac the default entitlements file if no custom file was specified

* Several fixes to cleanup the code to support iOS from Windows

* Apply suggestions from code review

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

* Formatting fixes in Xamarin.Messaging.Build

* Reverted formatting changes in CompileEntitlements.cs

* More formatting fixes

* Update msbuild/Messaging/Xamarin.Messaging.Build/Handlers/ExecuteTaskMessageHandler.cs

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

* Fixes order of MSBuild errors in the resource file

* Add newly added localizable strings to canary test of translated strings.

* Delete tests that ensure theres code only on the abstract tasks

These were needed to ensure all the code was in the base tasks so we could have tasks implementations on Windows to remote those. Now that code is part of this repo (and that is why these tests are failing now) so we do not need them anymore.

* [dotnet] Don't build the Windows SDK pack if not configured to do so.

Co-authored-by: mag <mauro.agnoletti@gmail.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-02-12 07:43:17 +01:00
Rolf Bjarne Kvinge f4ac99efc0
[dotnet] Build & publish MacCatalyst packs. (#10624)
* [dotnet] Build & publish MacCatalyst packs.

* Add runtime support.
2021-02-12 07:38:43 +01:00
Rolf Bjarne Kvinge 1a0f250e05
[dotnet] Normalize the casing of the 'TargetPlatformIdentifier' value on Mac Catalyst. (#10617) 2021-02-11 20:19:36 +01:00
Rolf Bjarne Kvinge f127e614c9
[dotnet] Templateify some build logic. (#10618)
* [dotnet-linker] Templateify the install logic.

* [builds] Templateify the Versions.plist install logic.

* [dotnet] Create a per-platform Versions.props file with only the values applicable to that platform.

Also move the definition of the default TargetPlatformVersion to Make.versions, where we have other versions.

* [dotnet] Templateify some build code.
2021-02-11 20:17:12 +01:00
Eric Erhardt 3d932ebbb7
Default InvariantGlobalization in Xamarin IOS (#10598)
This allows for unnecessary code to be trimmed by default in an app. See https://github.com/dotnet/runtime/pull/47999.
2021-02-10 08:02:34 +01:00
Rolf Bjarne Kvinge f01fde5cd9
[dotnet] Don't use install-location in pkgs. (#10583)
Don't use install-location to specify where files should be installed, because
our notarization process replaces this value in the pkg manifest with the root
directory (without updating anything else), with the result that notarized
packages tries to install files in the wrong location.

Instead specify the full path for each individual file, so that the
install-location can be the root directory (and thus the notarization process
won't corrupt the package).
2021-02-08 07:35:32 +01:00
Rolf Bjarne Kvinge f5156f7ed7
[dotnet] Add support for the interpreter on device. Fixes #10292. (#10555)
* Pass and parse the MtouchInterpreter value to dotnet-linker.
* Move required logic from mtouch to shared code to take advantage of existing
  code to compute AOT arguments (which we need to compute the correct AOT
  arguments for System.Private.Corelib.dll, which is always AOT-compiled).
* Add a linker task to compute the AOT arguments for .NET.
* Add test projects.

This PR is probably best reviewed commit-by-commit.

Fixes https://github.com/xamarin/xamarin-macios/issues/10292.
2021-02-05 07:47:23 +01:00
Jonathan Peppers e30c5b3502
[.NET 6] make sure Run target depends on Build (#10581)
Fixes: https://github.com/xamarin/xamarin-macios/issues/10575

Running `dotnet build -t:Run` on a new project fails with:

    Xamarin.Shared.Sdk.targets(692,3): error MSB4018: The "GetMlaunchArguments" task failed unexpectedly.
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/jopepper/src/net6-samples/HelloiOS/bin/Debug/net6.0-ios/ios-x64/HelloiOS.app\Info.plist'.
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at Xamarin.MacDev.PObject.FromFile(String fileName, Boolean& isBinary) in /Users/builder/azdo/_work/1/s/xamarin-macios/external/Xamarin.MacDev/Xamarin.MacDev/PListObject.cs:line 344
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at Xamarin.MacDev.PDictionary.FromFile(String fileName, Boolean& isBinary) in /Users/builder/azdo/_work/1/s/xamarin-macios/external/Xamarin.MacDev/Xamarin.MacDev/PListObject.cs:line 774
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at Xamarin.MacDev.PDictionary.FromFile(String fileName) in /Users/builder/azdo/_work/1/s/xamarin-macios/external/Xamarin.MacDev/Xamarin.MacDev/PListObject.cs:line 761
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at Xamarin.iOS.Tasks.GetMlaunchArgumentsTaskBase.get_DeviceType() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.iOS.Tasks.Core/Tasks/GetMlaunchArgumentsTaskBase.cs:line 53
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at Xamarin.iOS.Tasks.GetMlaunchArgumentsTaskBase.GetDeviceTypes() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.iOS.Tasks.Core/Tasks/GetMlaunchArgumentsTaskBase.cs:line 72
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at Xamarin.iOS.Tasks.GetMlaunchArgumentsTaskBase.GenerateCommandLineCommands() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.iOS.Tasks.Core/Tasks/GetMlaunchArgumentsTaskBase.cs:line 128
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at Xamarin.iOS.Tasks.GetMlaunchArgumentsTaskBase.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.iOS.Tasks.Core/Tasks/GetMlaunchArgumentsTaskBase.cs:line 199
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    Xamarin.Shared.Sdk.targets(692,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

Unless you do `dotnet build` and `dotnet build -t:Run` in two steps.

It doesn't look like the built-in .NET 6 `Run` target depends on `Build`
at all:

91c1326f47/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets (L865-L867)

So let's reorganize things to fix this:

* `_PrepareRun` now runs on all platforms, it depends on `Build`.
* `_PrepareRunMobile` now has the condition so it will not run on macOS.
* `_PrepareRunMobile` doesn't need as many targets listed in
`DependsOnTargets` now, because `Build` has already run.
2021-02-05 07:42:39 +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 c5afca3888
Bump to .NET 6.0.100-preview.1.21081.5. (#10552)
* Bump to .NET 6.0.100-preview.1.21080.4.

* [dotnet] The linker automatically marks the build output as a root assembly.

* Bump to .NET 6.0.100-preview.1.21081.5.

* [dotnet] Turns out we do need mark the build output as a root assembly, but with we now have to use the full path.
2021-02-03 07:32:05 +01:00
Rolf Bjarne Kvinge 7f0e2449f7 [dotnet-linker] Add a new task that computes the arguments to the AOT compiler. 2021-02-01 14:37:31 +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 fa72e6c890 [dotnet] Add the AOT output directory and IntermediateLinkDir to the custom linker options 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge fa1ef254d6 [dotnet] Make the output directory for AOT-compiled code arch-specific 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge c80eed5d62 [tools] Pass and parse the MtouchInterpreter value. 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge 69c1a715c6
[dotnet] Add support for LinkDescription items. (#10467)
* [dotnet] Add support for LinkDescription items.

Also use the LinkDescription item group instead of a custom one
(_BundlerXmlDefinitions), since there's no need for the custom one.

* The world (aka mmp) isn't quite ready for this yet.

* Don't parse into LinkDescription, use a temporary variable instead.

And then only use the temporary variable for .NET.

The problem is that parsing mtouch extra args and adding any --xml arguments
to LinkDescription is that the xml file will be passed again to mtouch, and in
this case any ${ProjectDir} properties won't be evaluated.
2021-01-27 17:59:35 +01:00
Rolf Bjarne Kvinge aa671914f9
[dotnet] Remove workaround for mono/linker#1304, which has now been fixed. (#9862) 2021-01-18 08:21:31 +01:00
Rolf Bjarne Kvinge ef8cdfa64e
[dotnet] Add default exclusions for recursive patterns to not pick up files in the bin/obj directories. (#10422) 2021-01-15 08:25:42 +01:00
Rolf Bjarne Kvinge 471da9f51b
[dotnet] Don't AOT compile resource assemblies. (#10418)
Xamarin.iOS don't AOT compile resource assemblies, so we shouldn't do so in
.NET either (and in any case they end up causing native linking failures due
to duplicate native symbols).
2021-01-14 14:37:50 +01:00
Rolf Bjarne Kvinge 26803f791d
[dotnet] Set default runtime feature switches. (#10250)
Set all current feature switches, except for InvariantGlobalization, to
defaults which trim the features.

Ref: https://github.com/dotnet/runtime/blob/master/docs/workflow/trimming/feature-switches.md
Ref: https://github.com/xamarin/xamarin-android/pull/5337

This drops the hello world app size from 28.6 MB to 23.5 MB. Full report:
https://gist.github.com/rolfbjarne/71cc18b49446862f1d42aa29526b0ac6
2020-12-10 15:19:40 +01:00
Filip Navara 17722deab4
[dotnet] Prevent linking out code referenced by P/Invoke (#10182)
* [dotnet] Generate references.mm to prevent linking out code referenced by P/Invoke

* Address PR feedback: Namespaces.Foundation -> "Foundation."

* Address PR feedback: Simplify hasSymbols

* Reuse ListExportedSymbols step, respect App.SymbolMode

* Address PR feedback

* Workaround for tvOS
2020-12-03 14:04:11 +01:00
Rolf Bjarne Kvinge 945bd5c4b5
[dotnet] Don't link the main executable with any dylibs on macOS. (#10127)
Don't link the main executable with any dylib (except libcoreclr) on macOS,
because that may end up running library initializers in those dylibs, and they
may abort if something goes wrong.

This way we delay any failures until those dylibs are actually needed.

In particular, libSystem.Security.Cryptography.Native.OpenSsl.dylib will abort
in its library initializer if it can't find the native libssl.dylib it wants:
1d9e50cb47/src/libraries/Native/Unix/System.Security.Cryptography.Native/opensslshim.c (L122-L126)
and my system doesn't have any of the libssl.dylib versions that code wants.
2020-11-23 08:27:47 +01:00
Alex Soto 72c7b1ffcc
[main][watchOS] Add x86_64 simulator support (#10059)
* [watchOS] Add x86_64 simulator support

* Build runtime/registrar x86_64 slices
* Produce a 64 bit version of Xamarin.WatchOS.dll
* Allow building x86_64 for watch simulators in mtouch
* Let xharness know about x86_64

* [tests] Add x86_64 arch to test-libraries

* Make dotnet package aware of x64

* [ObjCRuntime] Fix computing if we're calling a stret function or not in a 64-bit watchOS simulator.

* [xharness] Re-enable some watchOS tests.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-11-20 09:27:46 -05:00
Rolf Bjarne Kvinge d6756f4829 Merge remote-tracking branch 'origin/main' into dotnet-6.0.100-alpha.1.20559.4 2020-11-11 16:38:15 +01:00
Rolf Bjarne Kvinge 59cdbc6098 [dotnet] Disable a very eager linker optimization.
Fixes these monotouch-test tests:

   MonoTouchFixtures.CoreImage.CIKernelTests
      [FAIL] CIKernel_BasicTest :   CIKernel_BasicTest we disagree that it is a color kernel
         Expected: True
         But was:  False
            :    at MonoTouchFixtures.CoreImage.CIKernelTests.CIKernel_BasicTest()

   [FAIL] CIKernel_TestFromPrograms :   CIKernel_TestFromPrograms is neither type of kernel?
         Expected: True
         But was:  False
            :    at MonoTouchFixtures.CoreImage.CIKernelTests.CIKernel_TestFromPrograms()
2020-11-11 16:37:39 +01:00
Rolf Bjarne Kvinge 6a976dc454 [dotnet] Fix whitespace. 2020-11-10 17:17:15 +01:00
Rolf Bjarne Kvinge db23ca881a
[dotnet] Add _CreateDebugSettings, _CreateDebugConfiguration and _CreatePkgInfo to the targets we run on app creation. (#10061) 2020-11-10 13:44:26 +01:00
Rolf Bjarne Kvinge 8f0ca7508a [dotnet] Reorder imports to account for that our targets are imported earlier in the build process.
In the latest .NET 6, our Workloads.targets is imported earlier in the build. This
requires a few changes, because we still need to run most of our logic later in the
process, which we do by adding targets files we want imported later to the AfterMicrosoftNETSdkTargets
property.

What we're loading as soon as possible:

* Our version information (Xamarin.Shared.Sdk.Versions.targets)
* The supported OS versions (Microsoft.<platform>.Sdk.SupportedTargetPlatforms.targets)
* The default OS version (Xamarin.Shared.Sdk.TargetFrameworkInference.targets).

This is all information that the .NET build require early on.

Changes:

* Rename all files that are loaded early to *.props.
* Updated documentations to reflect these changes.
* Remove Microsoft.<platform>.TargetFrameworkInference.targets, these files aren't
  used and don't contain anything useful.
* Move the logic to calculate _ComputedTargetFrameworkMoniker has been delayed
  to later, because it needs TargetFrameworkMoniker set.
2020-11-10 11:41:30 +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 8b76cf4735
[dotnet] Fix MSBuild syntax. (#10055)
For some reason .NET 6 does not like spaces in certain places:

    MSB4259: Unexpected space at position "32" of condition [...]

So just remove them.
2020-11-06 14:01:19 +01:00
Rolf Bjarne Kvinge 06cd5722cc
[msbuild] Add SceneKit assets to our items included by default. (#10053) 2020-11-06 08:11:25 +01:00
Rolf Bjarne Kvinge 0def89604d
[msbuild] Add Metal files to our items included by default. (#10049) 2020-11-05 15:36:36 +01:00
Rolf Bjarne Kvinge 8aa53ba943
[dotnet] Add app extension targets to our list of stuff to do during the build. (#10044)
That makes app extensions build in dotnet.

This required adding a RuntimeIdentifier property to all the extension test
projects.
2020-11-05 08:34:29 +01:00
Rolf Bjarne Kvinge e7dd367125
[msbuild] Add CoreML models to our items included by default. (#10038) 2020-11-04 16:01:43 +01:00
juliuszint 3a1a7d4e77
Generate default compilation includes for pdf image assets. (#10018)
iOS and macOS have support to generate image assets for various
resolutions from vector based PDF files. These files should be included by
default for SDK-Style projects.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-11-04 09:00:06 +01:00
Rolf Bjarne Kvinge 781bc851a5
[dotnet] Add atlas textures to the our items included by default. (#9995) 2020-11-04 08:40:16 +01:00