Skip to content

Commit

Permalink
Set UseMonoRuntime property so the dotnet SDK can pull the mono runti…
Browse files Browse the repository at this point in the history
…me packs

This is necessary after the changes from dotnet/sdk#16909.
  • Loading branch information
akoeplinger committed Jun 10, 2021
1 parent 77da330 commit f2ddc6d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
3 changes: 3 additions & 0 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<RuntimeFlavor Condition="'$(TargetsMobile)' == 'true'">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == '' and ($(_subset.Contains('+mono+')) or $(_subset.Contains('+mono.runtime+'))) and (!$(_subset.Contains('+clr+')) and !$(_subset.Contains('+clr.runtime+')))">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == ''">CoreCLR</RuntimeFlavor>

<!-- this property is used by the SDK to pull in mono-based runtime packs -->
<UseMonoRuntime Condition="'$(UseMonoRuntime)' == '' and '$(RuntimeFlavor)' == 'Mono'">true</UseMonoRuntime>
</PropertyGroup>

<PropertyGroup>
Expand Down
11 changes: 9 additions & 2 deletions eng/targetingpacks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@
<ItemGroup Condition="'$(UseLocalTargetingRuntimePack)' == 'true'">
<KnownFrameworkReference Include="$(LocalFrameworkOverrideName)"
DefaultRuntimeFrameworkVersion="$(ProductVersion)"
IsTrimmable="true"
LatestRuntimeFrameworkVersion="$(ProductVersion)"
RuntimeFrameworkName="$(LocalFrameworkOverrideName)"
RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.**RID**"
RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;ios-arm64;iossimulator-arm64;ios-arm;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;maccatalyst-x64;maccatalyst-arm64;android-arm64;android-arm;android-x64;android-x86;browser-wasm;osx-arm64"
RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64"
TargetFramework="$(NetCoreAppCurrent)"
TargetingPackName="$(LocalFrameworkOverrideName).Ref"
TargetingPackVersion="$(ProductVersion)"
Condition="'@(KnownFrameworkReference)' == '' or !@(KnownFrameworkReference->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))" />
<KnownRuntimePack Include="$(LocalFrameworkOverrideName)"
TargetFramework="$(NetCoreAppCurrent)"
RuntimeFrameworkName="$(LocalFrameworkOverrideName)"
LatestRuntimeFrameworkVersion="$(ProductVersion)"
RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.Mono.**RID**"
RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86"
RuntimePackLabels="Mono"
Condition="'@(KnownRuntimePack)' == '' or !@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"/>
<KnownAppHostPack Include="$(LocalFrameworkOverrideName)"
AppHostPackNamePattern="$(LocalFrameworkOverrideName).Host.**RID**"
AppHostPackVersion="$(ProductVersion)"
Expand Down
3 changes: 3 additions & 0 deletions eng/testing/linker/SupportFiles/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@

<ItemGroup>
<FrameworkReference Include="Microsoft.NETCore.App" />
<FrameworkReference Update="Microsoft.NETCore.App"
RuntimePackLabels="Mono"
Condition="'$(UseMonoRuntime)' == 'true'" />

This comment has been minimized.

Copy link
@ViktorHofer

ViktorHofer Jun 10, 2021

Member

Why is that necessary? Doesn't the SDK add that FrameworkReference?

This comment has been minimized.

Copy link
@akoeplinger

akoeplinger Jun 10, 2021

Author Member

No, because we set <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences> on line 13

</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions eng/testing/linker/project.csproj.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<RepositoryEngineeringDir>{RepositoryEngineeringDir}</RepositoryEngineeringDir>
<TargetFramework>{NetCoreAppCurrent}</TargetFramework>
<RuntimeIdentifier>{RuntimeIdentifier}</RuntimeIdentifier>
<UseMonoRuntime>{UseMonoRuntime}</UseMonoRuntime>

This comment has been minimized.

Copy link
@ViktorHofer

ViktorHofer Jun 10, 2021

Member

Note to myself: The linker projects should use the targetingpack.targets infrastructure as that will also help when we version to NET7.

<TargetingPackDir>{TargetingPackDir}</TargetingPackDir>
<NETCoreAppMaximumVersion>{NetCoreAppMaximumVersion}</NETCoreAppMaximumVersion>
<MicrosoftNETCoreAppVersion>{MicrosoftNETCoreAppVersion}</MicrosoftNETCoreAppVersion>
Expand Down
1 change: 1 addition & 0 deletions eng/testing/linker/trimmingTests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
.Replace('{NetCoreAppMaximumVersion}', '$(NetCoreAppMaximumVersion)')
.Replace('{TargetingPackDir}','$(MicrosoftNetCoreAppRefPackDir)')
.Replace('{RuntimeIdentifier}','%(TestConsoleApps.TestRuntimeIdentifier)')
.Replace('{UseMonoRuntime}','$(UseMonoRuntime)')
.Replace('{MicrosoftNETILLinkTasksVersion}', '$(MicrosoftNETILLinkTasksVersion)')
.Replace('{ExtraTrimmerArgs}', '%(TestConsoleApps.ExtraTrimmerArgs)')
.Replace('{AdditionalProjectReferences}', '$(_additionalProjectReferencesString)')
Expand Down
10 changes: 0 additions & 10 deletions src/mono/sample/Android/AndroidSampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@
<ForceAOT Condition="'$(ForceAOT)' == ''">false</ForceAOT>
</PropertyGroup>

<!-- Redirect 'dotnet publish' to in-tree runtime pack -->
<Target Name="TrickRuntimePackLocation" AfterTargets="ProcessFrameworkReferences">
<ItemGroup>
<RuntimePack>
<PackageDirectory>$(ArtifactsBinDir)microsoft.netcore.app.runtime.$(RuntimeIdentifier)\$(Configuration)</PackageDirectory>
</RuntimePack>
</ItemGroup>
<Message Text="Packaged ID: %(RuntimePack.PackageDirectory)" Importance="high" />
</Target>

<Import Project="$(RepoTasksDir)AotCompilerTask\MonoAOTCompiler.props" />
<UsingTask TaskName="AndroidAppBuilderTask" AssemblyFile="$(AndroidAppBuilderTasksAssemblyPath)"/>
<UsingTask TaskName="MonoAOTCompiler" AssemblyFile="$(MonoAOTCompilerTasksAssemblyPath)" />
Expand Down

0 comments on commit f2ddc6d

Please sign in to comment.