Skip to content

Commit

Permalink
Move UpdateRuntimeJson out of props file into Microsoft.NETCore.Platf…
Browse files Browse the repository at this point in the history
…orms project file (#57500)

* Update runtimeGroups.props

* Update Microsoft.NETCore.Platforms.csproj
  • Loading branch information
ViktorHofer authored Aug 18, 2021
1 parent e374189 commit ab0f54a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<NoWarn>$(NoWarn);NU5128</NoWarn> <!-- No Dependencies-->
<PackageDescription>Provides runtime information required to resolve target framework, platform, and runtime specific implementations of .NETCore packages.</PackageDescription>
<BeforePack>GenerateRuntimeJson;UpdateRuntimeJson;$(BeforePack)</BeforePack>

<_generateRuntimeGraphTargetFramework Condition="'$(MSBuildRuntimeType)' == 'core'">$(NetCoreAppToolCurrent)</_generateRuntimeGraphTargetFramework>
<_generateRuntimeGraphTargetFramework Condition="'$(MSBuildRuntimeType)' != 'core'">net472</_generateRuntimeGraphTargetFramework>
<_generateRuntimeGraphTask>$([MSBuild]::NormalizePath('$(BaseOutputPath)', '$(_generateRuntimeGraphTargetFramework)-$(Configuration)', '$(AssemblyName).dll'))</_generateRuntimeGraphTask>
<!-- When building from source, ensure the RID we're building for is part of the RID graph -->
<AdditionalRuntimeIdentifiers Condition="'$(DotNetBuildFromSource)' == 'true'">$(AdditionalRuntimeIdentifiers);$(OutputRID)</AdditionalRuntimeIdentifiers>
</PropertyGroup>
Expand Down Expand Up @@ -48,15 +52,30 @@
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(RefOnlyMicrosoftBuildTasksCoreVersion)" />
<PackageReference Include="NuGet.ProjectModel" Version="$(RefOnlyNugetProjectModelVersion)" />
</ItemGroup>

<Import Project="runtimeGroups.props" />

<UsingTask TaskName="GenerateRuntimeGraph" AssemblyFile="$(_generateRuntimeGraphTask)"/>

<Target Name="GenerateRuntimeJson" Condition="'$(AdditionalRuntimeIdentifiers)' != ''" BeforeTargets="GenerateNuspec">
<Target Name="GenerateRuntimeJson" Condition="'$(AdditionalRuntimeIdentifiers)' != ''">
<MakeDir Directories="$(IntermediateOutputPath)" />
<GenerateRuntimeGraph RuntimeGroups="@(RuntimeGroupWithQualifiers)"
AdditionalRuntimeIdentifiers="$(AdditionalRuntimeIdentifiers)"
AdditionalRuntimeIdentifierParent="$(AdditionalRuntimeIdentifierParent)"
RuntimeJson="$(IntermediateOutputPath)runtime.json"
UpdateRuntimeFiles="True" />
</Target>

<Import Project="runtimeGroups.props" />

<Target Name="UpdateRuntimeJson">
<!-- Generates a Runtime graph using RuntimeGroups and diffs it with the graph described by runtime.json and runtime.compatibility.json
Specifying UpdateRuntimeFiles=true skips the diff and updates those files.
The graph can be visualized using the generated dmgl -->
<MakeDir Directories="$(OutputPath)" />
<GenerateRuntimeGraph RuntimeGroups="@(RuntimeGroupWithQualifiers)"
RuntimeJson="runtime.json"
CompatibilityMap="runtime.compatibility.json"
RuntimeDirectedGraph="$(OutputPath)runtime.json.dgml"
UpdateRuntimeFiles="$(UpdateRuntimeFiles)" />
</Target>

</Project>
21 changes: 2 additions & 19 deletions src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project>
<Project>

<ItemGroup>
<RuntimeGroup Include="unix">
<Parent>any</Parent>
Expand Down Expand Up @@ -262,22 +263,4 @@
</RuntimeGroupWithQualifiers>
</ItemGroup>

<PropertyGroup>
<_generateRuntimeGraphTargetFramework Condition="'$(MSBuildRuntimeType)' == 'core'">$(NetCoreAppToolCurrent)</_generateRuntimeGraphTargetFramework>
<_generateRuntimeGraphTargetFramework Condition="'$(MSBuildRuntimeType)' != 'core'">net472</_generateRuntimeGraphTargetFramework>
<_generateRuntimeGraphTask>$([MSBuild]::NormalizePath('$(BaseOutputPath)', '$(_generateRuntimeGraphTargetFramework)-$(Configuration)', '$(AssemblyName).dll'))</_generateRuntimeGraphTask>
</PropertyGroup>
<UsingTask TaskName="GenerateRuntimeGraph" AssemblyFile="$(_generateRuntimeGraphTask)"/>

<Target Name="UpdateRuntimeJson" BeforeTargets="Pack">
<!-- Generates a Runtime graph using RuntimeGroups and diffs it with the graph described by runtime.json and runtime.compatibility.json
Specifying UpdateRuntimeFiles=true skips the diff and updates those files.
The graph can be visualized using the generated dmgl -->
<MakeDir Directories="$(OutputPath)" />
<GenerateRuntimeGraph RuntimeGroups="@(RuntimeGroupWithQualifiers)"
RuntimeJson="runtime.json"
CompatibilityMap="runtime.compatibility.json"
RuntimeDirectedGraph="$(OutputPath)runtime.json.dgml"
UpdateRuntimeFiles="$(UpdateRuntimeFiles)" />
</Target>
</Project>

0 comments on commit ab0f54a

Please sign in to comment.