Fix and clean-up graphviz tool project

This commit is contained in:
Viktor Hofer 2024-01-11 20:00:22 +01:00
parent 8e2c13fc77
commit c00665e399

View file

@ -1,47 +1,49 @@
<Project> <Project Sdk="Microsoft.Build.NoTargets">
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<Target Name="Build"> <PropertyGroup>
<TargetFramework>$(NetCurrent)</TargetFramework>
</PropertyGroup>
<Target Name="GenerateGraphViz"
AfterTargets="Build">
<ItemGroup> <ItemGroup>
<AllRepoProjects <RepoProject Include="$(RepoProjectsDir)*.proj"
Include="$(ProjectDir)repo-projects\*.proj" Exclude="$(RepoProjectsDir)dotnet.proj;
Exclude="$(ProjectDir)repo-projects\dotnet.proj" /> $(RepoProjectsDir)package-source-build.proj" />
</ItemGroup> </ItemGroup>
<MSBuild <MSBuild Projects="@(RepoProject)"
Projects="@(AllRepoProjects)"
Targets="GetRepositoryReferences"> Targets="GetRepositoryReferences">
<Output TaskParameter="TargetOutputs" ItemName="RepoReferences" /> <Output TaskParameter="TargetOutputs" ItemName="RepoReference" />
</MSBuild> </MSBuild>
<ItemGroup> <ItemGroup>
<RepoLink Include="%(RepoReferences.MSBuildSourceProjectFile)" SourceRepo="%(RepoReferences.Identity)" /> <RepoLink Include="%(RepoReference.MSBuildSourceProjectFile)" SourceRepo="%(RepoReference.Identity)" />
<RepoLink TargetRepo="%(Filename)" /> <RepoLink TargetRepo="%(Filename)" />
<RepoLink Text="&quot;%(SourceRepo)&quot; -> &quot;%(TargetRepo)&quot;" /> <RepoLink Text="&quot;%(SourceRepo)&quot; -> &quot;%(TargetRepo)&quot;" />
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<GraphVizFile>$(BaseIntermediatePath)graphviz.dot</GraphVizFile> <GraphVizFile>$(BaseIntermediateOutputPath)graphviz.dot</GraphVizFile>
<GraphVizPngFile>$(BaseIntermediatePath)graphviz.png</GraphVizPngFile> <GraphVizPngFile>$(BaseIntermediateOutputPath)graphviz.png</GraphVizPngFile>
<GraphVizContent>digraph { <GraphVizContent>digraph {
graph [ dpi = 150 ] graph [ dpi = 150 ]
@(RepoLink -> '%(Text)') @(RepoLink -> '%(Text)')
}</GraphVizContent> }</GraphVizContent>
</PropertyGroup> </PropertyGroup>
<WriteLinesToFile <WriteLinesToFile Lines="$(GraphVizContent)"
Lines="$(GraphVizContent)"
File="$(GraphVizFile)" File="$(GraphVizFile)"
Overwrite="True" /> Overwrite="True" />
<Message Importance="High" Text="$(MSBuildProjectName) -> $(GraphVizFile)" /> <Message Text="$(MSBuildProjectName) -> $(GraphVizFile)" Importance="High" />
<Exec <Exec Command="$([MSBuild]::NormalizePath('$(GraphVizDir)', 'dot')) $(GraphVizFile) -Tpng:cairo -o $(GraphVizPngFile)"
Condition="'$(GraphVizDir)' != ''" Condition="'$(GraphVizDir)' != ''" />
Command="$([MSBuild]::NormalizePath('$(GraphVizDir)', 'dot')) $(GraphVizFile) -Tpng:cairo -o $(GraphVizPngFile)" />
<Message Condition="'$(GraphVizDir)' != ''" Importance="High" Text="$(MSBuildProjectName) -> $(GraphVizPngFile)" /> <Message Text="$(MSBuildProjectName) -> $(GraphVizPngFile)"
Importance="High"
Condition="'$(GraphVizDir)' != ''" />
</Target> </Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project> </Project>