Skip to content
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

Support Optional Dependencies #2

Open
bristermitten opened this issue Jul 18, 2020 · 0 comments
Open

Support Optional Dependencies #2

bristermitten opened this issue Jul 18, 2020 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@bristermitten
Copy link
Owner

bristermitten commented Jul 18, 2020

There are many situations where dependencies may be optional. For example, users may want to only download 1 database driver based on what's in the config.

Currently, this is not possible. If a dependency isn't in the libraries directory, it is downloaded again.

My proposition is to add another field to dependencies.json (and as such Artifact) - "optional": true/false.

The default value should be false. If a dependency is optional, it will only be downloaded on initial loading(or if required transitively).

How should this be implemented?

This idea raises a few complications as to the semantics of implementation:

  • How do we ensure that optional dependencies are only downloaded once?
  • If the dependency graph changes, how should this be handled?
  • How should dependencies be specified as optional in the Gradle plugin?
  • Hypothetically, if Project depends optionally on someLibrary, how should dependency "ownership" be managed, if at all?
  • Should PDM be in charge of automatically deleting unused dependencies?

The obvious solution is some sort of storage in the PluginLibraries directory. This might look something like this:

"optionals": {
    "someLibrary-version": {
        "downloaded:" "timestamp-12349875187"
    } //etc
}

If an optional dependency is present in this file, PDM can assume that it has been downloaded, and will not redownload it if not present.

A method should likely be added to PluginDependencyManager to force download all dependencies, optional ones included.

@bristermitten bristermitten added enhancement New feature or request help wanted Extra attention is needed labels Jul 18, 2020
@bristermitten bristermitten pinned this issue Jul 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Development

No branches or pull requests

1 participant