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

Recognize files in ref-pack under "analyzers" as analyzers and write them to the frameworkList #7561

Merged
2 commits merged into from
Jun 29, 2021
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 @@ -131,11 +131,41 @@ public override bool Execute()
}
}

string analyzerLanguage = null;

if (path.StartsWith("analyzers/"))
{
type = "Analyzer";

if (path.EndsWith(".resources.dll"))
{
// omit analyzer resources
continue;
}

var pathParts = path.Split('/');

if (pathParts.Length < 3 || !pathParts[1].Equals("dotnet", StringComparison.Ordinal) || pathParts.Length > 4)
{
Log.LogError($"Unexpected analyzer path format {path}. Expected 'analyzers/dotnet(/language)/analyzer.dll");
}

if (pathParts.Length > 3)
{
analyzerLanguage = pathParts[2];
}
}

var element = new XElement(
"File",
new XAttribute("Type", type),
new XAttribute("Path", path));

if (analyzerLanguage != null)
{
element.Add(new XAttribute("Language", analyzerLanguage));
}

if (f.IsResourceFile)
{
element.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class GeneratePlatformManifestEntriesFromTemplate : BuildTask
public override bool Execute()
{
List<PlatformManifestEntry> entries = new List<PlatformManifestEntry>();
var files = Files.ToDictionary(file => Path.GetFileName(file.ItemSpec));
var files = Files.ToLookup(file => Path.GetFileName(file.ItemSpec)).ToDictionary(l => l.Key, l=> l.First());
foreach (var entryTemplate in PlatformManifestEntryTemplates)
{
if (files.TryGetValue(entryTemplate.ItemSpec, out ITaskItem existingFile))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@
<_FrameworkListRootAttribute Include="TargetFrameworkVersion" Value="$(TargetFrameworkVersion.TrimStart('vV'))" />
<_FrameworkListRootAttribute Include="FrameworkName" Value="$(SharedFrameworkName)" />
<_FrameworkListRootAttribute Include="Name" Value="$(SharedFrameworkFriendlyName)" />
<_FrameworkListTargetFilePrefix Include="ref/;runtimes/" />
<_FrameworkListTargetFilePrefix Include="ref/;runtimes/;analyzers/" />
<_FrameworkListTargetFilePrefix Condition="'$(PlatformPackageType)' == 'RuntimePack'" Include="PgoData" />
</ItemGroup>

Expand Down Expand Up @@ -448,7 +448,7 @@
<ItemGroup>
<_closureFiles
Include="@(FilesToPackage)"
Condition="('%(Extension)' == '.dll' or '%(Extension)' == '$(LibraryFileExtension)') and '%(FilesToPackage.Culture)' == ''" />
Condition="('%(Extension)' == '.dll' or '%(Extension)' == '$(LibraryFileExtension)') and '%(FilesToPackage.Culture)' == '' and '%(FilesToPackage.ExcludeFromValidation)' != 'true'" />
<_closureFileNames Include="@(_closureFiles->'%(FileName)')" Original="%(Identity)" />

<_closureFileNamesFiltered Include="@(_closureFileNames)" Exclude="@(ExcludeFromClosure)"/>
Expand Down Expand Up @@ -478,7 +478,7 @@
<ItemGroup>
<_dupTypeFiles
Include="@(FilesToPackage)"
Condition="('%(Extension)' == '.dll' or '%(Extension)' == '$(LibraryFileExtension)') and '%(FilesToPackage.Culture)' == ''" />
Condition="('%(Extension)' == '.dll' or '%(Extension)' == '$(LibraryFileExtension)') and '%(FilesToPackage.Culture)' == '' and '%(FilesToPackage.ExcludeFromValidation)' != 'true'" />
<_dupTypeFileName Include="@(_dupTypeFiles->'%(FileName)')" Original="%(Identity)" />

<_dupTypeFileNamesFiltered Include="@(_dupTypeFileName)" Exclude="@(ExcludeFromDuplicateTypes)"/>
Expand Down