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

move logic of environment-project.bat to bash script #488

Open
markusschuh opened this issue Oct 17, 2020 · 2 comments
Open

move logic of environment-project.bat to bash script #488

markusschuh opened this issue Oct 17, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@markusschuh
Copy link
Member

As a developer, I want devonfw-ide to support the variable definitions from different devon.properties the same on the different supported operating systems.

Currently the environment-project.bat does the interpretation of devon.properties with code independent of environment-project. It is quite likely there are more issues with the results, when some variable values beyond the more simpler cases were used. The non-support for "!" in the value under windows as mentioned within #456 is just one example.

I have instead the following architecture in mind:

  1. the environment-project.bat could be replaced by a wrapper which - more or less - just executes @FOR /f "tokens=*" %i IN ('bash environment-project --windows') DO @%i (*)
  2. the environment-project could be extended with
    1. learn a new option --windows
    2. if option is set do not set / unset variables but instead output a "set ${key}=${value}" / "${key}=" on stdout
    3. the ${value} needs to be made compatible to windows (e.g. by using cygpath)

This could even be extended, so the bash script with the logic always just outputs the variable definitions - depending on the shell environment, which is either read from command option or as fallback autodetected. Even on macOS / linux the environment-project itself were then also just a short wrapper script, which runs this script and uses eval or another appropriate way to do the variable setting.

At the same time some - at least - simple test cases could be added, that help to verify, the devon.properties syntax stays supported after another change.

I'll try to make provide some concrete PR for this proposal. But potentially needs some more work and time.

Feedback for this proposal is more than welcome.

(*) The idea of such a wrapper is borrowed from the command docker-machine env as well as some other related cli commands

@markusschuh markusschuh added the enhancement New feature or request label Oct 17, 2020
@hohwille
Copy link
Member

I generally love the idea to reduce maintenance effort and when I redesigned oasp4j-ide to create devonfw-ide, I started the idea to do as much in bash and as little in CMD as possible. So thanks for your ideas and suggestions.

I am happy to review your PR but currently I am not entirely sure how to solve this properly (still considering ${var} vs. %var% and all these cases) but with quite some effort it should be doable. We should also test the performance before we make a final choice...

@hohwille
Copy link
Member

FYI: We consider such approach for #1090.

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

No branches or pull requests

2 participants