Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed EmbedInBinlog items added within targets #7220

Merged
merged 1 commit into from
Jan 10, 2022

Conversation

KirillOsenkov
Copy link
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
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