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

CLI: Allow user to set custom base path #2953

Open
rmg-x opened this issue Jun 8, 2024 · 3 comments
Open

CLI: Allow user to set custom base path #2953

rmg-x opened this issue Jun 8, 2024 · 3 comments
Labels
🚀 Feature request New feature or request

Comments

@rmg-x
Copy link
Contributor

rmg-x commented Jun 8, 2024

Is your feature request related to a problem? Please describe.
When running the CLI, it would be useful to override the base path to a value other than the current working directory.

This feature would be useful for mutating projects in the following scenarios:

  1. CI/CD pipelines or other automated flows
  2. Testing local changes to the stryker-net project itself, e.g. trying to run from bin/Debug

Describe the solution you'd like
Add flag to set a custom base path.

Describe alternatives you've considered
N/A

Additional context
Code that handles setting the base path here:

var basePath = Directory.GetCurrentDirectory();
inputs.BasePathInput.SuppliedInput = basePath;

@rmg-x rmg-x added the 🚀 Feature request New feature or request label Jun 8, 2024
@dupdob
Copy link
Member

dupdob commented Jun 9, 2024

I am not sure I understand this correctly.
You could simply change the current directory before running the CLI for that same effect.

Also note that you cannot use Stryker on its own folder: project analysis will fail. You need to use it against another copy of the project.

This is a limitation of buildalyzer that we never tried to fix as it is easy to workaround and very, very specific.

@rmg-x
Copy link
Contributor Author

rmg-x commented Jun 9, 2024

You could simply change the current directory before running the CLI for that same effect.

You can, but this assumes that you're running Stryker from a "convenient" location, e.g. from PATH or global dotnet tool installation. It also seems more intuitive (to me) so that you're not cd-ing everywhere. It's more of a QoL feature when that assumption is broken.

For example, say that I made a local change to stryker-net and want to run it against my console projects.

Debug executable is located here:
C:\Users\me\source\repos\stryker-net-dev\src\Stryker.CLI\Stryker.CLI\bin\Debug\net8.0\Stryker.CLI.exe

My test project locations:
C:\Users\me\source\repos\MyConsoleProj1
C:\Users\me\source\repos\MyConsoleProj2
C:\Users\me\source\repos\MyConsoleProj3

Currently, I would have to cd into each of the console projects and insert the long winded debug executable path for Stryker. Rather than just cd-ing once into the debug folder and passing in the more concise folder locations for my projects to the CLI.

EDIT: This would also help when setting breakpoints and running from the IDE since a simple flag could be set in the run configuration. As a temporary way to make that easier, I just hardcode the base path in ConfigBuilder.cs

Also note that you cannot use Stryker on its own folder

I meant it would be useful for devs working on stryker-net to run against other projects from the debug output folder. Sorry for the confusion.

@rouke-broersma
Copy link
Member

I understand the wish, but this is an change that has the potential to have a large impact. Having to deal with filepaths is hard enough as it is, not being able to make assumptions about paths will require a very thorough review of all functionalities. That's not to say that it's a bad thing, but that it might turn out to be quite a lot of work, and break a lot of things in places where we made assumptions that we should not have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 Feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants