Repository navigation
RAT-552: Fix excludeSubProjects silently dropped when exclude is also set - #755
arturobernalg wants to merge 7 commits into
Conversation
|
Thanks for your help here - would you mind taking a look at RAT-97 as well as it addresses errors with the same parameter? |
… set ArgumentTracker.validateSet (and the generated Maven-plugin/Ant-task counterpart in Args.tpl) rejected a value for a non-deprecated, multi-valued option whenever its deprecated alias already had a value. This made excludeSubProjects ineffective in the Maven plugin as soon as the deprecated excludes configuration was also used, since the sub-project patterns are added internally through the non-deprecated input-exclude option. Multi-valued options now always accumulate, merging values from every alias of the group under the key of the non-deprecated option, so a deprecated and non-deprecated spelling of the same option no longer discard each other.
…s used Unconditionally storing a multi-valued option's values under its non-deprecated alias broke commons-cli's own deprecation warning: the literal flag name that ends up in the argument list built by args() is what triggers that notice, so remapping it away even when the caller never touched the other alias silently suppressed the warning in the common case (caught by apache-rat-tasks' GeneratedReportTest in CI). Values now stay under whichever alias was actually used until a second alias of the same group is written to; only then are the two merged under the non-deprecated key, which is the only case that actually needs merging.
0e1bd03 to
74a4afd
Compare
|
@ottlinger I think the solution is in the wrong place, but I may be convinced otherwise. @arturobernalg RAT is a CLI first implementation. So all general implementations start in the RAT CLI code. The RAT CLI configurations are supposed to drive the other UI (Ant, Maven, and eventually Gradle). The UI should not allow multiple configuration options from the same Arg group. That is how we do deprecation. The issue is that the Maven UI does not determine if the current or deprecated Arg group option was used. It should do that and add the modules to the correct one. This means that the addition of the However, I see the point of your change in that if any UI ends up using 2 or more Arg group options the correct processing is completed. We do have on Arg group that has 2 deprecated options, however it has only one argument. |
excludeSubProjectsbecomes ineffective as soon as the deprecatedexcludesconfig is also used, becauseArgumentTracker#validateSet(and the same logic generated fromArgs.tplforBaseRatMojo/the Ant task) treatsinput-excludeand the deprecatedexcludeas mutually exclusive, which is wrong for a multi-valued option: both should accumulate.validateSetnow returns immediately for a multi-valued option, and values from every alias merge into the non-deprecated key once more than one alias is actually used (not unconditionally, since that broke commons-cli's own deprecation notice for the common case — see the second commit).Applied in both
ArgumentTrackerandArgs.tpl(shared by the Maven plugin and the Ant task).Tests: a unit test reproducing the silent drop, and a new
apache-rat-pluginIT (src/it/RAT-552) combiningexcludeSubProjectswith a deprecated<excludes>.