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

Configurable generation of IDE start scripts #513

Closed
andreasrichtercg opened this issue Jan 13, 2021 · 7 comments · Fixed by #577
Closed

Configurable generation of IDE start scripts #513

andreasrichtercg opened this issue Jan 13, 2021 · 7 comments · Fixed by #577
Labels
enhancement New feature or request

Comments

@andreasrichtercg
Copy link

As a developer,
I want start scripts for vscode and eclipse to be created automatically during project import for the workspace defined in (settings/projects/.properties)
so that I don't have to create them manually

@andreasrichtercg andreasrichtercg added the enhancement New feature or request label Jan 13, 2021
@hohwille
Copy link
Member

@andreasrichtercg thanks for this feedback and feature-request. However, we also had the exactly opposite demands in our old oasp4j-ide that always created all the scripts for all workspaces and users found this messy. That is why we designed our CLI and most tech users work with terminal and devon command now.

We should therefore first think how this should be configurable? By default this should be disabled and a user could set something in his ~/devon.properties so for all his upcoming projects setup will create the start scripts. WDYT? Any concrete ideas or suggestions?

@andreasrichtercg
Copy link
Author

andreasrichtercg commented Jan 15, 2021

@hohwille As I (as an architect) want to be in control of the default behaviour I can imagine two approaches:

  • The one you have suggested + the possibility to activate this option already in in settings/devon.properties. The developer however can still overwrite this value again, if it was activated by the architect. But this should correspond to the actual cascading of devon.properties provided by devon.

  • The other approach would be to have a setting in >my-project<.properties (e.g. eclipse.createscripts=true or eclipse=import,create-scripts). Then this could be set individually for each project.
    -- For vscode respectively

@hohwille
Copy link
Member

hohwille commented Jan 19, 2021

@andreasrichtercg thanks for your feedback and your thoughts. As there can be multiple projects per workspace and a launch-script is only created per workspace and also there can be multiple IDEs involved, I would rather not consider the second option.

After all you could simply call devon eclipse --all create-script to create Eclipse start scripts for all workspaces.

If you still think this is too complicated for a developer to do, we should consider a property that triggers the script generation. In that case this property can be defined and overriden in any way as described here:
https://github.com/devonfw/ide/blob/master/documentation/configuration.asciidoc#configuration

For the implementation I see two options:

  1. Extend each IDE commandlet to honor the new variable and create the start-script for all workspaces during setup. So devon eclipse setup would in this case additionally do the same as devon eclipse --all create-script. The same for vscode and intellij. Please note that setup[.bat] script is simply calling devon ide setup what again calls devon «tool» setup for each tool in ${DEVON_IDE_TOOLS}.
  2. The ide commandlet is extended to honor the new variable and after project creation would iterate ${DEVON_IDE_TOOLS} and for each tool that actually is an IDE it would invoke devon «ide» --all create-script.

I have not verified but if the projects are created after tools setup then there is a difference in the result of 1. and 2.
In case a project defines a custom workspace that workspace would be created after 1. has already created the start-scripts and therefore the start-script for that custom workspace would be missing.
However, I like the design of 1. better than 2. and we could also solve this problem during the project creation when we create a new workspace. Also we could consider that launching an IDE for a workspace (e.g. devon eclipse) would also create the start-script if it is missing.

For the variable I would suggest the following to activate the feature:

DEVON_CREATE_START_SCRIPT=true

@andreasrichtercg
Copy link
Author

andreasrichtercg commented Jan 21, 2021

@hohwille Indeed devon eclipse --all create-script would already help here, which I wasnt aware of.

If you still see a value for the community and devon-ide, I think design 1) with additional handling while workspace creation would meet the requirement to setup everything "at once". But the variable to activate the behaviour should be more fine grained based on the ide like ECLIPSE_CREATE_START_SCRIPT=true, as some projects will either use Eclipse or IntelliJ.

... As a thought .. What do you generally think about introducing a hook mechanism to devon-ide like post-create-workspace, post-create-project? Such requirements could be solved with this approach too.

@hohwille
Copy link
Member

hohwille commented Jan 21, 2021

Projects can configure DEVON_IDE_TOOLS and simply disable IDEs they do not want to have included by default.
Then the regular setup would not create a start-script for them. Default already includes vscode and Eclipse while several projects only use one of them.
I am still thinking about all this issue and if we might overengineer it. I want to avoid that our list of variables grows too big and users get lost digging in the documentation. However, if we decide to implement this story and it would be a benefit to distinguish we use something like DEVON_CREATE_START_SCRIPTS=(eclipse vscode) and iterate for each IDE command.

The hook mechanism sounds like an awesome flexibility but so far I have been concerned by security issues when devonfw-ide would automatically execute script code that is controlled by a git-repository. This could allow one user to "hack" another user. Might sound unrealistic within a team but one would never had imagined what hackers are able to do 20 years ago. This is also why devon release only allows to specify additional options but not the build command itself to be executed even though this would allow to integrate build tools we never heard of and therefore considered by our design.

@hohwille hohwille changed the title Automatic generation of start scripts during project import Automatic generation of IDE start scripts May 6, 2021
@hohwille
Copy link
Member

hohwille commented May 6, 2021

With #557 some things changed slightly:

  • we now want to speed up the setup and install tools more lazily to increase UX.
  • therefore DEVON_IDE_TOOLS should not be the place for this feature
  • As suggested we shoud create something like DEVON_CREATE_START_SCRIPTS and analog to DEVON_IDE_TOOLS make it an array (not comma separated).
  • Then during setup we would iterate over all IDEs in DEVON_CREATE_START_SCRIPTS and call create-scripts for it.
  • IMHO the default for DEVON_CREATE_START_SCRIPT should be (eclipse vscode) but projects can customize this e.g. to (intellij) or (intellij vscode).
  • I also think we could add a --all switch then to create the start scripts for all existing workspaces. Maybe we can trigger this after the projects are created so that new workspaces would be honored.
  • Developer geeks that do not like such start scripts can simply set DEVON_CREATE_START_SCRIPTS to an empty value or empty array in their ~/devon.properties file.

@hohwille
Copy link
Member

hohwille commented May 6, 2021

BWT: this entirey product is called devonfw-ide (initially devon-ide and before oasp4j-ide) and therefore we have DEVON_ or DEVON_IDE_ as prefixes in variables. DEVON_IDE_TOOLS is the list of tools that should be setup eagerly when the initial setup[.bat] is executed. With the feature of this story, we actually want to configure the IDEs that a project decides or plans to use. So instead of DEVON_CREATE_START_SCRIPT we could actually name it DEVON_IDES as this are the IDEs, but it seems that this would even cause more confusion together with DEVON_IDE_TOOLS so I suggested this also a little strange and specific name DEVON_CREATE_START_SCRIPTS.

@hohwille hohwille changed the title Automatic generation of IDE start scripts Configurable generation of IDE start scripts May 6, 2021
@hohwille hohwille linked a pull request May 6, 2021 that will close this issue
@hohwille hohwille added this to the release:2021.04.001 milestone May 6, 2021
hohwille added a commit that referenced this issue May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants