<commit_before><!--
***********************************************************************************************
Microsoft.NET.CrossGen.targets

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

Copyright (c) .NET Foundation. All rights reserved. 
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
  </PropertyGroup>
  
  <!--
    ============================================================
                                        PrepOptimizer

    Sets up the common infrastructure for the optimization phase
    Outputs:
        JitPath
        Crossgen
    ============================================================
    -->
  
  <Target Name="PrepOptimizer"
          DependsOnTargets="_GenerateCrossgenProj;
                            _RestoreCrossgen;"
          Condition="$(SkipOptimization) != 'true' ">
    <!-- Get the coreclr path -->
    <ItemGroup>
      <_CoreclrResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
                                             Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='coreclr'" />
      <_CoreclrResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
                                             Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='libcoreclr'" />
      <_JitResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
                                             Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='clrjit'" />
      <_JitResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
                                             Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='libclrjit'" />
    </ItemGroup>

    <NETSdkError Condition="'@(_CoreclrResolvedPath->Count())' &gt; 1"
                 ResourceName="MultipleFilesResolved"
                 FormatArguments="coreclr" />

    <NETSdkError Condition="'@(_CoreclrResolvedPath)'== ''"
                 ResourceName="UnableToFindResolvedPath"
                 FormatArguments="coreclr" />

    <NETSdkError Condition="'@(_JitResolvedPath->Count())' &gt; 1"
                 ResourceName="MultipleFilesResolved"
                 FormatArguments="jit" />

    <NETSdkError Condition="'@(_JitResolvedPath)'== ''"
                 ResourceName="UnableToFindResolvedPath"
                 FormatArguments="jit" />

    <!-- Get the crossgen and jit path-->
    <PropertyGroup>
      <_CoreclrPath>@(_CoreclrResolvedPath)</_CoreclrPath>
      <JitPath>@(_JitResolvedPath)</JitPath>
      <_CoreclrDir>$([System.IO.Path]::GetDirectoryName($(_CoreclrPath)))</_CoreclrDir>
      <_CoreclrPkgDir>$([System.IO.Path]::Combine($(_CoreclrDir),"..\..\..\"))</_CoreclrPkgDir>
      <CrossgenDir>$([System.IO.Path]::Combine($(_CoreclrPkgDir),"tools"))</CrossgenDir>
      <!-- TODO override with rid specific tools path for x-arch -->
      <Crossgen>$([System.IO.Path]::Combine($(CrossgenDir),"crossgen"))</Crossgen>
      <Crossgen Condition="'$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(CrossgenDir),"crossgen.exe"))</Crossgen>
    </PropertyGroup>

    <NETSdkError Condition="!Exists($(Crossgen))"
                 ResourceName="UnableToFindResolvedPath"
                 FormatArguments="$(Crossgen)" />

    <PropertyGroup>
      <Crossgen> $([System.IO.Path]::GetFullPath($(Crossgen)))</Crossgen>
    </PropertyGroup>
  </Target>
  
  <!--
    ============================================================
                                        _RunOptimizer

    Start the optimization phase
    ============================================================
    -->
  
  <Target Name="_RunOptimizer"
          DependsOnTargets="_InitializeBasicProps;
                            _ComputeResolvedFilesToCacheTypes;
                            _SetupStageForCrossgen"
          Condition="$(SkipOptimization) != 'true' ">
    <ItemGroup>
      <AssembliestoCrossgen Include="$(MSBuildProjectFullPath)">
        <Properties>
          CrossgenExe=$(Crossgen);
          CrossgenJit=$(JitPath);
          CrossgenInputAssembly=%(_ManagedResolvedFilesToOptimize.Fullpath);
          CrossgenOutputAssembly=$(_RuntimeOptimizedDir)$(DirectorySeparatorChar)%(FileName)%(Extension);
          CrossgenSubOutputPath=%(DestinationSubPath);
          _RuntimeOptimizedDir=$(_RuntimeOptimizedDir);
          PublishDir=$(CacheStagingDir);
          CrossgenPlatformAssembliesPath=$(_RuntimeRefDir)$(PathSeparator)$(_NetCoreRefDir);
        </Properties>
      </AssembliestoCrossgen>
    </ItemGroup>
    
    <!-- CrossGen the assemblies  -->
    <MSBuild Projects="@(AssembliestoCrossgen)"
                 Targets="RunCrossGen"
                 BuildInParallel="$(BuildInParallel)"
                 Condition="'@(_ManagedResolvedFilesToOptimize)' != ''"/>

  </Target>

  <!--
    ============================================================
                                        RunCrossGen
    Target Encapsulating the crossgen command  
    ============================================================
    -->

  <Target Name="RunCrossGen"
           DependsOnTargets="_InitializeBasicProps;">

    <PropertyGroup>
      <CrossgenCommandline>$(CrossgenExe) -readytorun -in $(CrossgenInputAssembly) -out $(CrossgenOutputAssembly) -jitpath $(CrossgenJit) -platform_assemblies_paths $(CrossgenPlatformAssembliesPath)</CrossgenCommandline>
    </PropertyGroup>

    <Message Text="CrossgenCommandline: $(CrossgenCommandline)"/>

    <!-- Workaround for https://github.com/NuGet/Home/issues/4424 -->
    <Exec Command="chmod 755 $(CrossgenExe)" Condition="'$(OS)' != 'Windows_NT'"/>
    
    <!--Optimization skip if the assembly is already present in the final output directory-->
    <Exec
     Command="$(CrossgenCommandline)"
     Condition="!Exists($([System.IO.Path]::Combine($(PublishDir),$(CrossgenSubOutputPath))))">
      <Output TaskParameter="ExitCode" PropertyName="ErrorCode"/>
    </Exec>

    <Copy SourceFiles = "$(CrossgenOutputAssembly)"
          DestinationFiles="$(PublishDir)\$(CrossgenSubOutputPath)"
          OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
          Retries="$(CopyRetryCount)"
          RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
          Condition="!Exists($([System.IO.Path]::Combine($(PublishDir),$(CrossgenSubOutputPath))))">

      <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
    </Copy>
  </Target>

  <Target Name="_InitializeBasicProps">
    <PropertyGroup>
      <PathSeparator>$([System.IO.Path]::PathSeparator)</PathSeparator>
      <DirectorySeparatorChar>$([System.IO.Path]::DirectorySeparatorChar)</DirectorySeparatorChar>
    </PropertyGroup>
  </Target>
  
  <!--
    ============================================================
                                       _GetCrossgenProps
    Generates props used by Crossgen
    ============================================================
    -->
  
  <Target Name="_GetCrossgenProps"
    Condition="$(SkipOptimization) != 'true' ">

    <PropertyGroup>
      <_CrossProjFileDir>$([System.IO.Path]::Combine($(ComposeWorkingDir),"Optimize"))</_CrossProjFileDir>
      <_NetCoreRefDir>$([System.IO.Path]::Combine($(_CrossProjFileDir), "netcoreapp"))</_NetCoreRefDir>              <!-- flat netcore app assemblies-->
    </PropertyGroup>
  </Target>

  <!--
    ============================================================
                                        _GenerateCrossgenProj
    Generates the project used to restore netcoreapp correspoding to FX_Version
    ============================================================
    -->
  <Target Name="_GenerateCrossgenProj"
          DependsOnTargets="_GetCrossgenProps;"
         Condition="$(SkipOptimization) != 'true' ">
    <!-- Create a Project to Restore Crossgen -->
    <PropertyGroup>
      <CrossgenProjContent>
        <![CDATA[
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
      <TargetFramework>$(_TFM)</TargetFramework>
      <RuntimeIdentifier>$(RuntimeIdentifier)</RuntimeIdentifier>
      <RuntimeFrameworkVersion Condition="'$(FX_Version)' != ''">$(FX_Version)</RuntimeFrameworkVersion>
  </PropertyGroup>
</Project>        

]]>
      </CrossgenProjContent>
    </PropertyGroup>

    <PropertyGroup>
      <_CrossProjFile>$([System.IO.Path]::Combine($(_CrossProjFileDir), "OptimizeCrossgen_$(RuntimeIdentifier)_$(_TFM).csproj"))</_CrossProjFile>
      <_CrossProjAssetsFile>$([System.IO.Path]::Combine($(_CrossProjFileDir), "obj", project.assets.json))</_CrossProjAssetsFile>
    </PropertyGroup>

    <MakeDir  Directories="$(_CrossProjFileDir)"/>
    
    <WriteLinesToFile
        File="$(_CrossProjFile)"
        Lines="$(CrossgenProjContent)"
        Overwrite="true" />
  </Target>

  <!--
    ============================================================
                                        _SetupStageForCrossgen
    ============================================================
    -->
  
  <Target Name="_SetupStageForCrossgen"
          DependsOnTargets="_GetCrossgenProps;_FilterOutFXFromResolvedCandidates;_PopulateUnFilteredResolvedCandidates">
    <PropertyGroup>
      <_RuntimeRefDir>$([System.IO.Path]::Combine($(CacheWorkerWorkingDir), "runtimeref"))</_RuntimeRefDir>  <!-- flat app managed assemblies -->
      <_RuntimeOptimizedDir>$([System.IO.Path]::Combine($(CacheWorkerWorkingDir), "runtimopt"))</_RuntimeOptimizedDir>      <!-- optimized app managed assemblies in nuget cache layout -->
    </PropertyGroup>

    <MakeDir  Directories="$(_RuntimeOptimizedDir)"/>
    
    <!-- Copy managed files to  a flat temp directory for passing it as ref -->
    <Copy SourceFiles = "@(_ManagedResolvedFilesToOptimize)"
          DestinationFolder="$(_RuntimeRefDir)"
          OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
          Retries="$(CopyRetryCount)"
          RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
          UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
          UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">

      <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
    </Copy>

  </Target>

  <!--
    ============================================================
                                        _FilterOutFXFromResolvedCandidates
    ============================================================
    -->
  
  <Target Name="_FilterOutFXFromResolvedCandidates"
          Condition="$(SkipRemovingSystemFiles) != 'true' ">

    <ItemGroup>
      <_ManagedResolvedFilesToOptimize Include="@(_ManagedResolvedFileToPublishCandidates)" Condition="!Exists('$(_NetCoreRefDir)$(DirectorySeparatorChar)%(FileName)%(Extension)')"/>
    </ItemGroup>
  </Target>

  <!--
    ============================================================
                                        _PopulateUnFilteredResolvedCandidates
    ============================================================
    -->
  <Target Name="_PopulateUnFilteredResolvedCandidates"
          Condition="$(SkipRemovingSystemFiles) == 'true' ">

   <ItemGroup>
      <_ManagedResolvedFilesToOptimize Include="@(_ManagedResolvedFileToPublishCandidates)" />
    </ItemGroup>
  </Target>

  <!--
    ============================================================
                                        _RestoreCrossgen
Restores netcoreapp and publishes it to a temp directory
    ============================================================
    -->
  
  <Target Name="_RestoreCrossgen"
           Condition="$(SkipOptimization) != 'true' ">
    <MSBuild Projects="$(_CrossProjFile)"
                 Targets="Restore"
                 Properties="RestoreGraphProjectInput=$(_CrossProjFile);"/>

    <ResolvePublishAssemblies ProjectPath="$(_CrossProjFile)"
                              AssetsFilePath="$(_CrossProjAssetsFile)"
                              TargetFramework="$(_TFM)"
                              RuntimeIdentifier="$(RuntimeIdentifier)"
                              PlatformLibraryName="$(MicrosoftNETPlatformLibrary)"
                              PrivateAssetsPackageReferences="@(PrivateAssetsPackageReference)"
                              PreserveCacheLayout="false">

      <Output TaskParameter="AssembliesToPublish" ItemName="CrossgenResolvedAssembliesToPublish" />
    </ResolvePublishAssemblies>

    <!-- Copy managed files to  a flat temp directory for passing it as ref for crossgen -->
    <Copy SourceFiles = "@(CrossgenResolvedAssembliesToPublish)"
          DestinationFolder="$(_NetCoreRefDir)"
          OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
          Retries="$(CopyRetryCount)"
          RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
          UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
          UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">

      <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
    </Copy>
  </Target>
 
</Project>
<commit_msg>Changing Fx_version to more consistent RuntimeFrameworkVersion<commit_after><!--
***********************************************************************************************
Microsoft.NET.CrossGen.targets

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

Copyright (c) .NET Foundation. All rights reserved. 
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
  </PropertyGroup>
  
  <!--
    ============================================================
                                        PrepOptimizer

    Sets up the common infrastructure for the optimization phase
    Outputs:
        JitPath
        Crossgen
    ============================================================
    -->
  
  <Target Name="PrepOptimizer"
          DependsOnTargets="_GenerateCrossgenProj;
                            _RestoreCrossgen;"
          Condition="$(SkipOptimization) != 'true' ">
    <!-- Get the coreclr path -->
    <ItemGroup>
      <_CoreclrResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
                                             Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='coreclr'" />
      <_CoreclrResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
                                             Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='libcoreclr'" />
      <_JitResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
                                             Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='clrjit'" />
      <_JitResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
                                             Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='libclrjit'" />
    </ItemGroup>

    <NETSdkError Condition="'@(_CoreclrResolvedPath->Count())' &gt; 1"
                 ResourceName="MultipleFilesResolved"
                 FormatArguments="coreclr" />

    <NETSdkError Condition="'@(_CoreclrResolvedPath)'== ''"
                 ResourceName="UnableToFindResolvedPath"
                 FormatArguments="coreclr" />

    <NETSdkError Condition="'@(_JitResolvedPath->Count())' &gt; 1"
                 ResourceName="MultipleFilesResolved"
                 FormatArguments="jit" />

    <NETSdkError Condition="'@(_JitResolvedPath)'== ''"
                 ResourceName="UnableToFindResolvedPath"
                 FormatArguments="jit" />

    <!-- Get the crossgen and jit path-->
    <PropertyGroup>
      <_CoreclrPath>@(_CoreclrResolvedPath)</_CoreclrPath>
      <JitPath>@(_JitResolvedPath)</JitPath>
      <_CoreclrDir>$([System.IO.Path]::GetDirectoryName($(_CoreclrPath)))</_CoreclrDir>
      <_CoreclrPkgDir>$([System.IO.Path]::Combine($(_CoreclrDir),"..\..\..\"))</_CoreclrPkgDir>
      <CrossgenDir>$([System.IO.Path]::Combine($(_CoreclrPkgDir),"tools"))</CrossgenDir>
      <!-- TODO override with rid specific tools path for x-arch -->
      <Crossgen>$([System.IO.Path]::Combine($(CrossgenDir),"crossgen"))</Crossgen>
      <Crossgen Condition="'$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(CrossgenDir),"crossgen.exe"))</Crossgen>
    </PropertyGroup>

    <NETSdkError Condition="!Exists($(Crossgen))"
                 ResourceName="UnableToFindResolvedPath"
                 FormatArguments="$(Crossgen)" />

    <PropertyGroup>
      <Crossgen> $([System.IO.Path]::GetFullPath($(Crossgen)))</Crossgen>
    </PropertyGroup>
  </Target>
  
  <!--
    ============================================================
                                        _RunOptimizer

    Start the optimization phase
    ============================================================
    -->
  
  <Target Name="_RunOptimizer"
          DependsOnTargets="_InitializeBasicProps;
                            _ComputeResolvedFilesToCacheTypes;
                            _SetupStageForCrossgen"
          Condition="$(SkipOptimization) != 'true' ">
    <ItemGroup>
      <AssembliestoCrossgen Include="$(MSBuildProjectFullPath)">
        <Properties>
          CrossgenExe=$(Crossgen);
          CrossgenJit=$(JitPath);
          CrossgenInputAssembly=%(_ManagedResolvedFilesToOptimize.Fullpath);
          CrossgenOutputAssembly=$(_RuntimeOptimizedDir)$(DirectorySeparatorChar)%(FileName)%(Extension);
          CrossgenSubOutputPath=%(DestinationSubPath);
          _RuntimeOptimizedDir=$(_RuntimeOptimizedDir);
          PublishDir=$(CacheStagingDir);
          CrossgenPlatformAssembliesPath=$(_RuntimeRefDir)$(PathSeparator)$(_NetCoreRefDir);
        </Properties>
      </AssembliestoCrossgen>
    </ItemGroup>
    
    <!-- CrossGen the assemblies  -->
    <MSBuild Projects="@(AssembliestoCrossgen)"
                 Targets="RunCrossGen"
                 BuildInParallel="$(BuildInParallel)"
                 Condition="'@(_ManagedResolvedFilesToOptimize)' != ''"/>

  </Target>

  <!--
    ============================================================
                                        RunCrossGen
    Target Encapsulating the crossgen command  
    ============================================================
    -->

  <Target Name="RunCrossGen"
           DependsOnTargets="_InitializeBasicProps;">

    <PropertyGroup>
      <CrossgenCommandline>$(CrossgenExe) -readytorun -in $(CrossgenInputAssembly) -out $(CrossgenOutputAssembly) -jitpath $(CrossgenJit) -platform_assemblies_paths $(CrossgenPlatformAssembliesPath)</CrossgenCommandline>
    </PropertyGroup>

    <Message Text="CrossgenCommandline: $(CrossgenCommandline)"/>

    <!-- Workaround for https://github.com/NuGet/Home/issues/4424 -->
    <Exec Command="chmod 755 $(CrossgenExe)" Condition="'$(OS)' != 'Windows_NT'"/>
    
    <!--Optimization skip if the assembly is already present in the final output directory-->
    <Exec
     Command="$(CrossgenCommandline)"
     Condition="!Exists($([System.IO.Path]::Combine($(PublishDir),$(CrossgenSubOutputPath))))">
      <Output TaskParameter="ExitCode" PropertyName="ErrorCode"/>
    </Exec>

    <Copy SourceFiles = "$(CrossgenOutputAssembly)"
          DestinationFiles="$(PublishDir)\$(CrossgenSubOutputPath)"
          OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
          Retries="$(CopyRetryCount)"
          RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
          Condition="!Exists($([System.IO.Path]::Combine($(PublishDir),$(CrossgenSubOutputPath))))">

      <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
    </Copy>
  </Target>

  <Target Name="_InitializeBasicProps">
    <PropertyGroup>
      <PathSeparator>$([System.IO.Path]::PathSeparator)</PathSeparator>
      <DirectorySeparatorChar>$([System.IO.Path]::DirectorySeparatorChar)</DirectorySeparatorChar>
    </PropertyGroup>
  </Target>
  
  <!--
    ============================================================
                                       _GetCrossgenProps
    Generates props used by Crossgen
    ============================================================
    -->
  
  <Target Name="_GetCrossgenProps"
    Condition="$(SkipOptimization) != 'true' ">

    <PropertyGroup>
      <_CrossProjFileDir>$([System.IO.Path]::Combine($(ComposeWorkingDir),"Optimize"))</_CrossProjFileDir>
      <_NetCoreRefDir>$([System.IO.Path]::Combine($(_CrossProjFileDir), "netcoreapp"))</_NetCoreRefDir>              <!-- flat netcore app assemblies-->
    </PropertyGroup>
  </Target>

  <!--
    ============================================================
                                        _GenerateCrossgenProj
    Generates the project used to restore netcoreapp corresponding to RuntimeFrameworkVersion
    ============================================================
    -->
  <Target Name="_GenerateCrossgenProj"
          DependsOnTargets="_GetCrossgenProps;"
         Condition="$(SkipOptimization) != 'true' ">
    <!-- Create a Project to Restore Crossgen -->
    <PropertyGroup>
      <CrossgenProjContent>
        <![CDATA[
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
      <TargetFramework>$(_TFM)</TargetFramework>
      <RuntimeIdentifier>$(RuntimeIdentifier)</RuntimeIdentifier>
      <RuntimeFrameworkVersion>$(RuntimeFrameworkVersion)</RuntimeFrameworkVersion>
  </PropertyGroup>
</Project>        

]]>
      </CrossgenProjContent>
    </PropertyGroup>

    <PropertyGroup>
      <_CrossProjFile>$([System.IO.Path]::Combine($(_CrossProjFileDir), "OptimizeCrossgen_$(RuntimeIdentifier)_$(_TFM).csproj"))</_CrossProjFile>
      <_CrossProjAssetsFile>$([System.IO.Path]::Combine($(_CrossProjFileDir), "obj", project.assets.json))</_CrossProjAssetsFile>
    </PropertyGroup>

    <MakeDir  Directories="$(_CrossProjFileDir)"/>
    
    <WriteLinesToFile
        File="$(_CrossProjFile)"
        Lines="$(CrossgenProjContent)"
        Overwrite="true" />
  </Target>

  <!--
    ============================================================
                                        _SetupStageForCrossgen
    ============================================================
    -->
  
  <Target Name="_SetupStageForCrossgen"
          DependsOnTargets="_GetCrossgenProps;_FilterOutFXFromResolvedCandidates;_PopulateUnFilteredResolvedCandidates">
    <PropertyGroup>
      <_RuntimeRefDir>$([System.IO.Path]::Combine($(CacheWorkerWorkingDir), "runtimeref"))</_RuntimeRefDir>  <!-- flat app managed assemblies -->
      <_RuntimeOptimizedDir>$([System.IO.Path]::Combine($(CacheWorkerWorkingDir), "runtimopt"))</_RuntimeOptimizedDir>      <!-- optimized app managed assemblies in nuget cache layout -->
    </PropertyGroup>

    <MakeDir  Directories="$(_RuntimeOptimizedDir)"/>
    
    <!-- Copy managed files to  a flat temp directory for passing it as ref -->
    <Copy SourceFiles = "@(_ManagedResolvedFilesToOptimize)"
          DestinationFolder="$(_RuntimeRefDir)"
          OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
          Retries="$(CopyRetryCount)"
          RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
          UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
          UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">

      <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
    </Copy>

  </Target>

  <!--
    ============================================================
                                        _FilterOutFXFromResolvedCandidates
    ============================================================
    -->
  
  <Target Name="_FilterOutFXFromResolvedCandidates"
          Condition="$(SkipRemovingSystemFiles) != 'true' ">

    <ItemGroup>
      <_ManagedResolvedFilesToOptimize Include="@(_ManagedResolvedFileToPublishCandidates)" Condition="!Exists('$(_NetCoreRefDir)$(DirectorySeparatorChar)%(FileName)%(Extension)')"/>
    </ItemGroup>
  </Target>

  <!--
    ============================================================
                                        _PopulateUnFilteredResolvedCandidates
    ============================================================
    -->
  <Target Name="_PopulateUnFilteredResolvedCandidates"
          Condition="$(SkipRemovingSystemFiles) == 'true' ">

   <ItemGroup>
      <_ManagedResolvedFilesToOptimize Include="@(_ManagedResolvedFileToPublishCandidates)" />
    </ItemGroup>
  </Target>

  <!--
    ============================================================
                                        _RestoreCrossgen
Restores netcoreapp and publishes it to a temp directory
    ============================================================
    -->
  
  <Target Name="_RestoreCrossgen"
           Condition="$(SkipOptimization) != 'true' ">
    <MSBuild Projects="$(_CrossProjFile)"
                 Targets="Restore"
                 Properties="RestoreGraphProjectInput=$(_CrossProjFile);"/>

    <ResolvePublishAssemblies ProjectPath="$(_CrossProjFile)"
                              AssetsFilePath="$(_CrossProjAssetsFile)"
                              TargetFramework="$(_TFM)"
                              RuntimeIdentifier="$(RuntimeIdentifier)"
                              PlatformLibraryName="$(MicrosoftNETPlatformLibrary)"
                              PrivateAssetsPackageReferences="@(PrivateAssetsPackageReference)"
                              PreserveCacheLayout="false">

      <Output TaskParameter="AssembliesToPublish" ItemName="CrossgenResolvedAssembliesToPublish" />
    </ResolvePublishAssemblies>

    <!-- Copy managed files to  a flat temp directory for passing it as ref for crossgen -->
    <Copy SourceFiles = "@(CrossgenResolvedAssembliesToPublish)"
          DestinationFolder="$(_NetCoreRefDir)"
          OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
          Retries="$(CopyRetryCount)"
          RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
          UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
          UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">

      <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
    </Copy>
  </Target>
 
</Project>

{'fraction_non_alphanumeric': 0.21091774505429123, 'fraction_numerical': 0.0009668302840993604, 'mean_word_length': 3.3664555934404934, 'pattern_counts': {'":': 0, '<': 315, '<?xml version=': 0, '>': 319, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 34, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '983951', 'n_tokens_mistral': 7153, 'n_tokens_neox': 6601, 'n_words': 917}