commit | 9fa97a4ee7b5126be61eeb215fea02475e5350e3 | [log] [tgz] |
---|---|---|
author | Edwin Kempin <ekempin@google.com> | Fri Feb 26 16:41:34 2021 +0100 |
committer | Edwin Kempin <ekempin@google.com> | Sat Feb 27 21:23:16 2021 +0100 |
tree | 1f05d1fb55d546762f01c4c0a20f1be51503f87f | |
parent | 135b28f87ce7ca4e4e9fd13a2d1a656bb197487e [diff] |
Refactor config reading as preparation to reduce plugin config loads Loading a plugin config with inheritance via pluginConfigFactory#getProjectPluginConfigWithInheritance(projectName, pluginName) is not free as it needs to overlay the config with the configs of the parent projects. All configs are cached in the project cache but doing the overlaying too often can still get expensive. At the moment we do the overlaying each time a config parameter is read and since we have a lot of config parameters that get read all over the code this sums up. At the moment to read a config parameter we do: 1. get CodeOwnersPluginConfiguration injected 2. call getFoo(Project.NameKey) or getFoo(BranchNameKey) on the CodeOwnersPluginConfiguration Each codeOwnersPluginConfiguration.getFoo(...) call invokes pluginConfigFactory#getProjectPluginConfigWithInheritance(projectName, pluginName). With this change we refactor these calls to: codeOwnersPluginConfiguration.getProjectConfig(Project.NameKey).getFoo() and codeOwnersPluginConfiguration.getProjectConfig(Project.NameKey).getFoo(branchName). codeOwnersPluginConfiguration.getProjectConfig(Project.NameKey) returns a CodeOwnersPluginConfigSnapshot. The advantage of the new CodeOwnersPluginConfigSnapshot class is that it can cache the loaded plugin config and reuse it for subsequent get calls. With this change we do not benefit from this yet, since all places that read a config call codeOwnersPluginConfiguration.getProjectConfig(Project.NameKey) newly which each time creates a new CodeOwnersPluginConfigSnapshot instance. However this will change with the follow-up changes. It's not done in this change yet, so that the refactoring (this change) is separated from doing improvements (follow-up changes) and hence is hopefully easier to review. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: I3ac34367fdbcdaac299f2c76725e48415683b82b
This plugin provides support for defining code owners for files in a repository.
If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.
Also see resources/Documentation/about.md.
IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide, see resources/Documentation/setup-guide.md.