Squirrel.Windows icon indicating copy to clipboard operation
Squirrel.Windows copied to clipboard

Add Logging to Releasify

Open Horb opened this issue 6 years ago • 5 comments

Add Logging to Releasify

The following refactor was brought about because we (Age Partnership) were running into difficulty using Squirrel in the Azure DevOps Build Pipelines and existing logging wasn't sufficient for our needs.

I don't expect any functionality to have changed.

The Releasify method in Update.exe has been broken up into;

  • ensureConsole
  • ValidateBaseUrl
  • ValidatePaths
  • PrepareFiles
  • ProcessFiles
  • CleanupFiles
  • WriteReleaseFile
  • CreateSetupExe
  • GenerateMsi

Breaking Releasify up into smaller methods allows stack traces to be more useful when identifying issues.

The refactoring was done using ReSharper. Only significant change is the use of out var declarations and passing variables using ref. I expect a more significant refactor could make this cleaner. Debug logs have been added to the start of each method and the whole Releasify method is now in a "try / catch / log / throw" block.

Horb avatar Jan 02 '19 16:01 Horb

I appreciate the concept but I'm not sure we've made the code Better here. So many variables are shared between all of these that R#'s result makes changing the code frustrating. An alternate approach would be to move many of these inner variables to instance fields, then try the R# Extract Method trick again

anaisbetts avatar Jan 02 '19 16:01 anaisbetts

Thanks. I wanted the most minimal diff possible so the meaning wasn't lost in the changes.

Now that the meaning has gotten across I'll make a new changeset that is more considerate of code quality, number of arguments etc.

Horb avatar Jan 02 '19 16:01 Horb

@Horb You don't have to close this PR and resubmit a new one, just keep committing to this branch. git checkout -p origin/master might help here too to trim away the csproj changes

anaisbetts avatar Jan 02 '19 16:01 anaisbetts

Refactor to introduce instance variables is complete. I need to test to make sure I haven't broken anything. Once I've tested I'll report back here.

Horb avatar Jan 02 '19 17:01 Horb

@paulcbetts I think this is good to go now. Some variable names are no longer used and the name from command line parsing is used instead such as; signingOpts/signingParameters, package/target.

Horb avatar Jan 03 '19 09:01 Horb