KEMBAR78
Reenable download of optional nonbundled dependencies by novotnyr · Pull Request #1294 · JetBrains/intellij-plugin-verifier · GitHub
Skip to content

Conversation

novotnyr
Copy link
Collaborator

@novotnyr novotnyr commented Jun 13, 2025

Dependency Download

  • DefaultClassResolverProvider is able to download missing plugin dependencies even when the DependencyTree is used.
  • Introduce DependencyFinderPluginProvider as a bridge between PluginProvider from the IntelliJ Structure library and DependencyFinder from the Plugin Verifier library. This allows to download dependencies via JetBrains Marketplace or local caches.
  • DefaultPluginDetailsProvider has a flag whether to provide missing dependencies from other sources.

ZIP-based Plugin handling

  • OptionalDependencyResolver can extract ZIP plugins and retain their extracted directories as a file-system cache for further processing of classpaths.

  • Let PluginCreator maintain additional resources that can be closed. This is used for extracted ZIP archives.

  • Let PluginCreationResult carry additional resources that can be closed. This is used for extracted ZIP archives.

  • DefaultPluginDetailsProvider is now stateful as it collects extracted directories of ZIP plugins that were downloaded from JetBrains Marketplace.

  • Make DefaultPluginDetailsProvider stateful. For ZIP plugins, reuse their extracted directories as a plugin construction sources.

  • Introduce PluginResourceCache that is able to maintain a list of extracted directories corresponding to ZIP archives. IntelliJ Structure and IntelliJ Plugin Verifier will share this cache in order to

    • maintain the classpath point to real files in the filesystem
    • do not unnecessary expand plugin ZIPs between Structure and Verification

    This cache is used in all places when plugin is scanned for classes.

Plugin and Module resolution

  • CachingPluginDependencyResolverProvider is updated with an ability to decide if a plugin is an IDE module
  • CachingPluginDependencyResolverProvider is updated with an ability to augment list of dependencies. This is used to contribute Java module for legacy plugins.
  • Ide is able to provide plugin or module by ID and indicate the source of this provision.
  • Introduce CompositePluginProvider for searching in multiple providers.
  • PluginProvider now provides a method to find plugin by ID or module ID. Since the semantics can be complex, an exact source of the plugin is provided.
  • PluginProvider now provides a method to indicate if a plugin with a specified ID is present.
  • Simplify BundledPluginDependencyFinder to consult an IDE instance for bundled plugins.

Optimizations

  • DependencyTree mechanism has been optimized to prevent unnecessary resolution of plugins or modules.
  • DependencyTree is able to distinguish between plugins or modules by an external predicate.
  • Rework LegacyPluginDependencyContributor to consult an IDE instance for Java module.

@novotnyr novotnyr requested a review from Copilot June 13, 2025 12:10
Copilot

This comment was marked as outdated.

@novotnyr novotnyr force-pushed the optional-dependency-resolution branch 2 times, most recently from 6e4248e to 31c9f5e Compare June 13, 2025 14:48
@novotnyr novotnyr marked this pull request as ready for review June 13, 2025 14:52
@novotnyr novotnyr force-pushed the optional-dependency-resolution branch from 31c9f5e to 5e663b0 Compare June 13, 2025 21:06
@novotnyr novotnyr marked this pull request as draft June 14, 2025 22:10
@novotnyr novotnyr requested a review from Copilot June 16, 2025 18:59
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Re-enable download of optional non-bundled dependencies, add ZIP plugin resource caching, and extend plugin/provider APIs for module-based lookup.

  • Bridge between IntelliJ Structure’s PluginProvider and Plugin Verifier’s DependencyFinder for dependency downloads.
  • Introduce PluginResourceCache to cache and reuse extracted ZIP plugin directories.
  • Extend PluginProvider/PluginQuery with module-ID search, findPluginByIdOrModuleId, containsPlugin, and add CompositePluginProvider.

Reviewed Changes

Copilot reviewed 68 out of 68 changed files in this pull request and generated no comments.

Show a summary per file
File Description
EmptyPluginResourceCache.kt No-op implementation of PluginResourceCache.
PluginQuery.java Add searchContentModuleId flag, builder method, and update toString().
PluginProvision.kt Add CONTENT_MODULE_ID source and override toString() for better messaging.
PluginProviderResult.java Introduce result wrapper with resolution Type enum (PLUGIN/MODULE).
PluginProvider.java Add findPluginByIdOrModuleId, containsPlugin, and getPresentableName.
PluginCreator.kt Track and propagate ZipPluginResource instances and delete them on failure.
InlineDeclaredModuleV2Dependency.kt Correct isModule flags and refine toString() wording.
IdePluginManager.kt Refactor ZIP extraction flow with deleteExtractedDirectory flag and resource cleanup.
CompositePluginProvider.kt Implement multi-source lookup for both plugin ID and module ID.
IdePluginClassesFinder.kt Integrate PluginResourceCache to reuse extracted plugin directories.
ClassSearchContext.kt Encapsulate cache and extract directory in a search context.
BundledPluginClassesFinder.kt Pass ClassSearchContext to IdePluginClassesFinder.
PluginQueryMatcher.kt Match searchContentModuleId in IDE-side query logic.
Ide.java Delegate module-ID lookup via PluginProviderResult and add helper methods.
CachingPluginDependencyResolverProvider.kt Parameterize IDE module predicate/dependencies modifier and simplify resolver creation.
DelegatingResolver.kt Add DelegatingNamedResolver for lazy delegate initialization.
Jar.kt Catch NoSuchElementException to throw clearer JarArchiveException.
Deletable.kt Add Deletable interface for resource cleanup.
BasePluginProblem.kt Fix minor grammar in Javadoc.
PluginCreationResult.kt Extend success result with closeable resources list.
Comments suppressed due to low confidence (2)

intellij-plugin-structure/structure-intellij/src/main/java/com/jetbrains/plugin/structure/intellij/plugin/CompositePluginProvider.kt:35

  • The implementation of findPluginByIdOrModuleId does not return the result of the let expression. Each call creates a PluginProviderResult but it’s never returned. Add return before the provider lookup so found results are actually returned.
provider.findPluginById(pluginIdOrModuleId)?.let { PluginProviderResult(PLUGIN, it) }

intellij-plugin-structure/structure-intellij/src/main/java/com/jetbrains/plugin/structure/intellij/plugin/IdePluginManager.kt:159

  • The variable plugin is not defined in this scope. You likely intended to pass the IdePlugin instance managed by the PluginCreator. Update this reference to use the correct variable (for example, this.plugin or a properly named variable from the surrounding context).
resources += ZipPluginResource.of(pluginFile, extractedDir, plugin)

@novotnyr novotnyr marked this pull request as ready for review June 16, 2025 19:18
@novotnyr novotnyr merged commit 8df9856 into master Jun 16, 2025
4 checks passed
@novotnyr novotnyr deleted the optional-dependency-resolution branch June 16, 2025 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant