Class AppliedPluginCollector

java.lang.Object
io.github.duckasteroid.agentdocs.resolve.task.AppliedPluginCollector

public final class AppliedPluginCollector extends Object
Discovers Agent-Docs-aware Gradle plugins applied via the plugins {} block.

Unlike regular dependencies, plugins applied this way aren't resolved onto a project Configuration — there's no Maven GAV to read off a resolved component. Instead, each applied Plugin's own class reveals the jar it was loaded from (via its classloader's code source), which is exactly where publish-side tooling would have stamped the Agent-Docs manifest attribute (per specification/java-conventions.md) when embedding docs — the only distribution mode supported for Gradle plugin projects.

The plugin id itself is recovered from the same jar's META-INF/gradle-plugins/*.properties descriptors (the standard mechanism java-gradle-plugin generates and Gradle itself uses to resolve id '...' to an implementation class), matched back to the applied class.

  • Method Details

    • collect

      public static List<AppliedPluginCollector.DeclaredPlugin> collect(org.gradle.api.plugins.PluginContainer plugins, org.gradle.api.logging.Logger logger)
      Collects every applied plugin whose own jar carries an Agent-Docs manifest declaration, resolving each one's plugin id along the way.

      Plugins without the attribute (essentially every core Gradle plugin, and any third-party plugin that hasn't adopted the convention) are skipped entirely — no different from a regular dependency without the attribute. A non-classpath scheme (there is no consumer-side resolution path for a maven sidecar here, since plugin jars aren't resolved as project dependencies) is skipped with a warning. A jar carrying the attribute whose plugin id can't be determined from its descriptors is skipped with an info-level log, since it's not actionable by the consumer.

      Parameters:
      plugins - the project's applied plugins
      logger - logger for diagnostics
      Returns:
      discovered plugins with a usable classpath declaration