Skip to content

Embed EmbedInBinlog items added within targets#7220

Merged
Forgind merged 1 commit into
mainfrom
dev/kirillo/embedAddItem
Jan 10, 2022
Merged

Embed EmbedInBinlog items added within targets#7220
Forgind merged 1 commit into
mainfrom
dev/kirillo/embedAddItem

Conversation

@KirillOsenkov
Copy link
Copy Markdown
Member

@KirillOsenkov KirillOsenkov commented Jan 5, 2022

So far we've only respected EmbedInBinlog items during ProjectEvaluationFinished (or ProjectStarted, wherever the eval items are logged).

This simple change also respects EmbedInBinlog items added from ItemGroups inside Targets during target execution.

We can now insert "printf" targets in any place in the build to embed arbitrary files in the binlog at the time that target runs.

This could also allow embedding the same file more than once, if we first copy into a temp file with a timestamp or target name attached. This can allow capturing the state of files at various stages of the build.

I have tested it and it works.

So far we've only respected EmbedInBinlog items during ProjectEvaluationFinished (or ProjectStarted, wherever the eval items are logged).

This simple change also respects EmbedInBinlog items added from ItemGroups inside Targets during target execution.

We can now insert "printf" targets in any place in the build to embed arbitrary files in the binlog at the time that target runs.

This could also allow embedding the same file more than once, if we first copy into a temp file with a timestamp or target name attached. This can allow capturing the state of files at various stages of the build.
@KirillOsenkov
Copy link
Copy Markdown
Member Author

Usage example:

  <Target Name="Test" BeforeTargets="Build">
    <ItemGroup>
      <EmbedInBinlog Include="C:\temp\*.txt" />
    </ItemGroup>
  </Target>

@Forgind Forgind merged commit 9c46407 into main Jan 10, 2022
@KirillOsenkov KirillOsenkov deleted the dev/kirillo/embedAddItem branch January 10, 2022 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants