You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This may be a crazy idea, but I'd love to see it implemented:
If a BOM is used (a managed dependency with <type>pom</type> and <scope>import</scope>) in a project and a dependency version included in this BOM is changed, it would be nice if GIB could build only the modules that depend on the changed dependency.
Detect downstream modules on a BOM module (BOMs added in dependencyManagement doesn’t seem to participate in the dependency graph resolution - need to confirm this)
Detect the dependencies changed in the BOM and build the downstream modules for those dependencies
@gastaldi You did not mention this so I think we are on the same page: I will only consider the downstream path, meaning that GIB will not consider the BOM artifact an upstream dependency for all modules it is imported in. Do you agree?
PS: I might actually have a timeboxed look at this but the downstream path is more important.
@gastaldi WDYT: I thought about adding a new property bomArtifactIdRegex (or similar) that can be used to give GIB an optimization hint so that it does not have to treat everypom module as a potential BOM.
For Quarkus this could be set to quarkus-bom(-test)?.
You could also use this property to effectively disable the BOM check (e.g. - or some other fake value).
I am not sure about the default value. Could be disabled (-) by default to avoid an unnecessary performance hit or could be empty but then it would always consider BOMs.
Or empty means "don't consider BOMs". I actually think this is the best approach. If someone wants GIB to consider BOMs without any hint, then .* can be used (but is discouraged).
but isn't easier to just assume that pom packaging-projects with dependencyManagement are BOMs?
Easier in terms of amount of code to write: yes.
But for each found pom module that is changed or dependends on changed modules, I have to consult all projects in the reactor to check whether they import the respective pom module as a BOM. This can quickly become inefficient.
Yes, and can also inherit from their parent poms too, so maybe we need to think a bit on how would that work performance-wise since having an effective model of each project will definitely be an inefficient operation
Status: First successful run with Quarkus! A change to quarkus-bom triggers 666 (😮) modules, instead of 690 for non-incremental build. 🎉
Nasty catch: MavenProject.getDependencyManagement() (for quarkus-build-parent) does not contain the quarkus-bom dependency anymore! Took me some time to realize that I have to use the depMgmt of the "raw" model instead via MavenProject.getOriginalModel().getDependencyManagement().
Ah I forgot about the getOriginalModel(). This means that the MavenProject itself is already an effective model (which means that #241 (comment) is already resolved).
In Quarkus it is ${project.version} which I consider best practise but it could also be something else. Might yield false positives though but I don't think it is very common to use a BOM that lives in the same project with another version than the rest...?
* [ ] Detect the dependencies changed in the BOM and build the downstream modules for those dependencies
I must have overlooked this but I am not sure that I'll be implementing this for 3.12.0 since this is much more than "just" detecting all downstream modules of a BOM.
I mean GIB would need to:
parse the diff
match the changed property (or properties) to dependencies or (in case no properties are used) look "around" the changed line for the respective coordinates
find all modules that depend on the BOM (mostly done) and depend on one of the changed dependencies
The second action should also take in account changed transitive dependencies (hence why an effective model is necessary in this case)
Eg. commons-io is changed in the BOM and the kubernetes extension must be a candidate, because it depends on kubernetes-client, which depends on commons-io transitively.
Activity
gastaldi commentedon Aug 26, 2020
I think this can be split into two action items:
famod commentedon Aug 30, 2020
@gastaldi You did not mention this so I think we are on the same page: I will only consider the downstream path, meaning that GIB will not consider the BOM artifact an upstream dependency for all modules it is imported in. Do you agree?
PS: I might actually have a timeboxed look at this but the downstream path is more important.
gastaldi commentedon Aug 30, 2020
@famod yes, that's correct.
famod commentedon Aug 31, 2020
@gastaldi WDYT: I thought about adding a new property
bomArtifactIdRegex(or similar) that can be used to give GIB an optimization hint so that it does not have to treat everypommodule as a potential BOM.For Quarkus this could be set to
quarkus-bom(-test)?.You could also use this property to effectively disable the BOM check (e.g.
-or some other fake value).I am not sure about the default value. Could be disabled (
-) by default to avoid an unnecessary performance hit or could be empty but then it would always consider BOMs.Or empty means "don't consider BOMs". I actually think this is the best approach. If someone wants GIB to consider BOMs without any hint, then
.*can be used (but is discouraged).gastaldi commentedon Aug 31, 2020
@famod that sounds like a good idea, but isn't easier to just assume that
pompackaging-projects withdependencyManagementare BOMs?famod commentedon Aug 31, 2020
@gastaldi
Easier in terms of amount of code to write: yes.
But for each found
pommodule that is changed or dependends on changed modules, I have to consult all projects in the reactor to check whether they import the respectivepommodule as a BOM. This can quickly become inefficient.gastaldi commentedon Aug 31, 2020
Yes, and can also inherit from their parent poms too, so maybe we need to think a bit on how would that work performance-wise since having an effective model of each project will definitely be an inefficient operation
famod commentedon Aug 31, 2020
Status: First successful run with Quarkus! A change to
quarkus-bomtriggers 666 (😮) modules, instead of 690 for non-incremental build. 🎉Nasty catch:
MavenProject.getDependencyManagement()(forquarkus-build-parent) does not contain thequarkus-bomdependency anymore! Took me some time to realize that I have to use the depMgmt of the "raw" model instead viaMavenProject.getOriginalModel().getDependencyManagement().gastaldi commentedon Aug 31, 2020
Ah I forgot about the
getOriginalModel(). This means that the MavenProject itself is already an effective model (which means that #241 (comment) is already resolved).famod commentedon Aug 31, 2020
And it's rather fast too, even without
bomArtifactIdRegex(numbers in nanoseconds):Small annoyance (see last line):
In Quarkus it is
${project.version}which I consider best practise but it could also be something else. Might yield false positives though but I don't think it is very common to use a BOM that lives in the same project with another version than the rest...?Will create a PR tomorrow or on Wednesday.
gastaldi commentedon Aug 31, 2020
Can't wait to try it :)
famod commentedon Aug 31, 2020
@gastaldi
https://oss.sonatype.org/content/repositories/snapshots/com/vackosar/gitflowincrementalbuilder/gitflow-incremental-builder/3.12.0-SNAPSHOT
3.12.0-20200831.222512-1😉
famod commentedon Aug 31, 2020
@gastaldi
I must have overlooked this but I am not sure that I'll be implementing this for 3.12.0 since this is much more than "just" detecting all downstream modules of a BOM.
I mean GIB would need to:
gastaldi commentedon Aug 31, 2020
Yeah, that's why I split into two actions:
The first is a minimum requirement to make it work with BOMs;
The second one is more fine grained and adds a lot of value if/when implemented. It can be part of a later release if you like
gastaldi commentedon Aug 31, 2020
The second action should also take in account changed transitive dependencies (hence why an effective model is necessary in this case)
Eg. commons-io is changed in the BOM and the kubernetes extension must be a candidate, because it depends on kubernetes-client, which depends on commons-io transitively.
famod commentedon Sep 2, 2020
PR takes me a little longer since I found a way to resolve something like
${project.version}properly.WIP branch: master...famod:issue-241-bom-support