-
Notifications
You must be signed in to change notification settings - Fork 57
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
Update build.cake #80
base: main
Are you sure you want to change the base?
Conversation
Refactor Cake script for optimization and clarity - Consolidated common settings to reduce redundancy and improve maintainability - Combined task criteria for better readability - Consolidated NuGet push tasks into one task for simplicity - Made minor formatting improvements for consistency These changes enhance the efficiency, readability, and maintainability of the Cake script.
what do you mean here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution but I don't see any real improvements here. Could you pls explain some points below?
var testResultsDir = artifactsDir.Combine("test-results"); | ||
var psModuleDir = artifactsDir.Combine("Grok"); | ||
var testCoverageOutputFilePath = testResultsDir.CombineWithFilePath("OpenCover.xml"); | ||
|
||
var projectFileMain = File("./src/Grok.Net/Grok.Net.csproj"); | ||
var projectFilePowerShell = File("./src/Grok.Net.PowerShell/Grok.Net.PowerShell.csproj"); | ||
|
||
var commonSettings = new DotNetBuildSettings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be better to rename it to buildSettings
to make it consistent with testSettings
.
But what's the reason to make it a global variable instead of keeping it in the Build
task. Only the Build
task uses it!
There is testSettings
which is the same but you didn't move it...
Could you explain pls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback, Marusyk. I've updated the variable name to buildSettings
to maintain consistency with testSettings
, as you suggested. Regarding your question about making it a global variable versus keeping it within the Build task, I initially considered potential future use of commonSettings
across multiple tasks, hence the decision to define it globally. However, I see your point about encapsulation and clarity. Upon reflection, I've moved both buildSettings
and testSettings
into their respective tasks for better scoping and organization. Let me know if you have any further suggestions or concerns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no other concerns at the time
.WithCriteria(!string.IsNullOrWhiteSpace(coverallsRepoToken)) | ||
.WithCriteria((context) => !BuildSystem.IsPullRequest) | ||
.WithCriteria((context) => !BuildSystem.IsLocalBuild) | ||
.WithCriteria(context => FileExists(testCoverageOutputFilePath) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain what is the benefit of these changes?
How does it make better readability?
@@ -128,7 +127,7 @@ Task("PsModulePack") | |||
|
|||
Task("PsModulePush") | |||
.IsDependentOn("PsModulePack") | |||
.WithCriteria(!string.IsNullOrWhiteSpace(psNugetApiKey)) | |||
.WithCriteria(context => !string.IsNullOrWhiteSpace(psNugetApiKey)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need context
here?
var testResultsDir = artifactsDir.Combine("test-results"); | ||
var psModuleDir = artifactsDir.Combine("Grok"); | ||
var testCoverageOutputFilePath = testResultsDir.CombineWithFilePath("OpenCover.xml"); | ||
|
||
var projectFileMain = File("./src/Grok.Net/Grok.Net.csproj"); | ||
var projectFilePowerShell = File("./src/Grok.Net.PowerShell/Grok.Net.PowerShell.csproj"); | ||
|
||
var commonSettings = new DotNetBuildSettings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no other concerns at the time
Refactor Cake script for optimization and clarity - Consolidated common settings to reduce redundancy and improve maintainability - Combined task criteria for better readability - Consolidated NuGet push tasks into one task for simplicity - Made minor formatting improvements for consistency These changes enhance the efficiency, readability, and maintainability of the Cake script.