Skip to content
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

[dotnet] Add support for universal apps. #11983

Merged
merged 44 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
87de6ea
[runtime] Add support for finding assemblies in an RID-specific subdi…
rolfbjarne May 25, 2021
6fe54cb
[dotnet] Only trim when building a specific RuntimeIdentifier.
rolfbjarne May 21, 2021
9a9562c
[tests] Add unified simple test app for all platforms we support.
rolfbjarne Jun 15, 2021
0021c2b
[MachO] Make StaticLibrary.IsStaticLibrary work with files shorter th…
rolfbjarne May 21, 2021
7aec86f
ools] Create a PathUtils class and move some shareable code there.
rolfbjarne May 21, 2021
0af6ec5
[MachO] Add a MachO.IsMachOFile method
rolfbjarne May 21, 2021
ba83560
[tools] Move parts of the binary file comparison to a helper file to …
rolfbjarne May 21, 2021
f864ff3
[tools] Move another IsUptodate overload to the FileCopier file to in…
rolfbjarne Jun 16, 2021
5955cd1
[tests] Add a complex test library project with resources and app con…
rolfbjarne May 21, 2021
724d0fe
[dotnet] Set a default RuntimeIdentifier and validate that we get a v…
rolfbjarne Jun 14, 2021
e1f31c6
[tests] Quote parameters containing semicolons when passed to 'dotnet…
rolfbjarne May 21, 2021
003cf30
[dotnet] Don't execute ComputeResolvedFileToPublishList if we're in t…
rolfbjarne May 21, 2021
5c50a2f
[msbuild] Implement a MergeAppBundles task to merge two (or more) app…
rolfbjarne May 21, 2021
4f8e9a8
[tests] Add new tests for merging app bundles
rolfbjarne May 21, 2021
91311a0
[dotnet] Implement support for multiple RuntimeIdentifiers.
rolfbjarne May 21, 2021
81b139e
[dotnet] Ignore RuntimeIdentifier if RuntimeIdentifiers is set.
rolfbjarne Jun 16, 2021
62865cb
Merge remote-tracking branch 'origin/main' into HEAD
rolfbjarne Jun 21, 2021
a32d605
[msbuild] Fix symlink check to check for file presence first.
rolfbjarne Jun 18, 2021
4526a5e
[msbuild] Copy directories correctly.
rolfbjarne Jun 18, 2021
bc9e007
[tests] Updated list of not-yet-localized error messages.
rolfbjarne Jun 18, 2021
718d954
[tests] Improve error reporting when SetUp fails in MergeAppBundleTas…
rolfbjarne Jun 21, 2021
f1cc00c
[tests] Update tests according to the actual error messages.
rolfbjarne Jun 21, 2021
7179cac
[dotnet] Set the default RuntimeIdentifier earlier.
rolfbjarne Jun 21, 2021
2f1667e
[tests] Remove MSBuildSDKsPath from the environment before invoking m…
rolfbjarne Jun 22, 2021
70d0f86
Merge remote-tracking branch 'origin/main' into HEAD
rolfbjarne Jun 23, 2021
889cf99
[dotnet] Compile entitlements before signing the merged app bundle.
rolfbjarne Jun 22, 2021
5ecb7ae
[msbuild] List all files causing errors.
rolfbjarne Jun 23, 2021
2a203b5
[msbuild] Compute input files slightly differently for CreateMergedAp…
rolfbjarne Jun 23, 2021
f6e9f55
[runtime] Add a xamarin_locate_app_resource function.
rolfbjarne Jun 23, 2021
608dfb3
[dotnet] Make the globalization data file an architecture-specific file.
rolfbjarne Jun 23, 2021
a78be0a
[dotnet] Ignore Info.plist files from the input app bundles when merg…
rolfbjarne Jun 23, 2021
e68831b
[dotnet] Compile the app manifest in the outer build for multi-rid apps.
rolfbjarne Jun 23, 2021
7f505c3
[dotnet] Rework how we compute the TargetArchitectures property.
rolfbjarne Jun 23, 2021
9f82694
[msbuild] Use the same prefix in ErrorHelper as we do in other MSBuil…
rolfbjarne Jun 24, 2021
df369da
[MachO] Simplify code a bit according to review.
rolfbjarne Jun 24, 2021
c5dad31
[dotnet] Don't create debug settings / configurations for inner builds.
rolfbjarne Jun 24, 2021
1fa1cf3
[dotnet] Use the correct relative paths for Info.plist for all platfo…
rolfbjarne Jun 24, 2021
82fc13e
[tests] Fix assertions regarding errors after recent changes.
rolfbjarne Jun 24, 2021
9a406d2
[tests] Fix makefile for ComplexAssembly to do nothing on a rebuild.
rolfbjarne Jun 24, 2021
2f65937
[tests] Remove BOM in new file.
rolfbjarne Jun 24, 2021
3497373
[dotnet] Compute 'ComputedPlatform' correctly for outer multi-rid bui…
rolfbjarne Jun 24, 2021
31b48eb
[tests] Copy more supporting files for building monotouch-test with .…
rolfbjarne Jun 24, 2021
6d6db24
[dotnet] Use relative paths in a few places.
rolfbjarne Jun 24, 2021
8aff15a
[tests] Don't run parallel make in tests/common/TestProjects/ComplexA…
rolfbjarne Jun 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 35 additions & 23 deletions dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,45 @@
<TargetArchitectures Condition=" '$(_PlatformName)' != 'macOS' And '$(MtouchArch)' != '' ">$(MtouchArch)</TargetArchitectures>
</PropertyGroup>
<!-- If the old-style variables aren't set, figure it out using RuntimeIdentifier. -->
<!-- This is a variation of https://github.com/dotnet/sdk/blob/873d79d861cbd001488414b9875e53acbeaed890/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets#L68-L96 -->
<!-- This doesn't cover every single possibility (in particular it does not handle ARMv7s, either as a thin or fat option, and the same for ARMv7k), but that can be done by passing /p:TargetArchitectures=ARMv7s to msbuild -->
<PropertyGroup Condition=" '$(TargetArchitectures)' == '' And '$(_PlatformName)' == 'iOS' ">
<TargetArchitectures Condition=" $(RuntimeIdentifier.EndsWith('-arm64')) Or $(RuntimeIdentifier.Contains('-arm64-')) ">ARM64</TargetArchitectures>
<TargetArchitectures Condition=" $(RuntimeIdentifier.EndsWith('-x64')) Or $(RuntimeIdentifier.Contains('-x64-')) ">x86_64</TargetArchitectures>
<TargetArchitectures Condition=" $(RuntimeIdentifier.EndsWith('-x86')) Or $(RuntimeIdentifier.Contains('-x86-')) ">i386</TargetArchitectures>
<TargetArchitectures Condition=" $(RuntimeIdentifier.EndsWith('-arm')) Or $(RuntimeIdentifier.Contains('-arm-')) ">ARMv7</TargetArchitectures>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetArchitectures)' == '' And '$(_PlatformName)' == 'tvOS' ">
<TargetArchitectures Condition=" $(RuntimeIdentifier.EndsWith('-arm64')) Or $(RuntimeIdentifier.Contains('-arm64-')) ">ARM64</TargetArchitectures>
<TargetArchitectures Condition=" $(RuntimeIdentifier.EndsWith('-x64')) Or $(RuntimeIdentifier.Contains('-x64-')) ">x86_64</TargetArchitectures>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetArchitectures)' == '' And '$(_PlatformName)' == 'watchOS' ">
<TargetArchitectures Condition=" $(RuntimeIdentifier.EndsWith('-x86')) Or $(RuntimeIdentifier.Contains('-x86-')) ">i386</TargetArchitectures>
<TargetArchitectures Condition=" $(RuntimeIdentifier.EndsWith('-arm')) Or $(RuntimeIdentifier.Contains('-arm-')) ">ARM64_32</TargetArchitectures>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetArchitectures)' == '' And '$(_PlatformName)' == 'macOS' ">
<TargetArchitectures Condition=" '$(RuntimeIdentifier)' == 'osx-x64' ">x86_64</TargetArchitectures>
<TargetArchitectures Condition=" '$(RuntimeIdentifier)' == 'osx-arm64' ">ARM64</TargetArchitectures>
<PropertyGroup Condition="'$(RuntimeIdentifiers)' != '' And '$(RuntimeIdentifier)' != '' ">
<!-- Check if both RuntimeIdentifier and RuntimeIdentifiers are set, in which case we clear RuntimeIdentifier -->
<!-- Also set a variable that says if this happens, so that we can show a warning later -->
<_RuntimeIdentifiersClashMessage>Both RuntimeIdentifier and RuntimeIdentifiers are set. The value for RuntimeIdentifier will be ignored.</_RuntimeIdentifiersClashMessage>
<!-- Clear RuntimeIdentifier -->
<RuntimeIdentifier />
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetArchitectures)' == '' And '$(_PlatformName)' == 'MacCatalyst' ">
<TargetArchitectures Condition=" '$(RuntimeIdentifier)' == 'maccatalyst-x64' ">x86_64</TargetArchitectures>
<TargetArchitectures Condition=" '$(RuntimeIdentifier)' == 'maccatalyst-arm64' ">ARM64</TargetArchitectures>

<PropertyGroup>
<_ComputeTargetArchitecturesDependsOn>
$(_ComputeTargetArchitecturesDependsOn);
_MapRuntimeIdentifierToTargetArchitecture
</_ComputeTargetArchitecturesDependsOn>
</PropertyGroup>

<!-- Map RuntimeIdentifier(s) to TargetArchitectures, which is what our old targets and tasks expect -->
<!-- This doesn't cover every single possibility (in particular it does not handle ARMv7s, either as a thin or fat option, and the same for ARMv7k), but that can be done by passing /p:TargetArchitectures=ARMv7s to msbuild -->
<Target Name="_MapRuntimeIdentifierToTargetArchitecture" Condition="'$(TargetArchitectures)' == ''">
<ItemGroup>
<!-- Convert RuntimeIdentifiers (a property) to an item group -->
<_RuntimeIdentifierWithTargetArchitecture Include="$(RuntimeIdentifiers);$(RuntimeIdentifier)" />
<!-- map the runtime identifier to a target architecture -->
<_RuntimeIdentifierWithTargetArchitecture Update="@(_RuntimeIdentifierWithTargetArchitecture)">
<TargetArchitecture Condition=" $([System.String]::Copy('%(Identity)').EndsWith('-arm64')) ">ARM64</TargetArchitecture>
<TargetArchitecture Condition=" $([System.String]::Copy('%(Identity)').EndsWith('-arm')) ">ARMv7</TargetArchitecture>
<TargetArchitecture Condition=" $([System.String]::Copy('%(Identity)').EndsWith('-x64')) ">x86_64</TargetArchitecture>
<TargetArchitecture Condition=" $([System.String]::Copy('%(Identity)').EndsWith('-x86')) ">i386</TargetArchitecture>
</_RuntimeIdentifierWithTargetArchitecture>
<_RuntimeIdentifiersWithoutTargetArchitecture Include="@(_RuntimeIdentifierWithTargetArchitecture)" Condition="'%(_RuntimeIdentifierWithTargetArchitecture.TargetArchitecture)' == ''" />
</ItemGroup>
<Error Condition="@(_RuntimeIdentifiersWithoutTargetArchitecture->Count()) != 0" Text="Unable to map the following RuntimeIdentifier values to a target architecture: @(_RuntimeIdentifiersWithoutTargetArchitecture)" />
<!-- Map the item group of runtime identifiers into the TargetArchitectures property -->
<PropertyGroup>
<TargetArchitectures>@(_RuntimeIdentifierWithTargetArchitecture -> '%(TargetArchitecture)', ', ')</TargetArchitectures>
</PropertyGroup>
</Target>

<PropertyGroup Condition="'$(ComputedPlatform)' == '' And ('$(_PlatformName)' == 'iOS' Or '$(_PlatformName)' == 'tvOS' Or '$(_PlatformName)' == 'watchOS') ">
<ComputedPlatform Condition="$(TargetArchitectures.Contains('i386')) Or $(TargetArchitectures.Contains('x86_64'))">iPhoneSimulator</ComputedPlatform>
<ComputedPlatform Condition="$(RuntimeIdentifier.Contains('simulator')) Or $(RuntimeIdentifiers.Contains('simulator'))">iPhoneSimulator</ComputedPlatform>
<ComputedPlatform Condition="'$(ComputedPlatform)' == ''">iPhone</ComputedPlatform>
</PropertyGroup>

Expand Down
25 changes: 25 additions & 0 deletions dotnet/targets/Xamarin.Shared.Sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,29 @@
<!-- We don't need any dependency files -->
<GenerateDependencyFile Condition="'$(GenerateDependencyFile)' == ''">false</GenerateDependencyFile>
</PropertyGroup>

<!-- Set the default RuntimeIdentifier if not already specified. -->
<PropertyGroup Condition=" '$(RuntimeIdentifier)' == '' And '$(RuntimeIdentifiers)' == '' ">
<RuntimeIdentifier Condition="'$(_PlatformName)' == 'iOS'">iossimulator-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(_PlatformName)' == 'tvOS'">tvossimulator-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(_PlatformName)' == 'macOS'">osx-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(_PlatformName)' == 'MacCatalyst'">maccatalyst-x64</RuntimeIdentifier>
<!--
Workaround/hack:

The Microsoft.NET.RuntimeIdentifierInference.targets file is loaded
before this file, and executes some logic depending on whether the
RuntimeIdentifier is set or not. Since RuntimeIdentifier isn't set at
that point (we're setting it here), we need to replicate the logic in
the Microsoft.NET.RuntimeIdentifierInference.targets file to make sure
things work as expected.

Ref: https://github.com/dotnet/runtime/issues/54406
-->
<SelfContained>true</SelfContained>
<_RuntimeIdentifierUsesAppHost>false</_RuntimeIdentifierUsesAppHost>
<UseAppHost>false</UseAppHost>
<IntermediateOutputPath>$(IntermediateOutputPath)$(RuntimeIdentifier)\</IntermediateOutputPath>
<OutputPath>$(OutputPath)$(RuntimeIdentifier)\</OutputPath>
</PropertyGroup>
</Project>
Loading