Skip to content

Commit

Permalink
Make DOTNET_ROOT change local per Viktor's PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
trylek committed Feb 12, 2021
1 parent 21a03c3 commit b2a6c9d
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/installer/pkg/sfx/Microsoft.NETCore.App/ReadyToRun.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
<Project>
<Target Name="ResolveReadyToRunCompilers" DependsOnTargets="ResolveRuntimeFilesFromLocalBuild">
<!-- The following property group can be simplified once runtime repo switches over to SDK 6.0 drop -->
<PropertyGroup>
<CrossDir></CrossDir>
<CrossDir Condition="'$(BuildArchitecture)' != '$(TargetArchitecture)'">x64</CrossDir>
<Crossgen2Dir>$(CoreCLRArtifactsPath)\$(CrossDir)\crossgen2</Crossgen2Dir>
<Crossgen2Exe>$(Crossgen2Dir)\crossgen2$(ExeSuffix)</Crossgen2Exe>
<PublishReadyToRunCrossgen2ExtraArgs>--targetarch:$(TargetArchitecture)</PublishReadyToRunCrossgen2ExtraArgs>

<JitTargetOSComponent>unix</JitTargetOSComponent>
<JitTargetOSComponent Condition="'$(TargetOS)' == 'windows'">win</JitTargetOSComponent>
<JitBuildArchitecture>$(TargetArchitecture)</JitBuildArchitecture>
<JitBuildArchitecture Condition="'$(CrossDir)' != ''">$(CrossDir)</JitBuildArchitecture>
<JitLibrary>$(Crossgen2Dir)\$(LibPrefix)clrjit_$(JitTargetOSComponent)_$(TargetArchitecture)_$(JitBuildArchitecture)$(LibSuffix)</JitLibrary>
</PropertyGroup>

<ItemGroup Condition="'$(RuntimeFlavor)' != 'Mono'">
<_crossTargetJit Include="@(CoreCLRCrossTargetFiles)" Condition="'%(FileName)' == '$(LibPrefix)clrjit' and '%(Extension)' == '$(LibSuffix)'" />
<_clrjit Include="@(RuntimeFiles)" Condition="'%(FileName)' == '$(LibPrefix)clrjit' and '%(Extension)' == '$(LibSuffix)'" />
Expand All @@ -16,5 +31,34 @@
JitPath="@(_clrjit)"
DiaSymReader="$(_diaSymReaderPathIfExists)" />
</ItemGroup>
<ItemGroup>
<Crossgen2Tool Include="$(Crossgen2Exe)" JitPath="$(JitLibrary)" />
</ItemGroup>
</Target>

<!-- Hack to patch DOTNET_ROOT for the duration of Crossgen2 compilation to unblock -->
<!-- Crossgen2 bring-up before SDK 6.0 Preview 2 propagates to the runtime repo. -->
<!-- https://github.com/dotnet/runtime/issues/48252 -->

<PropertyGroup>
<OriginalDotnetRootValue />
<DOTNET_ROOT />
</PropertyGroup>

<Target Name="PatchDotnetRootBeforeRunningCrossgen2" BeforeTargets="_CreateR2RImages">
<PropertyGroup>
<OriginalDotnetRootValue>$(DOTNET_ROOT)</OriginalDotnetRootValue>
<DOTNET_ROOT>$(RepoRoot)</DOTNET_ROOT>
</PropertyGroup>
</Target>

<Target Name="RestoreDotnetRootAfterRunningCrossgen2" AfterTargets="_CreateR2RImages">
<PropertyGroup>
<DOTNET_ROOT>$(OriginalDotnetRootValue)</DOTNET_ROOT>
</PropertyGroup>
</Target>

<!-- End of hack to patch DOTNET_ROOT for the duration of Crossgen2 compilation. -->
<!-- This can be removed once the runtime repo rolled forward to .NET 6 Preview 2 SDK repo drop. -->
<!-- https://github.com/dotnet/runtime/issues/48252 -->
</Project>

0 comments on commit b2a6c9d

Please sign in to comment.