Skip to content

Commit

Permalink
Merge pull request #65 from sharwell/copy-documentation
Browse files Browse the repository at this point in the history
Copy documentation files to the output directory
  • Loading branch information
sharwell authored Dec 31, 2019
2 parents 32e303c + d3768b2 commit 846bbf7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
19 changes: 19 additions & 0 deletions TunnelVisionLabs.ReferenceAssemblyAnnotator/AnnotatorBuildTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ public ITaskItem[]? GeneratedAssemblies
set;
}

[Output]
public ITaskItem[]? GeneratedDocumentationFiles
{
get;
set;
}

public override bool Execute()
{
var log = new SuppressibleLoggingHelper(Log, requiredPrefix: "RA", DisabledWarnings);
Expand Down Expand Up @@ -93,6 +100,18 @@ public override bool Execute()
Program.Main(log, unannotatedReferenceAssembly, annotatedReferenceAssembly, outputAssembly);
GeneratedAssemblies = new[] { new TaskItem(outputAssembly) };

string sourceDocumentation = Path.ChangeExtension(unannotatedReferenceAssembly, ".xml");
string targetDocumentation = Path.ChangeExtension(outputAssembly, ".xml");
if (File.Exists(sourceDocumentation))
{
File.Copy(sourceDocumentation, targetDocumentation);
GeneratedDocumentationFiles = new[] { new TaskItem(targetDocumentation) };
}
else
{
GeneratedDocumentationFiles = Array.Empty<ITaskItem>();
}

return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@
<AnnotatedReferenceAssemblyOutputPath Condition="'$(AnnotatedReferenceAssemblyOutputPath)' == ''">$(IntermediateOutputPath)annotated\</AnnotatedReferenceAssemblyOutputPath>
</PropertyGroup>
<ItemGroup>
<UnannotatedReferenceAssembly Update="@(UnannotatedReferenceAssembly)" OutputAssembly="$(AnnotatedReferenceAssemblyOutputPath)%(Identity).dll" />
<UnannotatedReferenceAssembly Update="@(UnannotatedReferenceAssembly)"
OutputAssembly="$(AnnotatedReferenceAssemblyOutputPath)%(Identity).dll"
OutputDocumentationFile="$(AnnotatedReferenceAssemblyOutputPath)%(Identity).xml" />
</ItemGroup>
</Target>

Expand All @@ -91,10 +93,12 @@
OutputPath="$(AnnotatedReferenceAssemblyOutputPath)"
DisabledWarnings="$(NoWarn)">
<Output ItemName="GeneratedReferenceAssemblies" TaskParameter="GeneratedAssemblies" />
<Output ItemName="GeneratedDocumentationFiles" TaskParameter="GeneratedDocumentationFiles" />
</AnnotatorBuildTask>

<ItemGroup>
<FileWrites Include="@(UnannotatedReferenceAssembly->'%(OutputAssembly)')" />
<FileWrites Include="@(UnannotatedReferenceAssembly->'%(OutputDocumentationFile)')" />
</ItemGroup>

<PropertyGroup>
Expand Down

0 comments on commit 846bbf7

Please sign in to comment.