Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdageek committed Sep 19, 2024
1 parent dfceeca commit 8ddfdd7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
6 changes: 6 additions & 0 deletions monostump.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E8E92FD2-B01
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "monostump", "src\monostump\monostump.csproj", "{C9FD4C6D-256F-4A5A-8C36-E20697974930}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructuredLogger", "..\live-MSBuildStructuredLog\src\StructuredLogger\StructuredLogger.csproj", "{87DD5FC7-29C7-4CE9-B22B-2A4D6CB9B497}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -20,6 +22,10 @@ Global
{C9FD4C6D-256F-4A5A-8C36-E20697974930}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9FD4C6D-256F-4A5A-8C36-E20697974930}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9FD4C6D-256F-4A5A-8C36-E20697974930}.Release|Any CPU.Build.0 = Release|Any CPU
{87DD5FC7-29C7-4CE9-B22B-2A4D6CB9B497}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87DD5FC7-29C7-4CE9-B22B-2A4D6CB9B497}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87DD5FC7-29C7-4CE9-B22B-2A4D6CB9B497}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87DD5FC7-29C7-4CE9-B22B-2A4D6CB9B497}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C9FD4C6D-256F-4A5A-8C36-E20697974930} = {E8E92FD2-B015-4538-B999-BC13E1BEC8C7}
Expand Down
21 changes: 14 additions & 7 deletions src/monostump/TaskModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,27 @@ private void PopulateOutputItems(ILogger logger, Microsoft.Build.Logging.Structu
}
foreach (var child in outputItemsFolder.Children)
{
if (child is Property property)
#if HAS_TASK_PARAMETER_ITEM
if (child is TaskParameterItem taskParameterItem)
{
OutputItems.Add(new TaskOutputItem { Name = property.Name, IsProperty = true });
OutputItems.Add(new TaskOutputItem { Name = taskParameterItem.ParameterName, IsProperty = false });
}
else if (child is Item item)
{
OutputItems.Add(new TaskOutputItem { Name = item.Name, IsProperty = false });
}
else if (child is AddItem addItem)
else
#endif
if (child is AddItem addItem)
{
string parameterName = GetParameterNameFromItemName(addItem.Name);
OutputItems.Add(new TaskOutputItem { Name = parameterName, IsProperty = false });
logger.LogDebug("AddItem: {ItemName} => {ParamName}", addItem.Name, parameterName);
}
else if (child is Property property)
{
OutputItems.Add(new TaskOutputItem { Name = property.Name, IsProperty = true });
}
else if (child is Item item)
{
OutputItems.Add(new TaskOutputItem { Name = item.Name, IsProperty = false });
}
else
{
logger.LogError("Unexpected node '{Node}' type {NodeType}", child.ToString(), child.GetType());
Expand Down
11 changes: 10 additions & 1 deletion src/monostump/monostump.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition="'$(Firehose)' == 'true'">
<DefineConstants>$(DefineConstants);HAS_TASK_PARAMETER_ITEM</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(Firehose)' == 'true'">
<ProjectReference Include="/Users/alklig/work/live-MSBuildStructuredLog/src/StructuredLogger/StructuredLogger.csproj" />
</ItemGroup>


<ItemGroup>
<PackageReference Include="MSBuild.StructuredLogger" />
<PackageReference Include="MSBuild.StructuredLogger" Condition="'$(Firehose)' != 'true'" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="System.Text.Json" />
Expand Down

0 comments on commit 8ddfdd7

Please sign in to comment.