-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add support for Rd.xml file around project file #1976
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
Conversation
For now added either `rd.xml` or files which ends with `.rd.xml` Rename `rd.xml` supplied by BDN to `bdn_generated.rd.xml`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kant2002 big thanks for your contribution!
could you PTAL at the CI failures?
/home/runner/work/BenchmarkDotNet/BenchmarkDotNet/tests/BenchmarkDotNet.IntegrationTests/bin/Release/net5.0/0961d928-ba98-4cca-b6af-fc04c1f5807a/BenchmarkDotNet.Autogenerated.csproj(37,3): error MSB4067: The element <#text> beneath element <ItemGroup> is unrecognized.
you should be able to repro it locally by doing:
dotnet run -c Release -f net5.0 --project .\samples\BenchmarkDotNet.Samples\BenchmarkDotNet.Samples.csproj --filter '*Basic*' --job dry --runtimes nativeaot5.0 --keepFiles true
</ItemGroup> | ||
<ItemGroup> | ||
<RdXmlFile Include=""rd.xml"" /> | ||
{GetRdXmlFiles(buildPartition.RepresentativeBenchmarkCase.Descriptor.Type, logger).Select(_ => $"<RdXmlFile Include=\"{_}\" />{Environment.NewLine}")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit _
is typically used when the argument is ignored. In this case, we are using it.
{GetRdXmlFiles(buildPartition.RepresentativeBenchmarkCase.Descriptor.Type, logger).Select(_ => $"<RdXmlFile Include=\"{_}\" />{Environment.NewLine}")} | |
{GetRdXmlFiles(buildPartition.RepresentativeBenchmarkCase.Descriptor.Type, logger).Select(file => $"<RdXmlFile Include=\"{file}\" />{Environment.NewLine}")} |
</ItemGroup> | ||
<ItemGroup> | ||
<RdXmlFile Include=""rd.xml"" /> | ||
{GetRdXmlFiles(buildPartition.RepresentativeBenchmarkCase.Descriptor.Type, logger).Select(_ => $"<RdXmlFile Include=\"{_}\" />{Environment.NewLine}")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{GetRdXmlFiles(buildPartition.RepresentativeBenchmarkCase.Descriptor.Type, logger).Select(_ => $"<RdXmlFile Include=\"{_}\" />{Environment.NewLine}")} | |
{GetRdXmlFiles(buildPartition.RepresentativeBenchmarkCase.Descriptor.Type, logger).Select(file => $"<RdXmlFile Include=\"{file}\" />{Environment.NewLine}")} |
var projectFile = GetProjectFilePath(benchmarkTarget, logger); | ||
var projectFileFolder = projectFile.DirectoryName; | ||
yield return GeneratedRdXmlFileName; | ||
var rdXml = Path.Combine(projectFileFolder, "rd.xml"); | ||
if (File.Exists(rdXml)) | ||
{ | ||
yield return rdXml; | ||
} | ||
|
||
foreach (var item in Directory.GetFiles(projectFileFolder, "*.rd.xml")) | ||
{ | ||
yield return item; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like this could be simplified if we search for *rd.xm
files:
var projectFile = GetProjectFilePath(benchmarkTarget, logger); | |
var projectFileFolder = projectFile.DirectoryName; | |
yield return GeneratedRdXmlFileName; | |
var rdXml = Path.Combine(projectFileFolder, "rd.xml"); | |
if (File.Exists(rdXml)) | |
{ | |
yield return rdXml; | |
} | |
foreach (var item in Directory.GetFiles(projectFileFolder, "*.rd.xml")) | |
{ | |
yield return item; | |
} | |
yield return GeneratedRdXmlFileName; | |
var projectFileFolder = GetProjectFilePath(benchmarkTarget, logger).DirectoryName; | |
foreach (var rdFile in Directory.GetFiles(projectFileFolder, "*rd.xml")) | |
{ | |
yield return rdFile; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if somebody have library which ends with rd
? or just XML files. For example Thunderbird.xml
, that would be captured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid that neither *.rd.xml
and *rd.xml
are good filters, as users can call their files without rd prefix like nativeaot_rules.xml
. But since it's a project with BenchmarkDotNet benchmarks we could just tell them that all that we support is rd.xml
. @kant2002 what do you think?
@MichalStrehovsky what is your opinion on that? Are NativeAOT using names other than rd.xml
for their RdXmlFile
files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on my experience projects in the wild was using either just rd.xml
or I recentrly start push for separate files per library, to at least simplify mundane work. Naming convention which I propose is exaclly nuget_package.rd.xml
. Also seems to be .NET Native Rd.xml also has approximately same convention, so that's why I choose that pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*.rd.xml
is the convention that most people are sticking with. I don't recall ever seeing an rd.xml file without that extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, big thanks @kant2002 !
For now added either
rd.xml
or files which ends with.rd.xml
Rename
rd.xml
supplied by BDN tobdn_generated.rd.xml
Closes #1680