-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mono.Android] Obsolete [LinkerSafe] #6054
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes: dotnet#5639 Context: https://github.com/mono/linker/blob/84338086c5f36f4847b85242b1c8c2d3ea7177ac/docs/design/trimmed-assemblies.md#assemblymetadataistrimmable-true The `Android.LinkerSafeAttribute` custom attribute is beening replaced by the [`System.Reflection.AssemblyMetadataAttribute`][0] custom attribute, with a `Key` of `"IsTrimmable"` and a `Value` of `"True"`: // Old-and-busted [assembly: Android.LinkerSafe] // New hotness: [assembly: global::System.Reflection.AssemblyMetadata("IsTrimmable", "True")] `AssemblyMetadataAttribute` is more portable, part of .NET Standard 1.0 and above, with linker support in .NET 5+. It should thus be preferred over `Android.LinkerSafeAttribute`. [0]: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assemblymetadataattribute?view=net-5.0
jonathanpeppers
approved these changes
Jun 30, 2021
jonathanpeppers
pushed a commit
that referenced
this pull request
Jun 30, 2021
Fixes: #5639 Context: https://github.com/mono/linker/blob/84338086c5f36f4847b85242b1c8c2d3ea7177ac/docs/design/trimmed-assemblies.md#assemblymetadataistrimmable-true The `Android.LinkerSafeAttribute` custom attribute is beening replaced by the [`System.Reflection.AssemblyMetadataAttribute`][0] custom attribute, with a `Key` of `"IsTrimmable"` and a `Value` of `"True"`: // Old-and-busted [assembly: Android.LinkerSafe] // New hotness: [assembly: global::System.Reflection.AssemblyMetadata("IsTrimmable", "True")] `AssemblyMetadataAttribute` is more portable, part of .NET Standard 1.0 and above, with linker support in .NET 5+. It should thus be preferred over `Android.LinkerSafeAttribute`. [0]: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assemblymetadataattribute?view=net-5.0
jonathanpeppers
added a commit
to dotnet/maui
that referenced
this pull request
Jul 1, 2021
Context: dotnet/android#6054 This solves the warning (that is turned into an error): src/Essentials/src/AssemblyInfo/AssemblyInfo.android.cs(3,12): error CS0618: 'LinkerSafeAttribute' is obsolete: 'For .NET 6+, please use: [assembly: global::System.Reflection.AssemblyMetadata("IsTrimmable", "True")]'
Redth
pushed a commit
to dotnet/maui
that referenced
this pull request
Jul 2, 2021
* Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-03b91941bf31a562b3243d3ac76846f0bac71636-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.53 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21323.1 (parent: Microsoft.Android.Sdk.Windows * [build] set %TEMP% and %TMP% Context: dotnet/sdk#18516 Attempts to workaround the failure: > D:\agent\1\s\bin\dotnet\dotnet workload install microsoft-android-sdk-full --skip-manifest-update --verbosity diag ... Workload installation failed: Source and destination path must have identical roots. Move will not work across volumes. If `dotnet` is in `D:\agent\1\s\bin\dotnet\dotnet` and `%TEMP%` is `C:\Users\XAMARI~1\AppData\Local\Temp`, this seems to fail. Setting `%TEMP%` to `.\bin\temp` in the current directory instead. * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-d515a1c8112c700ae9f22f9c27829cf54a79931e-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.54 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21323.1 (parent: Microsoft.Android.Sdk.Windows * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-9bc7166b808aa4c4456c960adb127970d9580fa1-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.55 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21324.9 (parent: Microsoft.Android.Sdk.Windows * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-f57c5c2a195d47a699a4043aa7ba5b3000278531-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.56 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21328.1 (parent: Microsoft.Android.Sdk.Windows * Update dependencies from https://github.com/xamarin/xamarin-macios build 20210629.4 Microsoft.macOS.Sdk , Microsoft.MacCatalyst.Sdk , Microsoft.iOS.Sdk , Microsoft.tvOS.Sdk From Version 12.0.100-preview.6.60 -> To Version 12.0.100-preview.6.61 * Enable runtimeconfig.json support We should no longer need to set `$(GenerateRuntimeConfigurationFiles)` to `false`. * Install `microsoft-net-runtime-maccatalyst` manually Context: https://github.com/xamarin/xamarin-macios/blob/a64b030fcc06da4a12b0b7e3580c9d349c14daaf/dotnet/targets/WorkloadManifest.MacCatalyst.template.json Currently, the build fails with: error NETSDK1147: To build this project, the following workloads must be installed: microsoft-net-runtime-maccatalyst It appears we are missing an `extends` for some xamarin-macios workloads. * Revert "Install `microsoft-net-runtime-maccatalyst` manually" This reverts commit 7e10ac4. * Manually patch MacCatalyst & iOS workload files Context: https://github.com/dotnet/runtime/blob/d4baa2bd2b009cdd0886bba925ce32517041bfa0/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets Previously I just tried installing an extra workload: Workload with id microsoft-net-runtime-maccatalyst is not supported on this platform. This workload will not install on Windows. For now I can just patch the `WorkloadManifest.json` from xamarin/xamarin-macios to depend on the missing workload. Even after this, usage of `Microsoft.NETCore.App.Runtime.AOT.Cross` in the dotnet/runtime `WorkloadManifest.targets` fails on Windows: <Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.maccatalyst" /> ... <Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm" /> <Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm64" /> I can manually patch these files with a condition to not do this on Windows. * Set %TMP% and %TEMP% in another spot * For now, include missing workload in maui-maccatalyst * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-3ed60bd3e4728f2ee08c6ceae1091d476743b5f0-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.58 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21328.1 (parent: Microsoft.Android.Sdk.Windows * Update dependencies from https://github.com/xamarin/xamarin-macios build 20210630.10 Microsoft.macOS.Sdk , Microsoft.MacCatalyst.Sdk , Microsoft.iOS.Sdk , Microsoft.tvOS.Sdk From Version 12.0.100-preview.6.60 -> To Version 12.0.100-preview.6.62 * Revert "For now, include missing workload in maui-maccatalyst" This reverts commit 6eeee59. * No longer need to patch microsoft.net.sdk.maccatalyst/WorkloadManifest.json * Use --temp-dir switch instead of $TMP/$TEMP env vars * [essentials] use AssemblyMetadata w/ IsTrimmable instead of Linkersafe Context: dotnet/android#6054 This solves the warning (that is turned into an error): src/Essentials/src/AssemblyInfo/AssemblyInfo.android.cs(3,12): error CS0618: 'LinkerSafeAttribute' is obsolete: 'For .NET 6+, please use: [assembly: global::System.Reflection.AssemblyMetadata("IsTrimmable", "True")]' * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-52a34e9c48bad7ae2cb16d28af9700f605163dda-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.60 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21329.10 (parent: Microsoft.Android.Sdk.Windows * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-ac0333b7828fd72de2afb43c67d8212f18d5be43-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.61 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21351.1 (parent: Microsoft.Android.Sdk.Windows Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com> Co-authored-by: Rui Marinho <me@ruimarinho.net> Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
maxkatz6
pushed a commit
to AvaloniaUI/Avalonia.Essentials
that referenced
this pull request
May 15, 2023
* Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-03b91941bf31a562b3243d3ac76846f0bac71636-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.53 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21323.1 (parent: Microsoft.Android.Sdk.Windows * [build] set %TEMP% and %TMP% Context: dotnet/sdk#18516 Attempts to workaround the failure: > D:\agent\1\s\bin\dotnet\dotnet workload install microsoft-android-sdk-full --skip-manifest-update --verbosity diag ... Workload installation failed: Source and destination path must have identical roots. Move will not work across volumes. If `dotnet` is in `D:\agent\1\s\bin\dotnet\dotnet` and `%TEMP%` is `C:\Users\XAMARI~1\AppData\Local\Temp`, this seems to fail. Setting `%TEMP%` to `.\bin\temp` in the current directory instead. * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-d515a1c8112c700ae9f22f9c27829cf54a79931e-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.54 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21323.1 (parent: Microsoft.Android.Sdk.Windows * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-9bc7166b808aa4c4456c960adb127970d9580fa1-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.55 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21324.9 (parent: Microsoft.Android.Sdk.Windows * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-f57c5c2a195d47a699a4043aa7ba5b3000278531-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.56 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21328.1 (parent: Microsoft.Android.Sdk.Windows * Update dependencies from https://github.com/xamarin/xamarin-macios build 20210629.4 Microsoft.macOS.Sdk , Microsoft.MacCatalyst.Sdk , Microsoft.iOS.Sdk , Microsoft.tvOS.Sdk From Version 12.0.100-preview.6.60 -> To Version 12.0.100-preview.6.61 * Enable runtimeconfig.json support We should no longer need to set `$(GenerateRuntimeConfigurationFiles)` to `false`. * Install `microsoft-net-runtime-maccatalyst` manually Context: https://github.com/xamarin/xamarin-macios/blob/a64b030fcc06da4a12b0b7e3580c9d349c14daaf/dotnet/targets/WorkloadManifest.MacCatalyst.template.json Currently, the build fails with: error NETSDK1147: To build this project, the following workloads must be installed: microsoft-net-runtime-maccatalyst It appears we are missing an `extends` for some xamarin-macios workloads. * Revert "Install `microsoft-net-runtime-maccatalyst` manually" This reverts commit 7e10ac4ab0d6efff5254e21f91284ee06bb4dd50. * Manually patch MacCatalyst & iOS workload files Context: https://github.com/dotnet/runtime/blob/d4baa2bd2b009cdd0886bba925ce32517041bfa0/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets Previously I just tried installing an extra workload: Workload with id microsoft-net-runtime-maccatalyst is not supported on this platform. This workload will not install on Windows. For now I can just patch the `WorkloadManifest.json` from xamarin/xamarin-macios to depend on the missing workload. Even after this, usage of `Microsoft.NETCore.App.Runtime.AOT.Cross` in the dotnet/runtime `WorkloadManifest.targets` fails on Windows: <Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.maccatalyst" /> ... <Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm" /> <Import Project="Sdk.props" Sdk="Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm64" /> I can manually patch these files with a condition to not do this on Windows. * Set %TMP% and %TEMP% in another spot * For now, include missing workload in maui-maccatalyst * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-3ed60bd3e4728f2ee08c6ceae1091d476743b5f0-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.58 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21328.1 (parent: Microsoft.Android.Sdk.Windows * Update dependencies from https://github.com/xamarin/xamarin-macios build 20210630.10 Microsoft.macOS.Sdk , Microsoft.MacCatalyst.Sdk , Microsoft.iOS.Sdk , Microsoft.tvOS.Sdk From Version 12.0.100-preview.6.60 -> To Version 12.0.100-preview.6.62 * Revert "For now, include missing workload in maui-maccatalyst" This reverts commit 6eeee590ed60b8b082c8397cfd7b00ab67c02654. * No longer need to patch microsoft.net.sdk.maccatalyst/WorkloadManifest.json * Use --temp-dir switch instead of $TMP/$TEMP env vars * [essentials] use AssemblyMetadata w/ IsTrimmable instead of Linkersafe Context: dotnet/android#6054 This solves the warning (that is turned into an error): src/Essentials/src/AssemblyInfo/AssemblyInfo.android.cs(3,12): error CS0618: 'LinkerSafeAttribute' is obsolete: 'For .NET 6+, please use: [assembly: global::System.Reflection.AssemblyMetadata("IsTrimmable", "True")]' * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-52a34e9c48bad7ae2cb16d28af9700f605163dda-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.60 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21329.10 (parent: Microsoft.Android.Sdk.Windows * Update dependencies from https://github.com/xamarin/xamarin-android build 6.0.1xx-preview6-ac0333b7828fd72de2afb43c67d8212f18d5be43-1 Microsoft.Android.Sdk.Windows From Version 30.0.100-preview.6.51 -> To Version 30.0.100-preview.6.61 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal,Microsoft.NETCore.App.Ref From Version 6.0.100-preview.6.21313.2 -> To Version 6.0.100-preview.6.21351.1 (parent: Microsoft.Android.Sdk.Windows Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com> Co-authored-by: Rui Marinho <me@ruimarinho.net> Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #5639
Context: https://github.com/mono/linker/blob/84338086c5f36f4847b85242b1c8c2d3ea7177ac/docs/design/trimmed-assemblies.md#assemblymetadataistrimmable-true
The
Android.LinkerSafeAttribute
custom attribute is beeningreplaced by the
System.Reflection.AssemblyMetadataAttribute
custom attribute, with a
Key
of"IsTrimmable"
and aValue
of"True"
:AssemblyMetadataAttribute
is more portable, part of.NET Standard 1.0 and above, with linker support in .NET 5+.
It should thus be preferred over
Android.LinkerSafeAttribute
.