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

Update build.cake #80

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update build.cake #80

wants to merge 1 commit into from

Conversation

anonithrax
Copy link

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.

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.
@Marusyk
Copy link
Owner

Marusyk commented Apr 8, 2024

Consolidated NuGet push tasks into one task for simplicity

what do you mean here?

Copy link
Owner

@Marusyk Marusyk left a 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
Copy link
Owner

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

Copy link
Author

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.

Copy link
Owner

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) &&
Copy link
Owner

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))
Copy link
Owner

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

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

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.

2 participants