DGML ≡ Directed Graph Markup Language
In my previous post I had described a tool to visualize MSBuild projects with DGML and I had taken the following example:
<Project InitialTargets="Init" DefaultTargets="All" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Init">
<Error Text="MSBUILDINCLUDE environment variable is not set."
Condition=" ‘$(MSBUILDINCLUDE)’ == ” " />
</Target>
<Import Project="$(MSBUILDINCLUDE)Ciper.Targets"
Condition="Exists(‘$(MSBUILDINCLUDE)Ciper.Targets’)"/>
<PropertyGroup>
<DestinationFolder>c:ceyhunbinscripts</DestinationFolder>
</PropertyGroup>
<ItemGroup>
<SourceFiles Include="gawk.exe;dgml.bat;dgml.gawk;dgml_lowlevel.gawk;dgml_lib.gawk;dgml_print.gawk;tdl.gawk;tdl.bat" />
<DgmlSources Include="ciper-family.txt;deployment.txt;design.txt;icons.txt;problems.txt;todo.txt;readme.txt" />
<ToDoSources Include="requirements.txt;specifications.txt" />
<GawkSources Include="datastructures.txt;dependencies.txt">
<dgml>%(filename).dgml</dgml>
<gawk>%(filename).gawk</gawk>
<temp>%(filename).temp</temp>
</GawkSources>
<AllDependsOn Include="BuildGawk;BuildDgml;BuildToDo;CopyToBin;BuildDoc;BuildSyntax" />
</ItemGroup>
<Target Name="BuildGawk" Inputs="@(GawkSources)" Outputs="%(dgml)">
<Exec Command="gawk.exe -f @(GawkSources->’%(gawk)’) @(GawkSources) > @(GawkSources->’%(temp)’)" />
<Exec Command="dgml.bat @(GawkSources->’%(temp)’)" />
<Delete Files="@(GawkSources->’%(temp)’)" />
</Target>
<Target Name="BuildDgml" Inputs="@(DgmlSources)" Outputs="%(filename).dgml">
<Exec Command="dgml.bat @(DgmlSources)" />
</Target>
<Target Name="BuildToDo" Inputs="@(ToDoSources)" Outputs="%(filename).dgml" DependsOnTargets="BuildDgml">
<Exec Command="tdl.bat @(ToDoSources)" />
</Target>
<Target Name="CopyToBin" Inputs="@(SourceFiles)" Outputs="$(DestinationFolder)%(filename)%(extension)" DependsOnTargets="BuildDgml;BuildToDo">
<Message Text="@(SourceFiles) -> $(DestinationFolder)%(filename)%(extension)" />
<Copy SourceFiles="@(SourceFiles)" DestinationFiles="$(DestinationFolder)%(filename)%(extension)" />
</Target>
<Target Name="BuildDoc" Inputs="dgml.txt" Outputs="dgml.pdf">
<Exec Command="hlatex dgml.txt" />
</Target>
<Target Name="BuildSyntax" Inputs="dgmlsyntax.txt" Outputs="dgmlsyntax.dgml">
<Exec Command="syntaxdiagrammer.bat dgmlsyntax.txt" />
</Target>
<Target Name="All" DependsOnTargets="@(AllDependsOn)">
<CallTarget Targets="ProjectDgml" />
</Target>
</Project>
Which is represented at a high-level as:
Now, I feel that something is not quite right with this build file, but I don’t know what; so I have to audit it, but I don’t want to go through the XML, even though it is quite small. I prefer to interpret the DGML output.
First off, the “BuildDoc” target builds the LaTex Developer documentation in LaTeX that is not even deployed, so I take it out:
In the same vein, the “BuildGawk” & “BuildSyntax” targets generate internal documentation graphs that are not deployed either, so I take them out:
I also know that all targets depend on “All” that does nothing but generate this DGML! So I take it out as well.
I am mainly interested in “CopyToBin” and I can see that none of the Text Files are among its inputs.
Why does “CopyToBin” depend on the “BuildToDo” & BuildDgml” targets? It shouldn’t:
So we discover that “CopyToBin” should not depend on any other target and also what its relevant inputs are:
And we fix the makefile accordingly…