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

Inherit with override for pathFilter #1042

Open
thomas-ravkilde opened this issue Apr 8, 2024 · 3 comments
Open

Inherit with override for pathFilter #1042

thomas-ravkilde opened this issue Apr 8, 2024 · 3 comments

Comments

@thomas-ravkilde
Copy link

I have a VS solution with a number of projects. Most of them should share the same version but two need to be separate from the others, and each other, due to third-party integration demands (the point mainly being that they should not be version-bumped unless something has very specifically been changed in their projects).

To make everything more simple to maintain, I'd like to use "inherit": "true" and just set the version and pathFilter in those two projects. However, it appears that pathFilter is concatenated when inheriting parent version.json info, which makes path filtering behave somewhat unintuitively.

Right now have to exclude pathFilter in the parent version.json and then have one in every project that lists every folder that needs to be included by NB.GV, Preferably, I'd like to have a parent version.json with "pathFilter": [ ":/", "!separateRepo2", "separateRepo2 ] or similar and just have "pathFilter": [ "." ] for the two separate children.

This sample should illustrate the point: sample.zip

@AArnott
Copy link
Collaborator

AArnott commented May 21, 2024

It seems reasonable for an inheriting version.json to be able to override pathFilter rather than only append to its list. I'm not sure the best way to express this in version.json, but lacking a better idea, maybe add a pathFilterInherit bool property to the schema that is only allowed when inherit: true is set.
Are you interested in contributing this feature yourself?

@thomas-ravkilde
Copy link
Author

thomas-ravkilde commented May 22, 2024 via email

@AnorZaken
Copy link

I also ran into the exact same issue, but I'm thinking a simpler more general fix would be the following:

  • A version.json file will never inherit an exclusion of it's own directory.

I cannot think of any instance where allowing so would make sense anyway (but maybe that's my limited imagination).

So as an example, in a mono-repo, if you have three projects, each with their own version.json + one more in the repo-root that all the others inherit from.
Now let's say one of those three projects is called Foo and it has the same requirements as described in this issue: changes made in Foo should not bump the version of the other projects.

With my suggested change, we could still add !/Foo to the pathFilter of the root version.json and when nbgv parses the version-file inside of /Foo/version.json it should simply be smart enough to know that inheriting /!Foo wouldn't make much sense so it ignores that specific entry (or at least I assume so?).

Would love to hear feedback on this, e.g. if there is a flaw in my reasoning.
(An alternative way of describing this rule would be "Versioning of a project will always include the directory where the project file resides.")

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

3 participants