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

1000 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge a4191b3ab6 [dotnet] Set BTouchToolPath and BaseLibDllPath to the where bgen and the platform assembly is. 2020-08-10 16:12:41 +02:00
Rolf Bjarne Kvinge 612769c390 [dotnet] Split part of _ComputeVariables into a _ComputeFrameworkVariables.
This means that the '_ComputeFrameworkVariables' target can be executed without needing
some of the dependencies the '_ComputeVariables' target has (in particular executing
'_GenerateBundleName' is not possible for binding projects).
2020-08-10 16:12:41 +02:00
Rolf Bjarne Kvinge edc673ca7f [dotnet] Disable default compilation includes for binding projects. 2020-08-10 16:12:41 +02:00
Rolf Bjarne Kvinge ffde3dd49f
[dotnet] Fix referencing an MSBuild variable. (#9296)
This fixes copying executables to the app bundle.
2020-08-06 18:53:25 +02:00
Rolf Bjarne Kvinge d8775c1cb4
[dotnet] Always process symbol files. (#9294) 2020-08-06 18:52:51 +02:00
Rolf Bjarne Kvinge b0a5603fcc
[dotnet] Use the right variable to determine whether we're in debug mode or not. (#9292) 2020-08-06 16:42:01 +02:00
Rolf Bjarne Kvinge 4a5dc20338
[dotnet] Only pass a single custom step to the linker. (#9173)
* [dotnet] Only pass a single custom step to the linker.

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

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

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

* [tests] Adjust .NET tests according to new behavior.
2020-07-24 09:20:52 +02:00
Rolf Bjarne Kvinge 8b9bfe2877
[dotnet] Add Verbosity to the linker configuration. (#9169) 2020-07-23 18:07:05 +02:00
Rolf Bjarne Kvinge 9a17e053b7
[dotnet] Add some project capabilities. (#9013)
* [.NET 5] Start adding some project capabilities (#3)

Aligned with XA too, see https://github.com/xamarin/xamarin-android/pull/4383.

We'll start using Apple instead of iOS for these things at the IDE level since many
behaviors don't actually depend on iOS but also apply to tvOS, watchOS, and so on.

These capabilities go before other imports just in case additional packages/targets
from the SDK need to access them too.

* Remove the LaunchProfiles capability for the CPS integration (#8472)

Implements https://work.azdo.io/1112733 as a workaround for the conflicts between
the built-in launchsettings.json-based .NET Core debugger and our Mono debugger.

Co-authored-by: Daniel Cazzulino <daniel@cazzulino.com>
2020-07-06 14:31:27 +02:00
Rolf Bjarne Kvinge 6f6b8e281b Merge remote-tracking branch 'origin/main' into dotnet-xharness-introspection 2020-07-03 11:12:50 +02:00
Rolf Bjarne Kvinge d621e3a854
[dotnet] Use the exact same dotnet version in our global.jsons as in Make.config. (#8984)
This avoids a possible difference in behavior, because in our system
dependency check we verify that the system has a specific version (which might
succeed), but if we don't pick a specific dotnet version in global.json,
dotnet will pick the latest version, which may behave differently than the one
we have in Make.config.

Thus always use the exact same version, so that we don't run into a difference
in behavior between developers and/or bots.
2020-07-01 17:08:46 +02:00
Rolf Bjarne Kvinge 88cd158bd9 [dotnet] Always copy System.Runtime.dll to the .app.
This works around a linker issue: https://github.com/mono/linker/issues/1304
2020-06-30 19:01:07 +02:00
Rolf Bjarne Kvinge 5cfbd9fd4d [dotnet-linker] Add a GatherFrameworksStep and use the output when linking the native executable.
Add a GatherFrameworksStep that computes the frameworks an app needs, and
returns the result to the MSBuild tasks.

Then we use that list of frameworks to link the native executable correctly.
2020-06-30 19:01:07 +02:00
Rolf Bjarne Kvinge 9b3916f974 [dotnet-linker] Pass DeploymentTarget, IsSimulatorBuild and SdkVersion to the linker configuration. 2020-06-30 19:01:07 +02:00
Rolf Bjarne Kvinge 7e4813b8c6 [dotnet] Use the same MSBuild items to specify both weakly and normally linked frameworks.
This is a slight performance improvements when loading the list of frameworks
the managed linker produces, because the MSBuild logic can only load one item
group per file, and if we use two differently named item groups, we'd have to
store weakly and normally linked frameworks in different files.

This way we can store both types of frameworks in a single file.
2020-06-30 19:01:07 +02:00
Rolf Bjarne Kvinge ccdd5b3a44 [dotnet] Collect and copy bundle resources to the app.
The introspection tests have bundle resources and require this to run successfully.
2020-06-30 19:01:07 +02:00
Rolf Bjarne Kvinge be3568f893 [dotnet] Fix the identity for mono's dynamic libraries. 2020-06-19 18:07:00 +02:00
Rolf Bjarne Kvinge 21e5c9acda [dotnet] Hardcode linking with Foundation and CoreFoundation for now.
This will eventually be computed.
2020-06-19 18:07:00 +02:00
Rolf Bjarne Kvinge 7ec3fa958b [dotnet] Link the native executable with mono. 2020-06-19 18:06:59 +02:00
Rolf Bjarne Kvinge 8a65236c4d [dotnet] Link the executable with libxamarin. 2020-06-19 18:06:59 +02:00
Rolf Bjarne Kvinge c53e96f48d [dotnet] Figure out where the xamarin include directory is, and pass it as an include directory when compiling the main code. 2020-06-19 18:06:59 +02:00
Rolf Bjarne Kvinge 77488b8fbe [dotnet-linker] Pass AssemblyName to the linker. 2020-06-19 17:48:14 +02:00
Rolf Bjarne Kvinge a6d9678260 [dotnet] Add a LinkNativeCode task and link the output from the CompileNativeCode task into a main executable. 2020-06-18 15:57:02 +02:00
Rolf Bjarne Kvinge 8594af3b2c [dotnet] Add a CompileNativeCode task and compile the generated main code into object files. 2020-06-18 15:57:01 +02:00
Rolf Bjarne Kvinge 72bbee78c0 [dotnet] Load the output from the GenerateMain step into the MSBuild targets.
The GenerateMain step needs to return the generated filename to the MSBuild targets, and it does so by writing out MSBuild xml which is then loaded into the MSBuild logic.
2020-06-18 15:57:01 +02:00
Rolf Bjarne Kvinge 1401624e09 [dotnet-linker] Add a GenerateMain step.
This generates a very basic Main method that doesn't do anything at all.
2020-06-18 15:57:01 +02:00
Rolf Bjarne Kvinge c6abc2fea1 [dotnet-linker] Add CacheDirectory and ItemsDirectory to the linker configuration. 2020-06-18 15:57:01 +02:00
Rolf Bjarne Kvinge da1db99954 [dotnet-linker] Pass TargetArchitectures to the linker. 2020-06-18 15:52:16 +02:00
Rolf Bjarne Kvinge a3b638bea3 [dotnet] Compute ComputedPlatform based on the architecture. 2020-06-18 15:52:16 +02:00
Rolf Bjarne Kvinge 9f98c8fdfd [dotnet] Deduce the architecture from the runtime identifier. 2020-06-18 15:52:16 +02:00
Rolf Bjarne Kvinge 95e42b9266
Rename master to main. (#8851)
* Fix links that point to master to point to main instead.
* Implement support in the sample tester for specifying the default branch for
  each sample repo.
* Fix various text / documentation to say 'main' instead of 'master.'
* Push to 'main' instead of 'master' in xamarin-macios-data.
* Fix xharness to make 'main' the special branch with regards to documentation tests as opposed to 'master'.
* Fix various CI to use 'main' instead of 'master'.
* Bump maccore

    New commits in xamarin/maccore:

    * xamarin/maccore@ed6d146822 Rename 'master' to 'main'. (#2233)

    Diff: 424fa26148..ed6d146822
2020-06-16 15:51:44 +02:00
Rolf Bjarne Kvinge 748612fbc2
[dotnet] Ship libxamarin.dylib and friends. (#8830)
* [dotnet] Ship libxamarin.dylib and friends.

Add libxamarin[-debug].[a|dylib] to the NuGets.

* [dotnet] Create a DOTNET_PLATFORMS variable in Make.config.

Create a DOTNET_PLATFORMS variable in Make.config and use it everywhere
instead of the PLATFORMS variable we were defining in multiple Makefiles.

Also move the creation of the DOTNET_<platform>_RUNTIME_IDENTIFIERS variables
from dotnet/Makefile to Make.config, it'll soon be needed elsewhere as well.

* [runtime] Conditionally include bits.

* Make the contents of the DOTNET_[PLATFORMS|RUNTIME_IDENTIFIERS] variables depend on the INCLUDE_[IOS|TVOS|WATCH] variables.
2020-06-15 17:47:18 +02:00
Rolf Bjarne Kvinge 24117c5180
[dotnet] Rebuild nugets and global.json when we switch branches or commit something, or change any of the project files involved in package creation. (#8834) 2020-06-11 11:57:28 +02:00
Rolf Bjarne Kvinge 85e3113858
[dotnet-linker] Add support for passing configuration from the MSBuild targets to our linker steps. (#8780)
Add support for passing configuration from the MSBuild targets to our linker
steps using the linker's --custom-data option.

There are just two values being passed now, but this will grow significantly
over time as linker steps are implemented.
2020-06-05 16:04:53 +02:00
Rolf Bjarne Kvinge ab6b418483
[dotnet] Detect, compile and publish Info.plist into the app. (#8752)
* [dotnet] Detect, compile and publish Info.plist into the app.

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

* [dotnet] Adjust default inclusion behavior.

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

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

.NET sets EnableDefaultItems in their .targets: https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets#L16
2020-06-05 14:47:54 +02:00
Rolf Bjarne Kvinge 91bfdae6e0
[dotnet] Improve incremental builds in make. (#8754)
* Be more exact when specifying dependencies for nuget packages: instead of
  making every package depend on every file within this directory, only make
  the specific package the files go into depend on those files. This means
  that if any of these files change, only the package that contains that file
  will be rebuilt.
* Have each package depend on all the files that are to be included in that
  package. This means that if any other directory adds or updates a file for a
  nuget, we'll rebuild that nuget here.
* Removes packages from the local feed before trying to (re-)add them. This
  makes them actually install locally, instead of nuget just skipping them,
  when the version hasn't changed.

This was easier to express with make templates than pattern rules, so some of
the logic was re-implemented as make templates.
2020-06-04 16:39:19 +02:00
Rolf Bjarne Kvinge cb637a08a0
Merge pull request #8733 from rolfbjarne/dotnet-linker
[dotnet] Add dotnet-linker, a project to contain custom linker steps for our net5.0 build.
2020-06-03 09:11:15 +02:00
Rolf Bjarne Kvinge ce34c1f893
[dotnet] Improve the 'clean' target. (#8729)
Don't nuke the entire DOTNET_DESTDIR, because that means it will be necessary
to run 'make' in the top-level directory again. Instead only clean files that
the dotnet/ directory will re-build.
2020-06-03 09:00:19 +02:00
Rolf Bjarne Kvinge 80d4100627 [dotnet] Pass our custom linker step to the linker. 2020-06-02 15:55:58 +02:00
Rolf Bjarne Kvinge 2ba2362da1 [dotnet] Automatically set PublishTrimmed and SelfContained to true.
PublishTrimmed must be set before we import Microsoft.NET.Sdk, which means we
also have to move the computation of the project type to before we import
Microsoft.NET.Sdk, because we need to know the project type to determine
whether PublishTrimmed and SelfContained should be set to true (neither should
if we're building a class library or a binding project).
2020-06-02 15:55:56 +02:00
Rolf Bjarne Kvinge 2fdd7451b9
[dotnet] Inject logic into the Build target to put resolved assemblies and dylibs into the .app. (#8715)
Inject logic into the Build target to start creating the app bundle:

* Make sure the pre-existing list of targets (CreateAppBundleDependsOn) to
  create an app bundle is not evaluated.
* Create a new CreateAppBundleDependsOn variable that contains the new targets
  we want to run to create the app bundle for net5.
* Call the built-in publishing targets to copy files to the publish directory
  (ComputeFilesToPublish / CopyFilesToPublishDirectory).
* Add a target that rewrites the publish directory for assemblies and dylibs
  to put them in the app bundle instead.
2020-06-01 17:52:19 +02:00
Rolf Bjarne Kvinge cf1f8af55a [msbuild] Don't inject our existing build logic into the *DependsOn variables when building using net5. 2020-05-26 14:49:31 +02:00
Rolf Bjarne Kvinge 0aea29cf0a [dotnet] Import the existing targets files. 2020-05-26 14:49:31 +02:00
Rolf Bjarne Kvinge f0aa8ea4ec
[dotnet] Add a KnownFrameworkReference node to the targets to tell the .NETCore build system about us. (#8665)
Also add another nuget source to get Mono's net5 runtime packs.

This makes the tests/dotnet/MySingleView test app:

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

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

Current (expected) build result:

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

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

This fails because the .NET build logic isn't being told that it should look
for the mono runtime packs instead of the .NET Core runtime packs.
2020-05-25 15:22:29 +02:00
Rolf Bjarne Kvinge 518a95b61b
[src] Put the implementation assemblies for our product assemblies in the NuGet runtime packages. (#8628)
This is the current structure:

        Microsoft.iOS.Runtime.<rid>
        └─── data
        │    └─── RuntimeList.xml
        └─── runtimes
        │    └─── <rid>
        │    │    └─── lib
        │    │    │    └─── net5.0
        │    │    │    │    └─── Xamarin.iOS.dll
        │    │    │    │    └─── Xamarin.iOS.pdb

and likewise for tvOS, watchOS and macOS.

Also fix the nuget packaging to include the reference/implementation
assemblies in FrameworkList.xml and RuntimeList.xml.
2020-05-20 18:39:18 +02:00
Rolf Bjarne Kvinge 161d46ce2f
Switch to net5.0 instead of netcoreapp5.0. (#8615)
This also requires bumping .NET to a version that supports 'net5.0'.

The actual TFM is still '.NETCoreApp,Version=5.0', it's just the short name
that has changed.
2020-05-20 09:26:41 +02:00
Rolf Bjarne Kvinge 2f3f9446fd
Only build dotnet/ if dotnet is enabled. (#8614) 2020-05-20 09:26:27 +02:00
Rolf Bjarne Kvinge 4d7e248314
[dotnet] Implement 'dotnet run' for macOS apps. (#8600) 2020-05-14 17:16:35 +02:00
Rolf Bjarne Kvinge 5834572741
Create and publish .NET NuGet packages. (#8576)
Create the various NuGet packages to support .NET 5+. The packages are
currently empty (and not very useful), but the actual content will come later.

The current set of NuGet packages are (this list is duplicated for each
platform: iOS, tvOS, watchOS and macOS):

* Microsoft.iOS.Sdk: currently contains the basic MSBuild targets files for an
  MSBuild Project SDK. Will eventually contain all the build logic. Might also
  eventually contain other tools (mlaunch, bgen, etc.), but these might also
  end up in a different package.
* Microsoft.iOS.Ref: will contain the Xamarin.iOS.dll reference assembly.
* Microsoft.iOS.Runtime.[RID]: will contain architecture-specific files
  (libxamarin*.dylib, the Xamarin.iOS.dll implementation assembly, etc.):

The NuGets built on CI are automatically published to a NuGet feed.

The versioning for the NuGet packages required a few changes: OS bumps are now
changed in Make.versions instead of Make.config (this is explained in the
files themselves as well).
2020-05-13 15:23:29 +02:00