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

74 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 3db0a33b90
[dotnet] Implement AOT compilation for mobile platforms (#9962)
* Add an AOTCompile task that runs the AOT compiler for a given set of input assemblies.
  This task will eventually be deprecated by an equivalent task provided by Mono,
  but this works for now.

* Add an _AOTCompile target that takes care of running the AOT compiler and compile
  the result into object files.
2020-10-27 15:16:34 +01:00
Rolf Bjarne Kvinge dce4c37fc6
[dotnet] Only fix the id of mono libraries which are actually dylibs. (#9944) 2020-10-23 09:12:49 +02:00
Rolf Bjarne Kvinge 673a378cbb
[msbuild] Add a TargetArchitectures argument to the LinkNativeCode task. (#9945)
The native linker defaults to the execution architecture, which works fine for
64-bit iOS Simulator (because we target x86_64 and run on x86_64), but it
doesn't work for any other architecture, so make sure to pass the architecture
to the native linker.

Also make sure we only get one architecture, because the native linker doesn't support
building fat libraries (we'll have to add support for manually lipoing the result).
2020-10-23 09:12:34 +02:00
Rolf Bjarne Kvinge b67b85817f
[dotnet] Don't try to update the location of the dynamic libraries when we didn't fix them. (#9936)
We're already not running part of the _UpdateDynamicLibraryId task when in
offline mode, so exclude the rest as well.

Fixes these build errors in offline mode:

    C:\Program Files\dotnet\sdk\5.0.100-rc.2.20480.7\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(237,5): error MSB3030: Could not copy the file "obj\Debug\net5.0-ios\ios-x64\nativelibraries/libSystem.Net.Security.Native.dylib" because it was not found. [C:\code\net6-samples\HelloiOS\HelloiOS.csproj]
    C:\Program Files\dotnet\sdk\5.0.100-rc.2.20480.7\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(237,5): error MSB3030: Could not copy the file "obj\Debug\net5.0-ios\ios-x64\nativelibraries/libSystem.IO.Compression.Native.dylib" because it was not found. [C:\code\net6-samples\HelloiOS\HelloiOS.csproj]
    C:\Program Files\dotnet\sdk\5.0.100-rc.2.20480.7\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(237,5): error MSB3030: Could not copy the file "obj\Debug\net5.0-ios\ios-x64\nativelibraries/libSystem.Security.Cryptography.Native.Apple.dylib" because it was not found. [C:\code\net6-samples\HelloiOS\HelloiOS.csproj]
    C:\Program Files\dotnet\sdk\5.0.100-rc.2.20480.7\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(237,5): error MSB3030: Could not copy the file "obj\Debug\net5.0-ios\ios-x64\nativelibraries/libmonosgen-2.0.dylib" because it was not found. [C:\code\net6-samples\HelloiOS\HelloiOS.csproj]
    C:\Program Files\dotnet\sdk\5.0.100-rc.2.20480.7\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(237,5): error MSB3030: Could not copy the file "obj\Debug\net5.0-ios\ios-x64\nativelibraries/libSystem.Native.dylib" because it was not found. [C:\code\net6-samples\HelloiOS\HelloiOS.csproj]
2020-10-21 14:10:57 +02:00
Rolf Bjarne Kvinge c0c91ed89f
[dotnet] Don't run the linker nor install_name_tool when running in offline mode on Windows. (#9910)
* [dotnet] Don't run the linker nor install_name_tool when running in offline mode on Windows.

When running in offline mode on Windows, we only want to compile the C# code
(to make sure it compiles). We do this by adding an '$(IsMacEnabled)' == 'true'
checks to code that we don't want to run in offline mode.

The linker fails like this, and the easiest fix is to just disable it:

    > dotnet build .\HelloiOS\HelloiOS.csproj -p:IsMacEnabled=false
    Microsoft (R) Build Engine version 16.8.0-preview-20475-05+aed5e7ed0 for .NET
    Copyright (C) Microsoft Corporation. All rights reserved.
      Determining projects to restore...
      Restored C:\src\net5-samples\HelloiOS\HelloiOS.csproj (in 6.28 sec).
      You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
      HelloiOS -> C:\src\net5-samples\HelloiOS\bin\Debug\net5.0-ios\ios-x64\HelloiOS.dll
    ILLink : error IL1012: IL Linker has encountered an unexpected error. Please report the issue at https://github.com/mono/linker/issues [C:\src\net5-samples\HelloiOS\HelloiOS.csproj]
      Fatal error in IL Linker
      Unhandled exception. System.DllNotFoundException: Unable to load DLL '/usr/lib/libSystem.dylib' or one of its dependencies: The specified module could not be found. (0x8007007E)
         at Xamarin.Bundler.Target.realpath(String path, IntPtr zero)
         at Xamarin.Bundler.Target.GetRealPath(String path)
         at Cache.set_Location(String value)
         at Xamarin.Linker.LinkerConfiguration..ctor(String linker_file)
         at Xamarin.Linker.LinkerConfiguration.GetInstance(LinkContext context)
         at Xamarin.Linker.ConfigurationAwareStep.get_Configuration()
         at Xamarin.SetupStep.Process()
         at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
         at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
         at Mono.Linker.Pipeline.Process(LinkContext context)
         at Mono.Linker.Driver.Run(ILogger customLogger)
         at Mono.Linker.Driver.Main(String[] args)

And disables install_name_tool too:

    > dotnet build .\HelloiOS\HelloiOS.csproj -p:IsMacEnabled=false -p:PublishTrimmed=false
    Xamarin.Shared.Sdk.targets(391,3): error MSB3073: The command "xcrun install_name_tool -id @executable_path/libSystem.IO.Compression.Native.dylib obj\Debug\net5.0-ios\ios-x64\nativelibraries/libSystem.IO.Compression.Native.dylib" exited with code 9009.

* Set PublishTrimmed after importing our existing Xamarin.iOS/Xamarin.Mac targets.

Because setting PublishTrimmed depends on knowing the value of IsMacEnabled,
which is set in our existing Xamarin.iOS/Xamarin.Mac targets.

Also remove the comment about having to set PublishTrimmed before including
Microsoft.NET.Sdk, because that's not accurate anymore (see
2939a6fdbc).
2020-10-20 16:25:49 +02:00
Rolf Bjarne Kvinge b4141ebf60 [dotnet] Move the default inclusion to Xamarin.Shared.Sdk.DefaultItems.props. 2020-10-16 14:27:57 +02:00
Rolf Bjarne Kvinge 5623eeb106 [dotnet] Rename Microsoft.<platform>.Sdk.SupportedTargetPlatforms.props to Microsoft.<platform>.Sdk.SupportedTargetPlatforms.targets. 2020-10-16 14:27:57 +02:00
Rolf Bjarne Kvinge a249ac2c80 [dotnet] Rename Xamarin.Shared.Sdk.Versions.props to Xamarin.Shared.Sdk.Versions.targets. 2020-10-16 14:27:57 +02:00
Rolf Bjarne Kvinge e43688a60b [dotnet] Merge Xamarin.Shared.Sdk.props into Xamarin.Shared.Sdk.targets. 2020-10-16 14:27:57 +02:00
Rolf Bjarne Kvinge 613ebb1dce [dotnet] Don't import Microsoft.NET.Sdk's Sdk.props/Sdk.targets.
We're not in control of this anymore.
2020-10-16 14:27:42 +02:00
Juan Marcelo Tondato e741262e90
[dotnet] Add some project capabilities. (#9840)
Visual Studio uses CPS to load SDK-style projects. In CPS, most things are keyed-off so-called capabilities[0] which replace other methods that were used previously like project type GUIDs.

While capabilities can be defined in the IDE, they make most sense to be directly expressed in the targets themselves where CPS will pick them up automatically.

[0] https://github.com/microsoft/VSProjectSystem/blob/master/doc/overview/about_project_capabilities.md
2020-10-14 08:43:46 +02:00
Filip Navara 5e79ca4f23
[dotnet] Avoid using install_name_tool on macOS and specify correct rpath instead (#9819)
* [dotnet] Avoid using install_name_tool on macOS and specify correct rpath instead

* Update Xamarin.Shared.Sdk.targets
2020-10-13 13:00:35 +02:00
Filip Navara 5caec8986f
[dotnet] Default to static libxamarin.a builds on macOS (#9833)
This seems to match the default on classic mmp-based projects. It also avoids the relaunching of the app which can result in the UI not being displayed in front of other apps.
2020-10-09 16:41:59 +02:00
Rolf Bjarne Kvinge 3d906e7000
[dotnet] Add support for 'dotnet build -t:run'. (#9823)
* Ship mlaunch in the iOS, tvOS and watchOS NuGets. It should probably go into
  a separate NuGet (to avoid shipping the same mlaunch executable in three different
  packages), but that can be done at a later stage.

* Add a GetMlaunchArguments task that computes the mlaunch arguments to install
  or launch an app in either the simulator or on device.

* Implement the MSBuild logic to make the Run target (provided by .NET) launch
  mlaunch (for iOS, tvOS and watchOS) or the built app (for macOS). This is done
  by setting the RunCommand and RunArguments properties (which the Run target uses)
  to the correct values.

Ideally I'd would make 'dotnet run' work too, but that runs into a different problem which
I haven't figured out yet:

    A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/'.
    Failed to run as a self-contained app.
      - The application was run as a self-contained app because '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json' did not specify a framework.
      - If this should be a framework-dependent app, specify the appropriate framework in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json'.

That's for a different pull request though.

Ref: https://github.com/xamarin/net6-samples/issues/35.
2020-10-09 13:01:13 +02:00
Filip Navara 4f30a27f3a
[dotnet] Use correct relative path for install_name_tool on macOS (#9804)
* Use correct relative path for install_name_tool on macOS

* Replace hard-coded `MonoBundle` with $(_CustomBundleName)
2020-10-08 12:32:37 +02:00
Filip Navara e40974d414
Copy native executable to Contents/MacOS directory in the .app bundle for macOS platform (#9802) 2020-10-08 08:18:29 +02:00
Rolf Bjarne Kvinge 50616b9296
[dotnet] Use xcrun to execute install_name_tool. (#9694) 2020-09-24 14:56:52 +02:00
Rolf Bjarne Kvinge 7756d957f9
[dotnet] Tell the linker about any xml descriptors we might have. (#9676)
Also add a linker descriptor to the monotouch-test/.NET project file to
preserve the parts of nunit.framework.dll that aren't linker safe.

This fixes an unhandled exception that causes a crash during the
monotouch-test test run when the linker is enabled:

    Unhandled Exception:
    System.NullReferenceException: Object reference not set to an instance of an object

    Thread 11 Crashed:: tid_15403  Dispatch queue: com.apple.root.default-qos
    0   libsystem_kernel.dylib        	0x00007fff5220c33a __pthread_kill + 10
    1   libsystem_pthread.dylib       	0x00007fff522b6e60 pthread_kill + 430
    2   libsystem_c.dylib             	0x00007fff5219bb7c abort + 120
    3   libxamarin-debug.dylib        	0x000000010c93979f xamarin_unhandled_exception_handler + 47
    4   libmonosgen-2.0.dylib         	0x000000010cc04980 mono_invoke_unhandled_exception_hook + 131
    5   libmonosgen-2.0.dylib         	0x000000010cb40166 mono_handle_exception_internal + 5915
    6   libmonosgen-2.0.dylib         	0x000000010cb3ea47 mono_handle_exception + 11
    7   libmonosgen-2.0.dylib         	0x000000010cb8ea06 mono_amd64_throw_exception + 158
    8   ???                           	0x000000010d4125b0 0 + 4517340592
    9   libxamarin-debug.dylib        	0x000000010c9394fb xamarin_process_managed_exception + 379 (runtime.m:2361)
    10  libxamarin-debug.dylib        	0x000000010c939377 xamarin_process_managed_exception_gchandle + 55 (runtime.m:1144)
    11  libxamarin-debug.dylib        	0x000000010c939333 xamarin_ftnptr_exception_handler + 19 (runtime.m:1133)
    12  libmonosgen-2.0.dylib         	0x000000010cb3feeb mono_handle_exception_internal + 5280
    13  libmonosgen-2.0.dylib         	0x000000010cb3ea47 mono_handle_exception + 11
    14  libmonosgen-2.0.dylib         	0x000000010cb8f2dd handle_signal_exception + 67
    15  ???                           	0x000070000fd730d8 0 + 123145568071896
    16  ???                           	0x000000011a3ab99b 0 + 4735023515
    17  ???                           	0x000000011a3aa643 0 + 4735018563
    18  libdispatch.dylib             	0x00007fff52090a0f _dispatch_queue_override_invoke + 1071
    19  libdispatch.dylib             	0x00007fff5209dcc5 _dispatch_root_queue_drain + 350
    20  libdispatch.dylib             	0x00007fff5209e46a _dispatch_worker_thread2 + 102
    21  libsystem_pthread.dylib       	0x00007fff522b39f7 _pthread_wqthread + 220
    22  libsystem_pthread.dylib       	0x00007fff522b2b77 start_wqthread + 15
2020-09-22 09:15:33 +02:00
Rolf Bjarne Kvinge 569b484ba7
[msbuild/dotnet] Execute bgen using dotnet from the MSBuild tasks when in .NET mode. (#9662) 2020-09-21 08:25:27 +02:00
Rolf Bjarne Kvinge 8cc314654f
[dotnet] Add support for the static registrar. (#9615) 2020-09-11 14:08:48 +02:00
Rolf Bjarne Kvinge 941d65f016
[dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration. (#9599)
* [dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration.

Also call Application.InitializeCommon to initialize the application instance. The
important part here is that InitializeCommon calls Optimizations.Initialize to compute
the default optimizations. It also calls Set*ExceptionMode and sets the default EnableCoopGC
value (so we don't need to call/set those anymore), and it does a few other initialization
tasks which we don't need yet, but eventually will.

And finally remember to parse the bundler arguments before using them in the dotnet
build logic. How did this not cause problems before? 🤦

* [tests] Set the verbosity using the additional args instead of an internal variable.

The internal _BundlerVerbosity variable is overwritten now (with the verbosity
value from the additional args).

* [xharness] Disable tvOS generation for the introspection/.NET test, it incorrect and needs fixing.
2020-09-09 14:52:46 +02:00
Rolf Bjarne Kvinge f0f47b6a46
[dotnet] Make the linker always process debug symbols, and remove debugging support if we're building a release build. (#9594)
Unfortunately due to when things happen in the .NET build logic, we need to
define the DebuggerSupport property (which determines whether the app should
include debugging support or not) before importing the .NET build files. Since
we want to use the _BundlerDebug property (a.k.a. MtouchDebug/MmpDebug) to
determine if the app should include debugging support, we must figure out the
value of the _BundlerDebug property before we can define the DebuggerSupport
property. This turned out complicated, because we're currently defining
_BundlerDebug in our old-style MSBuild logic, which is imported after we
import the .NET build logic.

The end result is that we can either shuffle around a lot of MSBuild code, or
copy a few lines to set the _BundlerDebug property. Neither option makes me
very happy, but copying a few lines of code seemed the better option, so
that's what I did.

Fixes these linkall test failures in Release mode:

    LinkAll.Attributes.AttributeTest
        [FAIL] DebugAssemblyAttributes :   DebuggableAttribute
            Expected: False
            But was:  True
                at LinkAll.Attributes.AttributeTest.DebugAssemblyAttributes()

        [FAIL] DebugConstructorAttributes :   No debug attribute in release mode
            Expected: 0
            But was:  2
                at LinkAll.Attributes.AttributeTest.DebugConstructorAttributes()

        [FAIL] DebugPropertyAttributes :   DebuggerBrowsable
            Expected: False
            But was:  True
                at LinkAll.Attributes.AttributeTest.DebugPropertyAttributes()

        [FAIL] DebugTypeAttributes :   no debug attribute in release mode
            Expected: 0
            But was:  5
                at LinkAll.Attributes.AttributeTest.DebugTypeAttributes()

        [FAIL] DebuggerTypeProxy_24203 :   proxy
            Expected: null
            But was:  <System.Collections.Generic.IDictionaryDebugView`2[K,V]>
                at LinkAll.Attributes.AttributeTest.DebuggerTypeProxy_24203()
2020-09-08 14:55:34 +02:00
Rolf Bjarne Kvinge 9496e6db7e
[dotnet] Define and implement a 'framework' or 'sdk' assembly as an assembly that comes from the .NET BCL NuGet. (#9571)
The Assembly.IsFrameworkAssembly property is used in two places:

* In Driver.IsBoundAssembly to return early when determining if an assembly has any NSObject subclasses: c1c5b9aac6/tools/mtouch/mtouch.cs (L1155-L1168)
* In Assembly.ExtractNativeLinkInfo to return early when looking for assemblies with LinkWith attributes: c1c5b9aac6/tools/common/Assembly.cs (L150-L154)

In both cases this definition of framework assembly works today and seems likely to work in the future as well.

I also went through and looked at all the usages of Profile.IsSdkAssembly, and it's used to:

* Decide which assemblies are selected for "link sdk"
* Decide which assemblies are considered an 'sdk' assembly for creating a user framework of all the sdk assemblies
* Bail out early when deciding whether:
    * An assembly references the product assembly (Xamarin.iOS.dll, etc.)
    * An assembly can contain references to UIWebView
    * An assembly can contain user resources
    * An assembly is a binding project / has third-party native resources
    * An assembly needs the dynamic registrar
    * An assembly has FieldAttributes whose native fields must be preserved by the native linker

In all cases our .NET definition of 'SDK' seems to work both for now and in the future.

There are also a few usages which does not apply to .NET, so I've ignored them:

* When looking for a few BCL APIs that must be preserved (MobileApplyPreserveAttribute.cs): this is to be done in the upstream .NET linker now, so it doesn't apply to our own code
* When linking away parameter names (MonoTouchMarkStep.cs): this is to be done in the upstream .NET linker now, so it doesn't apply to our own code
2020-09-07 18:33:53 +02:00
Rolf Bjarne Kvinge d2788511b6
[dotnet] Use net5.0-[ios|tvos|watchos|macos] TargetFrameworks. (#9532)
* [dotnet] Set TargetPlatformSupported when the right TargetPlatformIdentifier is used.

* [dotnet] Generate a list of valid OS versions for each platform, and add it to the SupportedTargetPlatform item group.

The generated files: https://gist.github.com/rolfbjarne/765c4e4b38b1b017380c9378d9666317

* [dotnet] Define and set the default platform version if it's not set in the TargetFramework variable.

* [dotnet] Switch to using the new-style TargetFramework values.

This includes bumping spouliot/Touch.Unit to get new-style TargetFramework values for Touch.Client.

* spouliot/Touch.Unit@89afaf7 [Touch.Client] Use the right TargetFrameworks for watchOS and macOS as well. (#92)
* spouliot/Touch.Unit@fd0e576 [Touch.Client] Use the right TargetFrameworks. (#91)
* spouliot/Touch.Unit@40f47db [Touch.Client] Add a macOS and watchOS version for .NET. (#90)
* spouliot/Touch.Unit@1d4b8c0 Add .gitignore for NuGet.config and global.json. (#89)
* spouliot/Touch.Unit@49441f3 Call `mlaunch` instead of `mtouch` (#88)
* spouliot/Touch.Unit@b157cf4 Fix a few markdown issues found by markdownlint. (#87)

Diff: d7f55a6167..89afaf7e05

* [dotnet] Document the script that generates the lists of the target platform versions a little bit better.

* [dotnet] Make the [Platform]SupportedTargetPlatform variables public.

This matches how Android and Windows do it:

* https://github.com/xamarin/xamarin-android/pull/5007
* 18ee4eac8b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSupportedTargetPlatforms.props

* [xharness] Update the TargetFramework value when creating project variations.
2020-08-31 09:27:19 +02:00
Rolf Bjarne Kvinge 15ae4595b9
[dotnet] Add support for setting the exception marshalling mode in the GenerateMain step. (#9517)
* [dotnet] Pass exception marshaling options to the linker configuration, and pass it along to the Application instance.

* [dotnet] Write the selected exception marshaling modes to the generated main file.

* [dotnet-linker] Set the default cooperative GC mode.

The code to select the default exception marshalling mode needs it.
2020-08-27 08:27:31 +02:00
Rolf Bjarne Kvinge 0a39dbc682
[dotnet] Make sure the 'BuildOnlySettings' target has been called before any other .NET target we depend on. (#9496)
The 'BuildOnlySettings' target flips a switch that indicates we're doing a
real build, which makes the .NET build logic resolve and publish satellite
assemblies (the switch probably controls a lot of other stuff as well, but
this is where I ran into it).

This is the first of three steps to fix this test failure:

EmbeddedResources.ResourcesTest
    [FAIL] Embedded :   en-AU
        Expected string length 5 but was 7. Strings differ at index 0.
        Expected: "G'day"
        But was:  "Welcome"
        -----------^
            at EmbeddedResources.ResourcesTest.Embedded() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/EmbeddedResources/ResourcesTest.cs:line 45
2020-08-26 08:00:52 +02:00
Rolf Bjarne Kvinge fb40d7e02f
[dotnet] Preserve relative directory when deciding where in the app bundle files should be copied. (#9497)
There may be multiple satellite assemblies with the same name, so make sure to
put them all in the corresponding subdirectory.

This is the second of three steps to fix this test failure:

    EmbeddedResources.ResourcesTest
        [FAIL] Embedded :   en-AU
            Expected string length 5 but was 7. Strings differ at index 0.
            Expected: "G'day"
            But was:  "Welcome"
            -----------^
                at EmbeddedResources.ResourcesTest.Embedded() in [...]/xamarin-macios/tests/EmbeddedResources/ResourcesTest.cs:line 45
2020-08-26 07:54:46 +02:00
Rolf Bjarne Kvinge d49f9d4236
[dotnet/msbuild] Add support for compiling and embedding entitlements to .NET apps. (#9489)
First move the logic to compute the linker arguments for embedding
entitlements into the executable to shared code, so that it can be used from
platform-agnostic .NET code as well.

There is one difference: the code no longer checks if we're building for the
simulator, because the 'CompiledEntitlements' variable won't be set unless
we're in the simulator, so it's no longer needed (it's also not applicable for
Xamarin.Mac).

Also call the _CompileEntitlements target from the .NET build logic, and embed
the result into the executable.

This fixes the following 10 monotouch-tests:

    MonoTouchFixtures.Security.CertificateTest
        [FAIL] GenerateKeyPairTest :   GenerateKeyPair
            Expected: Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.CertificateTest.GenerateKeyPairTest() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/CertificateTest.cs:line 597

    MonoTouchFixtures.Security.KeyChainTest
        [FAIL] AddQueryRemove_Identity :   code
            Expected: DuplicateItem or Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.KeyChainTest.AddQueryRemove_Identity() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/KeyChainTest.cs:line 49

        [FAIL] Add_Certificate :   Add_Certificate
            Expected: Success or DuplicateItem
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.KeyChainTest.Add_Certificate() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/KeyChainTest.cs:line 38

        [FAIL] CheckId :   same guid
            Expected: 00000000-0000-0000-0000-000000000000
            But was:  9c3f0fd6-5c94-46a3-8193-a9fb45209a48
                at MonoTouchFixtures.Security.KeyChainTest.CheckId() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/KeyChainTest.cs:line 171

        [FAIL] SecItemAdd_Identity :   Expected: DuplicateItem or Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.KeyChainTest.SecItemAdd_Identity() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/KeyChainTest.cs:line 91

    MonoTouchFixtures.Security.RecordTest
        [FAIL] Accessible_17579 :   Add
            Expected: Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.RecordTest.Accessible(SecAccessible access) in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 56
                at MonoTouchFixtures.Security.RecordTest.Accessible_17579() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 93

        [FAIL] AuthenticationType_17579 :   Add
            Expected: Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.RecordTest.AuthenticationType(SecAuthenticationType type) in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 174
                at MonoTouchFixtures.Security.RecordTest.AuthenticationType_17579() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 186

        [FAIL] DeskCase_83099_InmutableDictionary :   Password could not be saved to keychain
            Expected: True
            But was:  False
                at MonoTouchFixtures.Security.RecordTest.DeskCase_83099_InmutableDictionary() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 205

        [FAIL] IdentityRecordTest :   Identity added
            Expected: True
            But was:  False
                at MonoTouchFixtures.Security.RecordTest.IdentityRecordTest() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 294

        [FAIL] Protocol_17579 :   Add
            Expected: Success
            But was:  MissingEntitlement
                at MonoTouchFixtures.Security.RecordTest.Protocol(SecProtocol protocol) in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 115
                at MonoTouchFixtures.Security.RecordTest.Protocol_17579() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/Security/RecordTest.cs:line 127
2020-08-25 19:25:32 +02:00
Rolf Bjarne Kvinge de8cc6bbd8
[dotnet-linker] Add Debug to the linker configuration. (#9491) 2020-08-25 18:40:59 +02:00
Rolf Bjarne Kvinge ab47edcb27
[dotnet] Implement resource bundling. (#9472)
* Port the BundledResources test to .NET.
* Fix a minor issue in the BundledResources test to make sure it works on macOS.
* Add a unit test to make sure resources are bundled as expected.
* Modify the .NET build logic to bundle/unbundle resources.
2020-08-25 13:14:01 +02:00
Rolf Bjarne Kvinge b4da54ea6d Merge remote-tracking branch 'origin/main' into dotnet-partial-static-registrar 2020-08-24 17:56:42 +02:00
Rolf Bjarne Kvinge c21ae4412a
[dotnet] It's time to start signing apps. (#9469)
Also make sure that _CompileToNative never runs in .NET mode (some of the
signing targets has _CompileToNative as a dependency, but _CompileToNative
must never be run when in .NET mode).
2020-08-24 17:54:07 +02:00
Rolf Bjarne Kvinge 4430654e27
[dotnet] Copy the app.config file to the app bundle. (#9468)
Fixes this monotouch-test failure:

    MonoTouchFixtures.ConfigTest
        [FAIL] Existence :   existence
           Expected: True
           But was:  False
               at MonoTouchFixtures.ConfigTest.Existence() in /Users/rolf/work/maccore/squashed-onedotnet/xamarin-macios/tests/monotouch-test/mono/ConfigTest.cs:line 19
2020-08-24 17:53:30 +02:00
Rolf Bjarne Kvinge d7ab847697
[dotnet] Implement support for our different link modes. (#9460)
* [mmp] Rename LinkMode.All to LinkMode.Full.

So that we can continue to use Enum.Parse<LinkMode> to parse 'Full' as the link mode.

* [dotnet] Implement support for our different link modes.

Tell the managed linker what to do with each input assembly depending the selected
link mode (link all, link sdk, don't link).
2020-08-24 17:50:42 +02:00
Rolf Bjarne Kvinge ffea143135 [dotnet-linker] Add a Registrar step, and implement support for the partial static registrar.
Add a Registrar step that is responsible for dealing with the registrar during the
build. Currently only supports the dynamic and partial static registrar, the full
static registrar support will come later.
2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge 174260cb4e [dotnet-linker] Compute the path to the partial static registry library, and add it to our configuration. 2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge 7a19a82b65 [dotnet-linker] Add LinkMode to our configuration. 2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge fa50f40bea
[dotnet] Add support for resolving Mono's runtime pack. (#9421)
This is a temporary solution, until .NET provides a way for us to select which
runtime pack to use.

Also ensure that we're using Mono's dynamic libraries (as opposed to static
libraries) when building for macOS.
2020-08-21 10:14:23 +02:00
Rolf Bjarne Kvinge 9a4f5cf388
[dotnet] Turn the linker off by default for simulator builds. (#9403)
This becomes a bit complicated because we have to wait to determine the default value
for the linker until we know if we're building for the simulator or not (which happens
in the _DetectSdkLocations target).
2020-08-20 14:26:43 +02:00
Rolf Bjarne Kvinge b8482ca160 [dotnet] Read native linker flags from binding libraries from the managed linker. 2020-08-14 18:33:29 +02:00
Rolf Bjarne Kvinge 3046ebc1d6 [dotnet-linker] Add TargetFramework to the configuration and set Driver.TargetFramework.
This way we can use the shared Application.Platform implementation.
2020-08-14 18:33:29 +02:00
Rolf Bjarne Kvinge 4e1b571ab6 [msbuild] Pass the path to the binding attribute assembly to bgen. 2020-08-10 16:12:41 +02:00
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 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