Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ private void AddRuntimePackAssetsFromManifest(List<ITaskItem> runtimePackAssets,
{
assetType = "native";
}
else if (typeAttributeValue.Equals("PgoData", StringComparison.OrdinalIgnoreCase))
{
assetType = "pgodata";
}
else if (typeAttributeValue.Equals("Resources", StringComparison.OrdinalIgnoreCase))
{
assetType = "resources";
Expand Down Expand Up @@ -166,7 +170,9 @@ private static TaskItem CreateAssetItem(string assetPath, string assetType, ITas

var assetItem = new TaskItem(assetPath);

assetItem.SetMetadata(MetadataKeys.CopyLocal, "true");
if (assetType != "pgodata")
assetItem.SetMetadata(MetadataKeys.CopyLocal, "true");

if (string.IsNullOrEmpty(culture))
{
assetItem.SetMetadata(MetadataKeys.DestinationSubPath, Path.GetFileName(assetPath));
Expand Down
3 changes: 2 additions & 1 deletion src/Tasks/Microsoft.NET.Build.Tasks/ResolvedFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ internal enum AssetType
None,
Runtime,
Native,
Resources
Resources,
PgoData
}

internal class ResolvedFile
Expand Down
9 changes: 9 additions & 0 deletions src/Tasks/Microsoft.NET.Build.Tasks/RunReadyToRunCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class RunReadyToRunCompiler : ToolTask
public bool ShowCompilerWarnings { get; set; }
public bool UseCrossgen2 { get; set; }
public string Crossgen2ExtraCommandLineArgs { get; set; }
public ITaskItem[] Crossgen2PgoFiles { get; set; }

[Output]
public bool WarningsDetected { get; set; }
Expand Down Expand Up @@ -329,6 +330,14 @@ private string GenerateCrossgen2ResponseFile()
}
}

if (Crossgen2PgoFiles != null)
{
foreach (var mibc in Crossgen2PgoFiles)
{
result.AppendLine($"-m:\"{mibc.ItemSpec}\"");
}
}

if (!string.IsNullOrEmpty(Crossgen2ExtraCommandLineArgs))
{
foreach (string extraArg in Crossgen2ExtraCommandLineArgs.Split(new char[]{';'}, StringSplitOptions.RemoveEmptyEntries))
Expand Down
4 changes: 4 additions & 0 deletions src/Tasks/Microsoft.NET.Build.Tasks/RuntimePackAssetInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public static RuntimePackAssetInfo FromItem(ITaskItem item)
{
assetInfo.AssetType = AssetType.Resources;
}
else if (assetTypeString.Equals("pgodata", StringComparison.OrdinalIgnoreCase))
{
assetInfo.AssetType = AssetType.PgoData;
}
else
{
throw new InvalidOperationException("Unexpected asset type: " + item.GetMetadata(MetadataKeys.AssetType));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<PublishReadyToRunComposite Condition="'$(PublishReadyToRunComposite)' == '' and '$(_TargetFrameworkVersionWithoutV)' >= '6.0'">false</PublishReadyToRunComposite>
<PublishReadyToRunComposite Condition="'$(PublishReadyToRunComposite)' == ''">true</PublishReadyToRunComposite>
<PublishReadyToRunComposite Condition="'$(PublishReadyToRunUseCrossgen2)' != 'true' or '$(SelfContained)' != 'true'">false</PublishReadyToRunComposite>
<PublishReadyToRunUseRuntimePackOptimizationData Condition="'$(PublishReadyToRunUseRuntimePackOptimizationData)' == ''">true</PublishReadyToRunUseRuntimePackOptimizationData>
</PropertyGroup>

<!--
Expand Down Expand Up @@ -367,7 +368,7 @@ Copyright (c) .NET Foundation. All rights reserved.
Prepare build for ReadyToRun compilations. Builds list of assemblies to compile, and computes paths to ReadyToRun compiler bits
============================================================
-->
<UsingTask Condition="'$(Crossgen2TasksOverriden)' != 'true'" TaskName="PrepareForReadyToRunCompilation" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)"/>
<UsingTask Condition="'$(Crossgen2TasksOverriden)' != 'true'" TaskName="PrepareForReadyToRunCompilation" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<Target Name="_PrepareForReadyToRunCompilation" DependsOnTargets="ResolveReadyToRunCompilers;_ComputeManagedRuntimePackAssemblies;_ComputeAssembliesToPostprocessOnPublish">

<PropertyGroup>
Expand Down Expand Up @@ -397,6 +398,12 @@ Copyright (c) .NET Foundation. All rights reserved.
<_ReadyToRunImplementationAssemblies Include="@(_ReadyToRunImplementationAssembliesWithoutConflicts)" />
</ItemGroup>

<ItemGroup>
<_ReadyToRunPgoFiles Include="@(PublishReadyToRunPgoFiles)" />
<_ReadyToRunPgoFiles Include="@(RuntimePackAsset)"
Condition="'%(RuntimePackAsset.AssetType)' == 'pgodata' and '%(RuntimePackAsset.Extension)' == '.mibc' and '$(PublishReadyToRunUseRuntimePackOptimizationData)' == 'true'" />
</ItemGroup>

<PrepareForReadyToRunCompilation CrossgenTool="@(CrossgenTool)"
Crossgen2Tool="@(Crossgen2Tool)"
OutputPath="$(_ReadyToRunOutputPath)"
Expand Down Expand Up @@ -444,12 +451,13 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
<UsingTask Condition="'$(Crossgen2TasksOverriden)' != 'true'" TaskName="RunReadyToRunCompiler" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<Target Name="_CreateR2RImages"
Inputs="@(_ReadyToRunCompileList);@(_ReadyToRunCompositeBuildInput)"
Inputs="@(_ReadyToRunCompileList);@(_ReadyToRunCompositeBuildInput);@(_ReadyToRunPgoFiles)"
Outputs="%(_ReadyToRunCompileList.OutputR2RImage);%(_ReadyToRunCompileList.OutputPDBImage)">

<RunReadyToRunCompiler CrossgenTool="@(CrossgenTool)"
Crossgen2Tool="@(Crossgen2Tool)"
UseCrossgen2="$(PublishReadyToRunUseCrossgen2)"
Crossgen2PgoFiles="@(_ReadyToRunPgoFiles)"
Crossgen2ExtraCommandLineArgs="$(PublishReadyToRunCrossgen2ExtraArgs)"
ImplementationAssemblyReferences="@(_ReadyToRunAssembliesToReference)"
ShowCompilerWarnings="$(PublishReadyToRunShowWarnings)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ Copyright (c) .NET Foundation. All rights reserved.

<ItemGroup>
<_ResolvedCopyLocalPublishAssets Include="@(RuntimePackAsset)"
Condition="'$(SelfContained)' == 'true' Or '%(RuntimePackAsset.RuntimePackAlwaysCopyLocal)' == 'true'" />
Condition="('$(SelfContained)' == 'true' Or '%(RuntimePackAsset.RuntimePackAlwaysCopyLocal)' == 'true') and '%(RuntimePackAsset.AssetType)' != 'pgodata'" />
</ItemGroup>

<ItemGroup Condition="'$(_UseBuildDependencyFile)' != 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ Copyright (c) .NET Foundation. All rights reserved.

<ItemGroup>
<ReferenceCopyLocalPaths Include="@(RuntimePackAsset)"
Condition="'$(CopyLocalLockFileAssemblies)' == 'true' and ('$(SelfContained)' == 'true' or '%(RuntimePackAsset.RuntimePackAlwaysCopyLocal)' == 'true')" />
Condition="'$(CopyLocalLockFileAssemblies)' == 'true' and ('$(SelfContained)' == 'true' or '%(RuntimePackAsset.RuntimePackAlwaysCopyLocal)' == 'true') and '%(RuntimePackAsset.AssetType)' != 'pgodata'" />
</ItemGroup>


Expand Down