fsprojects / FAKE

FAKE - F# Make

Home Page:https://fake.build

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SetAssemblyVersion is too verbose

pchinery opened this issue · comments

Description

Right now, AssemblyInfo.setAssemblyVersion is very verbose, which makes the logs hard to read.

Our build process is like this:

  • Update multiple AssemblyInfo.cs files at the beginning of the build with the current version number (and additionally the current commit ID)
  • Compile
  • Revert the changes to all AssemblyInfo.cs files

As AssemblyInfo.setAssemblyVersion writes one trace message per AssemblyInfo and one more line per attribute that was not changed, this can get really messy. When actually searching a problem, we have to scroll up a lot.

Suggested behavior

To reduce the load, I would suggest to modify the "alright, nothing has changed here" messages and either remove them completely or only show them in verbose mode. This will reduce the number of trace lines instantly.

As a more enhanced solution, it might be desirable to completely disable these trace messages during clean up, but that would probably require changes that will affect of lot of use-cases.

I'm happy to provide a PR, but I wanted to discuss this first. Is this even a good idea? What would be the favored approach?

@pchinery I'm not aware of a method called setAssemblyVersion in the FAKE codebase. Could you please direct me to that method?

If I understand correctly, what you are doing through your build process is like how the FAKE build process is set up. We have a target called SetAssemblyInfo in which we update all the AssemblyInfo.cs files for all FAKE modules with the release/build info. The output we got from that target is as follows (output is shown for one module - project):

Starting target 'SetAssemblyInfo'
.> "C:\Program Files\Git\cmd\git.exe" update-index --skip-worktree C:\Code\ExternalLibraries\FAKE\src\app\fake-cli/AssemblyInfo.fs (In: false, Out: false, Err
: false)
//...

Thanks

Sorry, I had copied the name of an internal helper method, I meant AssemblyInfoFile.updateAttributes

If I understand your snippet right, that's the "next step", meaning after all AssemblyInfo files were updated, they are added to the git index. What I meant is the actual process (and its output) of updating the AssemblyInfo.cs files

So updateAttibutes has only one trace statement. Which as you pointed out is displayed always regardless of verbosity level. However, I'm not seeing any trace message with the text "alright, nothing has changed here"

I did not mean it as a direct quote, that's the line:

https://github.com/fsprojects/FAKE/blob/release/next/src/app/Fake.DotNet.AssemblyInfoFile/AssemblyInfoFile.fs#L447

That's triggered for each attribute in each file that is being updated and it completely clutters our build output (especially on the final target where we revert the temporary changes).

For now, we are detaching the Console during the revert, but that's not really a good solution

Ok, I see now. Sorry for all the trouble until I understand what is the issue! But yes if the output is cluttering the build we can condition the trace messages to verbose mode only. Please feel free to provide a PR for it.

Thanks

Thanks, I will try to spend some time on that during the next days and will open a PR when I have something to show/discuss