-
Notifications
You must be signed in to change notification settings - Fork 24
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
#131: Support for tool dependencies #145
#131: Support for tool dependencies #145
Conversation
…re/131-support-for-tool-dependecies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR.
I've found some parts which might be implemented in VersionIdentifier
already.
It also looks like the auto reformat (imports) was not applied properly.
Please check.
cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
Outdated
Show resolved
Hide resolved
…thub.com/aBega2000/IDEasy into feature/131-support-for-tool-dependecies # Conflicts: # cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your adjustments.
Please check my requested changes. I think we should use the json mapper with a model instead.
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
…thub.com/aBega2000/IDEasy into feature/131-support-for-tool-dependecies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your changes. I've added some small suggestions and comments.
I would also suggest to add some tests for your methods e.g. readJson
, findDependencyVersionToInstall
etc.
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
…thub.com/aBega2000/IDEasy into feature/131-support-for-tool-dependecies
Pull Request Test Coverage Report for Build 8190881140Details
💛 - Coveralls |
As Coveralls suggests, we need to add some unit tests for these additions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aBega2000 thanks for this PR. You did a good job to implement this rather advanced story and get the pieces together. 👍
As @jan-vcapgemini already requested, you need to add JUnit tests that cover your new code. The tests also help to see the feature in action as then we can look at concrete examples with JSON files used by the test.
Also there are merge issues that have to be addressed (sorry for the review delay).
Please also address the review comments.
cli/src/main/java/com/devonfw/tools/ide/url/model/file/dependencyJson/DependencyJson.java
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/url/model/file/dependencyJson/DependencyInfo.java
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
this.dependencies = new LinkedHashMap<>(); | ||
} | ||
|
||
public Map<String, List<DependencyInfo>> getDependencies() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general it is better to keep such structures internally to simplify the JSON mapping with Jackson but for the public API instead provide rather something like public List<DependencyInfo> getDependencies(VersionIdentifier toolVersion)
or if you want to keep logic out of the data objects and keep them dump and stupid public List<ToolVersionDependencyInfo> getDependencies()
. Looking at this method some new member in the team will not have a clue what the semantic of this map will be. What are the keys of type String
? Truth is they are VersionIdentifiers
(or are they patterns or may they also be version ranges)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my Opinion it also makes sense to only change the String to VersionRange, and that's what I've done. Please let me know if this really makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets agree on this Map<String, List<DependencyInfo>>
as it makes the JSON structure simpler.
But we can omit the root object and you can directly deserialize to Map
:
https://www.baeldung.com/jackson-map#bd-3-mapltobjectobjectgt-deserialization
I would propose to keep some class like DependencyJson
that contains the code to read the JSON and provides the result as DependencyJson
wrapping the Map
in Java without the root object being in the JSON syntax.
Then DependencyJson
should also implement validation logic so that we can render a warning if we hit something like this:
{ "[1.0.0, 2.0.0]": [ ... ],
"[1.1.0, 1.9.9]": [ ... ],
...
}
So in other words valid JSON should not contain overlapping VersionRange
s.
cli/src/main/java/com/devonfw/tools/ide/url/model/file/dependencyJson/DependencyInfo.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/url/model/file/dependencyJson/DependencyInfo.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
…131-support-for-tool-dependecies # Conflicts: # cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
…thub.com/aBega2000/IDEasy into feature/131-support-for-tool-dependecies
…re/131-support-for-tool-dependecies
# Conflicts: # cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
For the record. JUnit test can be found in PR #250 |
All changes had also been included in PR #250 that has already been merged. |
Fixes: #131
This is the part of the solution that is implemented in the ToolCommandlet. It automatically detects if there are dependencies to be installed, and installs them in the Repository.
The Json file to be read has the following format:
{
"dependencies": {
"(10.0.27,10.1.18]": [
{
"tool": "java",
"versionRange": "[11,21_35]"
}
],
"(9.0.85,10.0.27]": [
{
"tool": "java",
"versionRange": "[8,11)"
}
]
}
}
A guide to how to create a Json file for dependencies will also be written.