Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MonoAOTCompiler] accept more than one AotProfilePath #57111

Merged
Merged
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
22 changes: 16 additions & 6 deletions src/tasks/AotCompilerTask/MonoAOTCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task
/// <summary>
/// File to use for profile-guided optimization, *only* the methods described in the file will be AOT compiled.
/// </summary>
public string? AotProfilePath { get; set; }
public string[]? AotProfilePath { get; set; }

/// <summary>
/// List of profilers to use.
Expand Down Expand Up @@ -219,10 +219,16 @@ public override bool Execute()
return false;
}

if (!string.IsNullOrEmpty(AotProfilePath) && !File.Exists(AotProfilePath))
if (AotProfilePath != null)
{
Log.LogError($"'{AotProfilePath}' doesn't exist.", nameof(AotProfilePath));
return false;
foreach (var path in AotProfilePath)
{
if (!File.Exists(path))
{
Log.LogError($"AotProfilePath '{path}' doesn't exist.");
return false;
}
}
}

if (UseLLVM)
Expand Down Expand Up @@ -491,9 +497,13 @@ private bool PrecompileLibrary(ITaskItem assemblyItem, string? monoPaths)
aotAssembly.SetMetadata("AotDataFile", aotDataFile);
}

if (!string.IsNullOrEmpty(AotProfilePath))
if (AotProfilePath?.Length > 0)
{
aotArgs.Add($"profile={AotProfilePath},profile-only");
aotArgs.Add("profile-only");
foreach (var path in AotProfilePath)
{
aotArgs.Add($"profile={path}");
}
}

// we need to quote the entire --aot arguments here to make sure it is parsed
Expand Down