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

Support for identifying the base project directory #307

Open
hcoles opened this issue Mar 18, 2022 · 5 comments
Open

Support for identifying the base project directory #307

hcoles opened this issue Mar 18, 2022 · 5 comments

Comments

@hcoles
Copy link

hcoles commented Mar 18, 2022

Hi @szpak

I'm hoping to add some functionality to pitest that depends on being able to identify the base directory of a project. From some quick experiments, I don't believe its possible to do this from within pitest itself for a multi module gradle build (excpect by walking directories on the file system).

I'm therefore proposing adding a new parameter to be passed to pitest 1.7.5 onwards

hcoles/pitest#999

It should be set to the root directory of a project. I assume this is easy to identify from within the gradle plugin?

@szpak
Copy link
Owner

szpak commented Mar 18, 2022

There's project.rootProject which usually should be a good candidate. However, for monorepos and maybe the Android projects it might be tricky and in the aggregate support we decided to put the aggregated report files in the project where the aggregate report plugin was applied (and aggregating reports from its subprojects). Unfortunately, that aggregate plugin is completely optional and the main PIT plugiin knows nothing of it.

The key question is what will it be used for? Just in the context of aggregation?

@hcoles
Copy link
Author

hcoles commented Mar 20, 2022

The initial use case is support for a .pitest directory at the root of the project to store config for all projects within it. It wouldn't be relevent for aggregation.

@szpak
Copy link
Owner

szpak commented Mar 20, 2022

I could use the rootProject directory, but allow users to override it - for the corner cases.

I will also probably need a generic mechanism to decide which parameters which be passed to which PIT version (vide --testPlugin).

Btw, would that configuration affect the way how the Gradle plugin configures PIT?

@hcoles
Copy link
Author

hcoles commented Mar 20, 2022

The idea of the .pitest directory is to provide config without having to update each of the build integrations. The initial thinking is to use it for things best expressed in a file, rather than for individual values.

The immediate use case is licence files for the Arcmutate commercial extensions, but I'm also hoping to release a plugin in the next few weeks that allows sections of the code to be marked as "do not mutate" based on a simple expression language.

I guess gradle's caching mechanism will need to be aware of files in there.

@szpak szpak added this to the 1.7.5 milestone Mar 20, 2022
@szpak
Copy link
Owner

szpak commented Mar 20, 2022

(In the future) The configuration file could be treated as an input for Gradle configuration. However, as the Gradle configuration is more versatile (e.g. a dynamic Groovy/Kotlin expression execution), the Gradle plugin would rather generate the configuration file, based on its own configuration (and generic settings in Gradle - e.g. number and location of the subprojects). In that case, we could probably limit the number of parameters passed to PIT executable (similarly to additionalClasspathFile).

@szpak szpak modified the milestones: 1.9.0, 1.9.1 Aug 19, 2022
@szpak szpak modified the milestones: 1.9.11, 1.9.12 Nov 25, 2022
@szpak szpak modified the milestones: 1.14.0, 1.14.1 Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants