-
Notifications
You must be signed in to change notification settings - Fork 53
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
Decoupled adhoc static plugin method invocations on hooks management #300
Decoupled adhoc static plugin method invocations on hooks management #300
Conversation
3065594
to
52f1332
Compare
52f1332
to
b470193
Compare
b470193
to
9e7b289
Compare
…gin-compat-tester-1 into external-hooks-support
aa6ed08
to
6ea528a
Compare
The failure on buildtriggerbadge test seems happening on |
plugins-compat-tester-cli/src/main/java/org/jenkins/tools/test/CliOptions.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the external hook jars looks OK (would be nice if it did not fail silently though).
Do not understand the other code we enough to spot anything obviously wrong.
...at-tester-model/src/main/java/org/jenkins/tools/test/model/hook/PluginCompatTesterHooks.java
Outdated
Show resolved
Hide resolved
I tried to explain it in the PR description. Mostly this PR is providing support to decouple everything related with hooks to make it feasible to use and provide external ones from outside the PCT code by itself. So, some code, mostly from
Which seems like a bad smell and makes it hard to use these hooks if you want to apply it for external ones too. So proposed to get all this dynamically as shown in the PR content, mostly using a new method to retrieve all the hooks before a specific stage. It would get internal ones (from the PCT by itself) and external ones provided by Happy to clarify more doubts here if needed @jtnord |
f11146d
to
4bf012e
Compare
Checks have the same results as |
// Find all steps for a given stage. Long due to casting | ||
switch(stage) { | ||
case "compilation" : | ||
Set<Class<? extends PluginCompatTesterHookBeforeCompile>> compSteps = reflections.getSubTypesOf(PluginCompatTesterHookBeforeCompile.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just found this PR. Is it too late to request that this be improved to use either ServiceLoader
(with metainf-services-annotation
) or https://github.com/jglick/sezpoz? Scanning bytecode for classes that happen to implement some interface is pretty fragile (as well as more work than the clean solutions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggested the former, so 👍🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that PCT was already using bytecode scanning, but this PR switches it from an unfortunate implementation detail to a public API.
Highlights
Current code of PCT on
TransformPom
andMultiParentCompileHook
hooks is highly coupled to someAbstractMultiParentHook
instances (likeStructsHook
,BlueOceanHook
, etc.)Current proposal remove the need to explicitly mention each hook involved in as a bad smell design
In addition, with the current code, if we want to fork the PCT and include new hooks, every time we sync with upstream we will have to deal with including our additional hooks on these two ones (
TransformPom
andMultiParentCompileHook
)What is proposed here is to provide a public method on
PluginCompatTesterHooks
to dynamically retrieve the registered hooks for a given stage, and to use that method on the affected ones to be refactoredAlso it provides a new option arg named
-externalHooksJars
to specify a comma-separated list of external hooks jar file locationsMake sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
Ensure that the pull request title represents the desired changelog entry
Please describe what you did
Link to relevant issues in GitHub or Jira
Link to relevant pull requests, esp. upstream and downstream changes
Ensure you have provided tests - that demonstrates feature works or fixes the issue