cake icon indicating copy to clipboard operation
cake copied to clipboard

Trim leading hyphens from command-line argument keys in FrostingConfiguration

Open paulomorgado opened this issue 1 month ago • 2 comments

Trim leading hyphens from command-line argument keys in the FrostingConfiguration.cs file to ensure consistent key formatting when processing arguments. This change improves compatibility and standardization in the args dictionary.

Addresses https://github.com/orgs/cake-build/discussions/4665

paulomorgado avatar Dec 05 '25 18:12 paulomorgado

To test this add som configuration validation in Frosting integration test project here: https://github.com/cake-build/cake/tree/develop/tests/integration/Cake.Frosting/build

It's called here:

https://github.com/cake-build/cake/blob/3531435a932dd112984f04798af694efa5326997/build.cake#L374-L384

Any example I could follow?

Wouldn't it be better if there were also unit tests?

paulomorgado avatar Dec 06 '25 16:12 paulomorgado

Any example I could follow?

You can add arguments here https://github.com/cake-build/cake/blob/3531435a932dd112984f04798af694efa5326997/build.cake#L375-L377

Environment variables can be set on the DotNetRunSettings using EnvironmentVariables property.

Config file is here: https://github.com/cake-build/cake/blob/3531435a932dd112984f04798af694efa5326997/tests/integration/Cake.Frosting/cake.config#L1-L2

Which then should be able to be picked up in a task here https://github.com/cake-build/cake/tree/3531435a932dd112984f04798af694efa5326997/tests/integration/Cake.Frosting/build/Tasks

Wouldn't it be better if there were also unit tests?

Integration test would E"E, but Unit tests won't hurt, Frosting specific tests are located here https://github.com/cake-build/cake/blob/3531435a932dd112984f04798af694efa5326997/src/Cake.Frosting.Tests/CakeHostTests.cs

devlead avatar Dec 10 '25 12:12 devlead

Any example I could follow?

You can add arguments here

https://github.com/cake-build/cake/blob/3531435a932dd112984f04798af694efa5326997/build.cake#L375-L377

Environment variables can be set on the DotNetRunSettings using EnvironmentVariables property.

Config file is here:

https://github.com/cake-build/cake/blob/3531435a932dd112984f04798af694efa5326997/tests/integration/Cake.Frosting/cake.config#L1-L2

Which then should be able to be picked up in a task here https://github.com/cake-build/cake/tree/3531435a932dd112984f04798af694efa5326997/tests/integration/Cake.Frosting/build/Tasks

Wouldn't it be better if there were also unit tests?

Integration test would E"E, but Unit tests won't hurt, Frosting specific tests are located here https://github.com/cake-build/cake/blob/3531435a932dd112984f04798af694efa5326997/src/Cake.Frosting.Tests/CakeHostTests.cs

@devlead,

I couldn't figure out how to assert the results using the tasks you pointed to, but I added unit tests.

paulomorgado avatar Dec 11 '25 08:12 paulomorgado

@paulomorgado your changes have been merged, thanks for your contribution 👍

devlead avatar Dec 11 '25 20:12 devlead

@paulomorgado your changes have been merged, thanks for your contribution 👍

@devlead, thank you for your help.

paulomorgado avatar Dec 11 '25 20:12 paulomorgado