Add AnalysisPlugin interface for tracking analysis decisions#3
Add AnalysisPlugin interface for tracking analysis decisions#3
Conversation
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
| * @param details detailed information about the decision | ||
| * @throws Exception if an error occurs during processing | ||
| */ | ||
| default void reportAnalysis(Analyzer analyzer, String category, String details) throws Exception { |
There was a problem hiding this comment.
This method is not called anywhere. Is it really needed?
|
@laeubi If you want , we can give this a try again e.g. for bnd 7.3.0 What do you think about making |
|
I think having it as a plugin is already enough as the I can decide if I need the info or not. I also don't think that much complex computations (that not already where taken) are needed here so don't let us over-engineer it here :-) |
|
Ok. Can you set the PR to ready for review and point it to upstream master, so i can merge? |
Implements support for AnalysisPlugin as described in bndtools#6772, providing a way to observe and track analysis decisions made by the Analyzer during bundle creation.
Problem
When building OSGi bundles, bnd analyzes code and determines version ranges for imported packages based on various factors (provider types, explicit directives, version policies). However, there was no way to observe these decisions or understand why a particular version range was chosen, making debugging and auditing difficult.
Solution
This PR introduces a new
AnalysisPlugininterface that receives callbacks during the analysis phase with detailed information about version decisions:The plugin is called during
Analyzer.augmentImports()and provides:Example Usage
In a bnd.bnd file:
Changes
aQute.bnd.service.AnalysisPluginfollowing the existing plugin architecture patternaugmentImports()with helper methodsbuildVersionReason()andreportImportVersion()docs/_plugins/analysisplugin.mdTesting
All tests pass with no regressions:
Use Cases
Closes bndtools#6772
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
bndtools.jfrog.io/usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xms1024m -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.14-bin/38aieal9i53h9rfe7vjup95b9/gradle-8.14/lib/gradle-daemon-main-8.14.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.14-bin/38aieal9i53h9rfe7vjup95b9/gradle-8.14/lib/agents/gradle-instrumentation-agent-8.14.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.14(dns block)scans-in.gradle.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xms1024m -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.14-bin/38aieal9i53h9rfe7vjup95b9/gradle-8.14/lib/gradle-daemon-main-8.14.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.14-bin/38aieal9i53h9rfe7vjup95b9/gradle-8.14/lib/agents/gradle-instrumentation-agent-8.14.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.14(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.