sdk icon indicating copy to clipboard operation
sdk copied to clipboard

[`dotnet-new`] Add inRoot option for AddProjectsToSolutionPostAction

Open levimatheri opened this issue 2 years ago • 7 comments

For dotnet-new issue #4178. Adds inRoot argument which is passed to dotnet sln add as --in-root.

cc @vlada-shubina

levimatheri avatar Sep 18 '22 01:09 levimatheri

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

CLA assistant check
All CLA requirements met.

dnfadmin avatar Sep 18 '22 01:09 dnfadmin

This change requires:

  • documentation update: https://github.com/dotnet/templating/wiki/Post-Action-Registry
  • JSON schema update: https://github.com/dotnet/templating/blob/main/src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/Schemas/JSON/template.json
  • port to 7.0.2xx when branch is available

vlada-shubina avatar Sep 21 '22 12:09 vlada-shubina

@vlada-shubina I'm not sure about the unit test, I don't see one for --solution-folder? Sorry, a bit new to this. Do we just need to test if DotnetSlnPostActionProcessor.TryGetProjectFilesToAdd returns true if --in-root is passed in?

levimatheri avatar Sep 25 '22 02:09 levimatheri

@vlada-shubina Also, was going to add another LocalizableString for the --in-root option output. How are these translated? https://github.com/dotnet/sdk/blob/3eea35e0d77f9a1bc418a364805ff89df818e371/src/Cli/dotnet/commands/dotnet-new/LocalizableStrings.resx#L161-L166

levimatheri avatar Sep 25 '22 03:09 levimatheri

@vlada-shubina I'm not sure about the unit test, I don't see one for --solution-folder? Sorry, a bit new to this. Do we just need to test if DotnetSlnPostActionProcessor.TryGetProjectFilesToAdd returns true if --in-root is passed in?

Testing TryGetProjectFilesToAdd doesn't make a lot of sense.

I would do a test similar to https://github.com/dotnet/sdk/blob/39f66f56bd9d66ccfdb904482d283b5506fc5a68/src/Tests/dotnet.Tests/dotnet-new/DotnetSlnPostActionTests.cs#L197-L223 and check if --inRoot from args was passed properly to the mock callback.

vlada-shubina avatar Sep 26 '22 08:09 vlada-shubina

@vlada-shubina Also, was going to add another LocalizableString for the --in-root option output. How are these translated?

https://github.com/dotnet/sdk/blob/3eea35e0d77f9a1bc418a364805ff89df818e371/src/Cli/dotnet/commands/dotnet-new/LocalizableStrings.resx#L161-L166

Just change an English string in LocalizableStrings.resx as needed and build. The translation will come automatically after some time. If you are using placeholder or some text should not be translated, consider explaining them in Comments column.

vlada-shubina avatar Sep 26 '22 08:09 vlada-shubina

@vlada-shubina PR got messed up, will submit another one.

levimatheri avatar Oct 02 '22 03:10 levimatheri