Closed sambsnyd closed 1 year ago
It would be even nicer if we could additionally also query GitHub so that we can correlate committers with GitHub accounts, since often an individual user uses different combinations of name and email. See the output for the openrewrite/rewrite repository itself:
The issue mentioned above can be cleaned up using a .mailmap
file. The result then looks something like this:
Since JGit currently neither supports .mailmap
nor the shortlog
command, it probably makes more sense to use the git
executable directly in a first step.
While there are enhancements to be made, such as encorporating .mailmap or a similar mechanism to map committer names to github account names, the basic implementation of this is now complete
We need to update our build plugin to include a descriptor of recipe authorship in yaml format into its src/main/resources directory. It is difficult for a build plugin to tell which java sources are recipes and which are unrelated java source files. So for simplicity of implementation we can create a descriptor for every java source file.
Git can be queried with this information on the command line with:
git shortlog --numbered --summary --email -- <path>
Example output from rewrite-python. The number is the count of commits, sorted descending.
It is likely more convenient and efficient to use jgit than to shell out. jgit might already be part of the gradle api.
For each such java file in the main source set, we should produce an entry in
src/main/resources/META-INF/rewrite/recipe-authors.yml
that looks like:Both
RewriteLanguagePlugin
andRewriteRecipeLibraryPlugin
should register a task which produces this yaml file. The java plugin'sProcessResources
task should be configured to copy from it so that it is guaranteed this ends up bundled in the jar.