-
Notifications
You must be signed in to change notification settings - Fork 18
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
#317: added BuildCommandlet #340
base: main
Are you sure you want to change the base?
#317: added BuildCommandlet #340
Conversation
added BuildCommandlet added BuildCommandletTest added BuildCommandletTest resources
set npm test to parameterized to enforce windows only
# Conflicts: # cli/src/main/resources/nls/Ide.properties # cli/src/main/resources/nls/Ide_de.properties
added missing val path property to nls files adjusted assertLogMessage (removed parameterized test)
Pull Request Test Coverage Report for Build 9301625045Details
💛 - Coveralls |
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.
Thank you for this PR. Everything seems fine to me.
cli/src/main/java/com/devonfw/tools/ide/commandlet/BuildCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/commandlet/BuildCommandlet.java
Outdated
Show resolved
Hide resolved
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.
@jan-vcapgemini thanks for this PR. You did a great job implementing this and especially testing this commandlet with all its scenarios. 👍
However, there is some concern with the CLI properties and related behavior that differs from devonfw-ide. Please have a look at my review comments.
changed PathProperty to multivalued StringPropertery adjusted tests
added build documentation added mvn documentation added npm documentation added yarn documentation
replaced devon with ide
added default build options environment variables and handling added gradle documentation added default options to documentations added test for default options
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.
@jan-vcapgemini Thanks for your update. You did some great improvements 👍
Probably for complex stories I should next time do the reverse-engineering myself and write everything explicitly as requirements and acceptance criteria into the story. Due to lack of time, I created all the commandlet stories via copy&paste with a simple link to the old code and expected the developer to do the reverse-engineering. As it turns out this seems to be more tricky than expected...
Please have a look at my review comments.
Path buildPath = this.context.getCwd(); | ||
String[] defaultToolOptions = new String[0]; | ||
|
||
if (buildPath != null) { |
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.
so if buildPath
(aka cwd
) would be null
then we do nothing?
IMHO this will never happen but if we want to handle this explicitly, I would rather do something like this:
if (buildPath == null) {
throw new CliException("Missing current working directory!");
}
|
||
defaultToolOptions = getDefaultToolOptions(NPM_BUILD_OPTS.getName()); | ||
} | ||
} |
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.
again we have no else
here. So what if neither pom.xml
nor build.gradle
nor package.json
was found?
Then we silently do nothing?
Again I would recommend explicit error handling:
} | |
} else { | |
throw new CliException("Could not find build descriptor - no pom.xml, build.gradle, or package.json found!"); | |
} |
@@ -49,6 +49,18 @@ public interface IdeVariables { | |||
|
|||
/** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getWorkspaceName() WORKSPACE}. */ | |||
|
|||
/** {@link VariableDefinition} for default build options of mvn */ | |||
VariableDefinitionString MVN_BUILD_OPTS = new VariableDefinitionString("MVN_BUILD_OPTS", null, c -> ""); |
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.
As pointed out: https://github.com/devonfw/ide/blob/cdf4af5de21489f3fdcbfdab41af858822e0d598/scripts/src/main/resources/scripts/command/mvn#L354
VariableDefinitionString MVN_BUILD_OPTS = new VariableDefinitionString("MVN_BUILD_OPTS", null, c -> ""); | |
VariableDefinitionString MVN_BUILD_OPTS = new VariableDefinitionString("MVN_BUILD_OPTS", null, c -> "clean deploy"); |
VariableDefinitionString MVN_BUILD_OPTS = new VariableDefinitionString("MVN_BUILD_OPTS", null, c -> ""); | ||
|
||
/** {@link VariableDefinition} for default build options of npm */ | ||
VariableDefinitionString NPM_BUILD_OPTS = new VariableDefinitionString("NPM_BUILD_OPTS", null, c -> ""); |
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.
This one seems more tricky - see
https://github.com/devonfw/ide/blob/cdf4af5de21489f3fdcbfdab41af858822e0d598/scripts/src/main/resources/scripts/command/npm#L118-L124
and
https://github.com/devonfw/ide/blob/cdf4af5de21489f3fdcbfdab41af858822e0d598/scripts/src/main/resources/scripts/command/npm#L92-L98
Maybe we should address this one in a separate PR and merge as is? So far this would be my suggestion to make better progress... So either create an issue for this and link here as comment so I can resolve or already address in this PR adding even more new features and complexity.
VariableDefinitionString NPM_BUILD_OPTS = new VariableDefinitionString("NPM_BUILD_OPTS", null, c -> ""); | ||
|
||
/** {@link VariableDefinition} for default build options of gradle */ | ||
VariableDefinitionString GRADLE_BUILD_OPTS = new VariableDefinitionString("GRADLE_BUILD_OPTS", null, c -> ""); |
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.
Again see here: https://github.com/devonfw/ide/blob/cdf4af5de21489f3fdcbfdab41af858822e0d598/scripts/src/main/resources/scripts/command/gradle#L91
VariableDefinitionString GRADLE_BUILD_OPTS = new VariableDefinitionString("GRADLE_BUILD_OPTS", null, c -> ""); | |
VariableDefinitionString GRADLE_BUILD_OPTS = new VariableDefinitionString("GRADLE_BUILD_OPTS", null, c -> "clean dist"); |
VariableDefinitionString GRADLE_BUILD_OPTS = new VariableDefinitionString("GRADLE_BUILD_OPTS", null, c -> ""); | ||
|
||
/** {@link VariableDefinition} for default build options of yarn */ | ||
VariableDefinitionString YARN_BUILD_OPTS = new VariableDefinitionString("YARN_BUILD_OPTS", null, c -> ""); |
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.
NODE_VERSION=v18.19.1 | ||
NPM_VERSION=9.9.2 | ||
GRADLE_VERSION=8.7 | ||
MVN_BUILD_OPTS=clean install |
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.
This is the default that is supposed to be build-in. Either remove or override with something else to test the overriding mechanism.
@@ -0,0 +1,12 @@ | |||
:toc: |
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.
As discussed in our meetings we do not want to come back to having help documentation on github in asciidoc.
This has many disadvantages (not available offline, esp. not accurate if the installed release differs from the latest documentation in development, no localization, not intuitive for CLI users, etc.).
Simply use your invest to put this into the CLI help output. Also please add the new variables to the variables.adoc
. Then you can remove these 5 added adocs.
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.
For this we already agreed in the team to add yet another help property for the detailed description of a commandlet.
So ide help «commandlet»
will not only print cmd.build
but also cmd.build.detail
.
I can prepare the PR for this change.
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.
Implemented:
#389
Fixes: #317
Implements