Skip to content

Ability for platform specific dependencies #1952

@hohwille

Description

@hohwille

Task summary

In ide-urls we have metadata for our tools.
Example for pip: https://github.com/devonfw/ide-urls/blob/master/pip/dependencies.json
So for a specific version range, we can define any number of dependencies.
A single dependency currently only supports tool and versionRange:

    {
      "tool": "python",
      "versionRange": "[3.6,3.11)"
    }

In devonfw/ide-urls#42 we have an example where we need a dependency only for macos.
Currently we can only add it globally for all OS causing negative side-effects that are undesired.
I early on introduced a configuration to our JSON mapping that we ignore unknown properties without exception.
This allows us to extend our JSON without breaking existing IDEasy installations and users.

The idea of this story is to allow adding "condition(s)" to a dependency:

    {
      "tool": "python",
      "versionRange": "[3.6,3.11)",
      "os": "mac",
      "arch": "arm64"
    }

If os or arch is present then the current OS or Architecture must match the given value or the dependency is ignored.

Additional context

Question: Should we rather support array values?

"os": [ "mac", "linux" ]

Or rather some expression syntax?

"os": "!windows"

Or will this be overengineered?
IMHO we can even keep it simple.
This is an edge-case. If we ever have a dependency for e.g. 2 OS we could duplicate it with the different OS or we can then still extend this feature.

Metadata

Metadata

Assignees

Labels

dependenciesdependencies.json (if tool A requires tool B)enhancementNew feature or requestinternalNothing to be added to CHANGELOG, only internal storyready-to-implement

Type

No fields configured for Task.

Projects

Status

✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions