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

Restarting workspace should take into account changes to eclipse.ini #1307

Conversation

umairsair
Copy link
Contributor

@umairsair umairsair commented Nov 15, 2023

Background:

There are 3 return codes supported by Eclipse

  • 0 - Normal exit
  • 23 - Restart the eclipse with previous launcher arguments
  • 24 - Restart the eclipse with the arguments provided by Eclipse application itself

The above mentioned problem is not with the exit code 23. The reason is that the eclipse launcher restarts itself in this case, hence eclipse.ini is also reloaded. However eclipse launcher does not restart itself in case of code 24 and parses the arguments provided by Eclipse application in shared memory and simply relaunches java, which means that eclipse.ini will not be reloaded.

For restarts, eclipse should be using code 23 but we had to switch to code 24 to fix following issue.
[WorkbenchLauncher] Restart asks for the workspace to run
And then the fix of following built up on it.
[Workspace chooser] "Older Workspace Version" dialog: "Cancel" button shouldn't close Eclipse but go back to workspace chooser

Fix:

For code 24, the arguments in shared memory are for launcher, so instead of launcher just parsing the args and relaunching java, it should restart the launcher with appropriate arguments. With relaunching the launcher, eclipse.ini will be reloaded like its done for code 23.

Eclipse launcher is updated to relaunch for code 24 as well. Moreover, there are 3 new launcher arguments introduced, 2 are internal to launcher and one is external to launcher and can be set by eclipse application as a relaunch argument.

  • --launcher.oldUserArgsStart and --launcher.oldUserArgsEnd: The user arguments passed to eclipse launcher for first start are tracked between these arguments during relaunches. E.g., if eclipse was started as eclipse A B C where A B C are some arguments to launcher and for relaunch, Eclipse application mentioned X Y Z arguments then relaunch command will be eclipse --launcher.oldUserArgsStart A B C --launcher.oldUserArgsEnd A B C X Y Z. Moreover, launcher relaunch will ignore all arguments between and including --launcher.oldUserArgsStart and --launcher.oldUserArgsEnd.
  • --launcher.skipOldUserArgs: If eclipse application wants to relaunch with provided arguments only and ignore the older user args then it can mention this argument. So for the case where eclipse was started as eclipse A B C and Eclipse application mentioned X Y Z as relaunch arguments along with --launcher.skipOldUserArgs then relaunch command will be
    eclipse --launcher.oldUserArgsStart A B C --launcher.oldUserArgsEnd X Y Z where launcher relaunch will ignore all arguments between and including --launcher.oldUserArgsStart and --launcher.oldUserArgsEnd.

For restarts, Eclipse application just mentions the -data argument now as relaunch arguments instead of mentioning complete java args. However, user can still mention more arguments for relaunch and Eclipse restart will respect them as well and append the -data argument at the end of user arguments.

See also eclipse-equinox/equinox#401
Fixes eclipse-equinox/p2#166

Copy link
Contributor

github-actions bot commented Jan 20, 2024

Test Results

   930 files  +    1     930 suites  +1   52m 24s ⏱️ + 14m 55s
 7 474 tests ±    0   7 321 ✅ +    1  153 💤 ±  0  0 ❌  - 1 
23 571 runs  +1 578  23 060 ✅ +1 458  511 💤 +121  0 ❌  - 1 

Results for commit 31da964. ± Comparison against base commit 3c5c4bf.

♻️ This comment has been updated with latest results.

@umairsair umairsair force-pushed the eclipse-equinox-p2-issues-166 branch 3 times, most recently from 67549db to 31da964 Compare January 20, 2024 18:56
@umairsair
Copy link
Contributor Author

@sravanlakkimsetti any comments here or are we good?

@umairsair umairsair force-pushed the eclipse-equinox-p2-issues-166 branch 3 times, most recently from 9b24de8 to 91c3470 Compare January 26, 2024 15:48
Background:
===========
There are 3 return codes supported by Eclipse
- 0  - Normal exit
- 23 - Restart the eclipse with previous launcher arguments
- 24 - Restart the eclipse with the arguments provided by Eclipse
application itself

The above mentioned problem is not with the exit code 23. The reason is
that the eclipse launcher restarts itself in this case, hence eclipse.ini
is also reloaded. However eclipse launcher does not restart itself in case
of code 24 and parses the arguments provided by Eclipse application in
shared memory and simply relaunches java, which means that eclipse.ini will
not be reloaded.

For restarts, eclipse should be using code 23 but we had to switch to code
24 to fix following issue.
[[WorkbenchLauncher] Restart asks for the workspace to run](https://bugs.eclipse.org/bugs/show_bug.cgi?id=264072)
And then the fix of following built up on it.
[[Workspace chooser] "Older Workspace Version" dialog: "Cancel" button shouldn't close Eclipse but go back to workspace chooser](https://bugs.eclipse.org/bugs/show_bug.cgi?id=538830)

Fix:
====
For code 24, the arguments in shared memory are for launcher, so instead of
launcher just parsing the args and relaunching java, it should restart the
launcher with appropriate arguments. With relaunching the launcher,
eclipse.ini will be reloaded like its done for code 23.

Eclipse launcher is updated to relaunch for code 24 as well. Moreover,
there are 3 new launcher arguments introduced, 2 are internal to launcher
and one is external to launcher and can be set by eclipse application as a
relaunch argument.

- `--launcher.oldUserArgsStart` and `--launcher.oldUserArgsEnd`: The user
arguments passed to eclipse launcher for first start are tracked between
these arguments during relaunches. E.g., if eclipse was started as
`eclipse A B C` where A B C are some arguments to launcher and for
relaunch, Eclipse application mentioned `X Y Z` arguments then
relaunch command will be `eclipse --launcher.oldUserArgsStart A B C
--launcher.oldUserArgsEnd A B C X Y Z`. Moreover, launcher relaunch will
ignore all arguments between and including `--launcher.oldUserArgsStart`
and `--launcher.oldUserArgsEnd`.
- `--launcher.skipOldUserArgs`: If eclipse application wants to relaunch
with provided arguments only and ignore the older user args then it can
mention this argument. So for the case where eclipse was started as
`eclipse A B C` and Eclipse application mentioned `X Y Z` as relaunch
arguments along with `--launcher.skipOldUserArgs` then relaunch command
will be
`eclipse --launcher.oldUserArgsStart A B C --launcher.oldUserArgsEnd X Y Z`
where launcher relaunch will ignore all arguments between and including
`--launcher.oldUserArgsStart` and `--launcher.oldUserArgsEnd`.

For restarts, Eclipse application just mentions the `-data` argument now
as relaunch arguments instead of mentioning complete java args. However,
user can still mention more arguments for relaunch and Eclipse restart will
respect them as well and append the `-data` argument at the end of user
arguments.
@umairsair umairsair force-pushed the eclipse-equinox-p2-issues-166 branch from 91c3470 to 8bf9be0 Compare January 29, 2024 12:46
@sravanlakkimsetti sravanlakkimsetti merged commit be51d14 into eclipse-platform:master Jan 29, 2024
13 of 14 checks passed
umairsair added a commit to umairsair/eclipse.platform.ui that referenced this pull request Feb 4, 2024
- In development mode, changing restart parameters is not allowed, hence exit code 24 is not supported. Previously Workbench.buildCommandLine(..) used to return null for development mode, hence exit code was not set by Workbench.restart(..). And IDEApplication.start(..) used to take care of restarting development mode eclipse with exit code 23.
- Now in eclipse-platform#1307, Workbench.buildCommandLine(..) does not check for development mode, hence Workbench.restart(..) is setting return code 24.

Fix:
====
Similar to Workbench.setRestartArguments(..), Workbench.restart(..) also checks for development mode and explicitly sets the exit code 23
umairsair added a commit to umairsair/eclipse.platform.ui that referenced this pull request Feb 4, 2024
- In development mode, changing restart parameters is not allowed, hence exit code 24 is not supported. Previously Workbench.buildCommandLine(..) used to return null for development mode, hence exit code was not set by Workbench.restart(..). And IDEApplication.start(..) used to take care of restarting development mode eclipse with exit code 23.
- Now in [PR#1307](eclipse-platform#1307), Workbench.buildCommandLine(..) does not check for development mode, hence Workbench.restart(..) is setting return code 24.

Fix:
====
Similar to Workbench.setRestartArguments(..), Workbench.restart(..) also checks for development mode and explicitly sets the exit code 23
umairsair added a commit to umairsair/eclipse.platform.ui that referenced this pull request Feb 4, 2024
- In development mode, changing restart parameters is not allowed, hence exit code 24 is not supported. Previously Workbench.buildCommandLine(..) used to return null for development mode, hence exit code was not set by Workbench.restart(..). And IDEApplication.start(..) used to take care of restarting development mode eclipse with exit code 23.
- Now in [PR#1307](eclipse-platform#1307), Workbench.buildCommandLine(..) does not check for development mode, hence Workbench.restart(..) is setting return code 24.

Fix:
====
Similar to Workbench.setRestartArguments(..), Workbench.restart(..) also checks for development mode and explicitly sets the exit code 23
merks pushed a commit that referenced this pull request Feb 4, 2024
- In development mode, changing restart parameters is not allowed, hence exit code 24 is not supported. Previously Workbench.buildCommandLine(..) used to return null for development mode, hence exit code was not set by Workbench.restart(..). And IDEApplication.start(..) used to take care of restarting development mode eclipse with exit code 23.
- Now in [PR#1307](#1307), Workbench.buildCommandLine(..) does not check for development mode, hence Workbench.restart(..) is setting return code 24.

Fix:
====
Similar to Workbench.setRestartArguments(..), Workbench.restart(..) also checks for development mode and explicitly sets the exit code 23
amartya4256 pushed a commit to amartya4256/eclipse.platform.ui that referenced this pull request Feb 8, 2024
- In development mode, changing restart parameters is not allowed, hence exit code 24 is not supported. Previously Workbench.buildCommandLine(..) used to return null for development mode, hence exit code was not set by Workbench.restart(..). And IDEApplication.start(..) used to take care of restarting development mode eclipse with exit code 23.
- Now in [PR#1307](eclipse-platform#1307), Workbench.buildCommandLine(..) does not check for development mode, hence Workbench.restart(..) is setting return code 24.

Fix:
====
Similar to Workbench.setRestartArguments(..), Workbench.restart(..) also checks for development mode and explicitly sets the exit code 23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restarting workspace after feature installation does not take into account changes to eclipse.ini
2 participants