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

Add --launcher.noRestart option to launcher. #595

Merged

Conversation

dhendriks
Copy link
Contributor

This adds a -norestart option to the launcher. When the option is used, it suppresses the restart behavior of exit codes 23 and 24, such that an IApplication can return all exit codes if the restart behavior is not desired.

The diff looks more complicated than it needs to. In eclipse.c, the changes to the switch statement only involve an extra if around the body of two cases, with a comment at the end to explain the fall-through. The bodies of these two new if statements contain the original unmodified original code of the cases, indented one extra level.

See also the discussion at #378.

merks
merks previously requested changes Apr 18, 2024
Copy link
Contributor

@merks merks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder how many of these places where I see -nosplash that need some attention for this new argument?

image

Copy link

github-actions bot commented Apr 18, 2024

Test Results

  660 files  ± 0    660 suites  ±0   1h 15m 36s ⏱️ + 4m 37s
2 201 tests + 6  2 154 ✅ + 6   47 💤 ±0  0 ❌ ±0 
6 747 runs  +18  6 604 ✅ +18  143 💤 ±0  0 ❌ ±0 

Results for commit 14076d9. ± Comparison against base commit 95971b5.

♻️ This comment has been updated with latest results.

@merks
Copy link
Contributor

merks commented Apr 18, 2024

@HannesWell

Does this look okay to you? Will anything special need to be done to actually build new launchers or will that "just work" given all your build improvements?

@tjwatson

Do you think something with deeper knowledge about the launcher needs to review this. It appears okay to me...

@HannesWell HannesWell force-pushed the add-norestart-option-to-launcher branch from 2de24d4 to fb4f95e Compare April 18, 2024 21:18
@HannesWell
Copy link
Member

Will anything special need to be done to actually build new launchers or will that "just work" given all your build improvements?

The GitHub workflows already pick up the change and build and test the new code.
I'm currently working on #575 and hope to complete this within the next one or two weeks. Actually this would be a nice first real-world use and test case.
So unless it is urgent, it would be great if we could await the completion of #575 before submitting this which would also avoid the need to subsequently trigger the launcher build manually.

Does this look okay to you?

I'm not very familiar with the code itself, but what I see looks sane to me.

@dhendriks it would be great if you could add a test-case to the existing equinox.launcher.tests. @umairsair could you give some advice how to test this best?

@umairsair
Copy link
Contributor

@umairsair could you give some advice how to test this best?

I think following three tests should be added.. I haven't run the tests though..

	@Test
	void test_appTerminatesWithNoRestartAndEXIT_OK() throws IOException, InterruptedException {
		test_norestart(EXIT_OK);
	}
	
	@Test
	void test_appTerminatesWithNoRestartAndEXIT_RESTART() throws IOException, InterruptedException {
		test_norestart(EXIT_RESTART);
	}
	
	@Test
	void test_appTerminatesWithNoRestartAndEXIT_RELAUNCH() throws IOException, InterruptedException {
		test_norestart(EXIT_RELAUNCH);
	}

	private void test_norestart(int exitCode) throws IOException, InterruptedException {
		writeEclipseIni(DEFAULT_ECLIPSE_INI_CONTENT);

		Process launcherProcess = startEclipseLauncher(List.of("-norestart"));

		Socket socket = server.accept();

		List<String> appArgs = new ArrayList<>();
		analyzeLaunchedTestApp(socket, appArgs, null, exitCode);

		// Make sure -norestart arg is picked
		assertTrue(appArgs.contains("-norestart"));
		// Make sure launcher exited with expected exit value
		launcherProcess.waitFor(5, TimeUnit.SECONDS);
		assertEquals(exitCode, launcherProcess.exitValue());
		try {
			server.accept();
			fail("New eclipse started even with -norestart arg and exit code " + exitCode):
		} catch (SocketTimeoutException e) {
			// No new instance launched
			return;
		}
	}

@dhendriks
Copy link
Contributor Author

@umairsair could you give some advice how to test this best?

I think following three tests should be added.. I haven't run the tests though..

I added the tests. Let's see if they run OK.

@dhendriks
Copy link
Contributor Author

I'm currently working on #575 and hope to complete this within the next one or two weeks. Actually this would be a nice first real-world use and test case.
So unless it is urgent, it would be great if we could await the completion of #575 before submitting this which would also avoid the need to subsequently trigger the launcher build manually.

Let's try to get this in a good shape to be merged now already. For me it is OK to then merge in a few weeks.

@umairsair
Copy link
Contributor

so we are not passing -norestart as parameter to java application, see getVMCommand(..), thats why following assertion is failing..

assertTrue(appArgs.contains("-norestart"));

IMO we should pass it to application so that if java application wants to make any decision based on -norestart arg..

@laeubi
Copy link
Member

laeubi commented Apr 20, 2024

IMO we should pass it to application so that if java application wants to make any decision based on -norestart arg..

I just wanted to note that one should not confuse JVM argument, Application Arguments and launcher/runtime Arguments.

If you look here then launcher / runtime arguments are usually mapped as java system properties and not passed directly to the invoked application!

@laeubi laeubi requested a review from tjwatson April 20, 2024 07:45
@dhendriks
Copy link
Contributor Author

So, -norestart is a launcher argument, I assume? Then somewhere in eclipse.c I need to add a -Dlauncher.noRestart=true or so? I tried looking for examples of where this is done already, but didn't find any. Could you point me in the right direction?

@umairsair
Copy link
Contributor

see following for reference

(*progArgv)[ dst++ ] = appendVmargs ? APPEND_VMARGS : OVERRIDE_VMARGS;

you can add following code after above line..

if (noRestart)
    (*progArgv)[ dst++ ] = "--launcher.noRestart";

you can create define for --launcher.noRestart in eclipseCommon.h and update the tests accordingly to check for --launcher.noRestart

@dhendriks
Copy link
Contributor Author

see following for reference
[...]
you can create define for --launcher.noRestart in eclipseCommon.h and update the tests accordingly to check for --launcher.noRestart

I added it all:

  • Not sure what the define in eclipseCommon.h is for, as it doesn't seem to be used then.
  • When updating eclipse.c, I found it difficult to link the argument comment to the argument size computation, so I made them more alike. I also updated the argument description, as it didn't fully match the code (also making it more difficult to keep it in sync).
  • I updated the test. Let's see if it succeeds now.

@dhendriks
Copy link
Contributor Author

@umairsair I implemented it as you indicated. But the tests fail. Partial stack trace:

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:183)
	at org.eclipse.equinox.launcher.tests.LauncherTests.test_norestart(LauncherTests.java:234)
	at org.eclipse.equinox.launcher.tests.LauncherTests.test_appTerminatesWithNoRestartAndEXIT_RESTART(LauncherTests.java:215)

Stdout:

--- start ----
-os
linux
-ws
gtk
-arch
x86_64
-showsplash
-launcher
/tmp/junit15564327931400162296/eclipse/eclipse
-name
Eclipse
--launcher.library
/tmp/junit15564327931400162296/eclipse//plugins/org.eclipse.equinox.launcher/eclipse_11900.so
-startup
/tmp/junit15564327931400162296/eclipse//test.launcher.jar
--launcher.overrideVmargs
-exitdata
4
-norestart
-vm
/opt/tools/java/temurin/jdk-17/latest/bin/java
-vmargs
-Xms40m
-jar
/tmp/junit15564327931400162296/eclipse//test.launcher.jar
--- end ----

It seems -norestart is present, while --launcher.noRestart is not. Do you know what is going on?

@umairsair
Copy link
Contributor

Probably some local setup issue.

I see that tests are not executed for latest commit and requires approval. @merks , @HannesWell can you please approve the run so that we can analyze the latest test results?

@dhendriks
Copy link
Contributor Author

All 3 tests fail, like this:

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:183)
	at org.eclipse.equinox.launcher.tests.LauncherTests.test_norestart(LauncherTests.java:234)
	at org.eclipse.equinox.launcher.tests.LauncherTests.test_appTerminatesWithNoRestartAndEXIT_OK(LauncherTests.java:210)

So, on the assertion:

assertTrue(appArgs.contains("--launcher.noRestart"));

I looked at the code, and the changes I did previously. I have to clue what to do next. Did I not change it correctly, to pass that argument on from the launcher to the application?

@umairsair
Copy link
Contributor

last run tells that tests on windows are unstable but failing on linux.. on windows, I hope the suggestion I made above will solve it.. for linux, launcher is not exiting.. that needs to be checked..

https://github.com/eclipse-equinox/equinox/pull/595/checks?check_run_id=24349592476

also macos build is failing..

https://github.com/eclipse-equinox/equinox/actions/runs/8833610849/job/24349296333?pr=595

memcpy(relaunchCommand, initialArgv, (initialArgc + 1) * sizeof(_TCHAR*));
relaunchCommand[initialArgc] = 0;
relaunchCommand[0] = program;
break;
Copy link
Contributor

@umairsair umairsair May 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the break of case statement should still be outside of if condition, right? otherwise any data put in exitData buffer by the application will be considered error message in default case..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The essence is:

		case RESTART_LAST_EC:
			if (!noRestart) {
                                ...
				break;
			} // else: fall-through to 'default' case.
		case RESTART_NEW_EC:
			if (!noRestart) {
                                ...
				break;
			} // else: fall-through to 'default' case.
		default: {
			...

If the exit code is a restart exit code, then if we allow restart (we do not disallow restarting), we do something special (whatever was there already before) and then break. But, if restart is disabled, we instead fall through to the default case, and handle it like any other non-zero exit code.

So, that part still looks good to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise any data put in exitData buffer by the application will be considered error message in default case..

Did you consider this?

Copy link
Contributor

@umairsair umairsair May 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this is infact the reason of tests failure..

test app sets exit data here in case user selects restart from within application.

bridge.setExitData(sharedId, String.join("\n", exitData) + "\n");

and in launcher, as -norestart is mentioned and default is executed, this exitData is shown as error..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to only skip the RESTART_* cases, but I think you're saying also exitData may contain something related to restart behavior? I'm really not sure what that variable is about, at all.

eclipse.c has more than 2000 lines. I have to say there is a lot of stuff going on there, and I don't know what half of it means. It is complicated.

Can the default case really be skipped fully? It seems to handle reporting various errors. For instance, the errorMsg == NULL seems relevant, as it reports problems launching Java? Are you sure we can safely skip all of that? I don't want it to print anything in case of a non-zero exit code, but it should probably still report issues for failing to launch Java to begin with.

Should we do if (exitData != NULL) free(exitData); before falling through? And what is getSharedData about? That can also set exitData again?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've retriggered the build

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to recursively adapt 4 more features. I hope that is all the versions that need updating. Needs another build approval.

Copy link
Contributor Author

@dhendriks dhendriks Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand it correctly, the new tests pass. There is one test that fails: testCoordinatedConfigurationOnBeforeRegisteredManagedService (org.osgi.test.cases.cm.junit.CMCoordinationTestCase) failed. Not sure what that is, or where it comes from, and whether that is even related to the changes I made? Also, 2/23 checks were aborted. I also have no idea why that is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CMCoordinationTestCase failed test also fails in #640 that @HannesWell refers to in a different thread of this PR. I don't think that failure is related to my changes.

I still don't know what caused the 2 other checks to be aborted. Their output doesn't help me much. Although, I see they were 'aborted'; they didn't 'fail'. I also in Eclipse ESCET recently got timeout aborts due to the Jenkins cluster being slower than usual, and I had to increase the timeout there. Could that be the reason here as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not yet read to this entire thread, but my first impression when looking into the change itself is that in case a no-restart is present the code should fall through to the default branch and tread the exit code as error (which it in fact is, isn't it)?

By default the executable pops-up a native error dialog if the app exited with an error code.
Could the test-failure with a fall-through to default be because of that? Because at the server such pop-up is closed by nobody.
Maybe the test would be more correct if you use from the Eclipse runtime options

--launcher.suppressErrors (Executable)
    If specified the executable will not display any error or message dialogs.  This is useful if the executable is being used in an unattended situation.

Then the error code is just returned by the command and could be checked in the invoking java test code?

@dhendriks
Copy link
Contributor Author

macOS build is indeed failing. But it indicates:

Set up JDK 17
Run actions/setup-java@v4
Installed distributions
Trying to resolve the latest version from remote
Error: Could not find satisfied version for SemVer '8'.
Available versions: 22.0.1+8, 22.0.0+36, 21.0.3+9.0.LTS, 21.0.2+13.0.LTS, 21.0.1+12.0.LTS, 21.0.0+35.0.LTS, 20.0.2+9, 20.0.1+9, 20.0.0+36, 19.0.2+7, 19.0.1+10, 19.0.0+36, 18.0.2+101, 18.0.2+9, 18.0.1+10, 18.0.0+36, 17.0.11+9, 17.0.10+7, 17.0.9+9, 17.0.8+101, 17.0.8+7, 17.0.7+7, 17.0.6+10, 17.0.5+8, 17.0.4+101, 17.0.4+8, 17.0.3+7, 17.0.2+8, 17.0.1+12, 17.0.0+35, 11.0.23+9, 11.0.22+7.1, 11.0.22+7, 11.0.21+9, 11.0.20+101, 11.0.20+8, 11.0.19+7, 11.0.18+10, 11.0.17+8, 11.0.16+101, 11.0.16+8, 11.0.15+10

This seems to be a setup thing even before any code from the repo is used, so I doubt it is because of anything I changed.

@dhendriks
Copy link
Contributor Author

dhendriks commented May 11, 2024

For Linux: There appear to be two runs for each test. Not sure why. The first ones fail like on Windows. The 2nd ones indeed because process hasn't exited. Hopefully this is also fixed by your proposed change (which I applied).

@dhendriks
Copy link
Contributor Author

@merks / @HannesWell: Can you please approve the new build/test runs?

@dhendriks
Copy link
Contributor Author

The org.opentest4j.AssertionFailedError: expected: <true> but was: <false> issues have been resolved. Tests were run for all three platforms now. The test_appTerminatesWithNoRestartAndEXIT_OK test now succeeds. The test_appTerminatesWithNoRestartAndEXIT_RESTART and test_appTerminatesWithNoRestartAndEXIT_RELAUNCH tests both fail with the following error on all three platforms:

process has not exited
java.lang.IllegalThreadStateException: process has not exited
	at java.base/java.lang.ProcessImpl.exitValue(ProcessImpl.java:560)
	at org.eclipse.equinox.launcher.tests.LauncherTests.test_norestart(LauncherTests.java:238)

I have no clue how to debug what is going wrong, and why the process does not terminate.

@HannesWell HannesWell force-pushed the add-norestart-option-to-launcher branch from 1551906 to 2ef1133 Compare May 12, 2024 18:09
@HannesWell
Copy link
Member

Just as a quick note: all the launcher binaries are now build in the Jenkins pipeline if anything changed.
Therefore please rebase your future adjustments on the master.
Also please squash all your commits into one with a message that covers the total change (there is no need to record the development loops in git)

I'm not very familiar with the code itself, but I can try to have a look at this tomorrow.

@dhendriks dhendriks force-pushed the add-norestart-option-to-launcher branch 4 times, most recently from 56196e4 to 5071f51 Compare June 10, 2024 12:44
Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhendriks sorry for the delay.
I have not found any definitive documentation/guide-line how to name the arguments, but since the argument to add is definitively only handled by the launcher.
Therefore I would be in favor of naming the flag --launcher.noRestart, which is similar to for example --launcher.suppressErrors.
I have made a few comments below what I think needs to be changed.

Can you please try if that works, i.e. apply the changes and see the results in the CI? If it works I think this can be submitted.

If I understand the current implementation correct we have a -noRestart argument that controls the launcher behavior but only the presence of --launcher.noRestart is passed to the Eclipse application?

@HannesWell HannesWell force-pushed the add-norestart-option-to-launcher branch from e6a2a2a to 563232f Compare July 17, 2024 18:36
@dhendriks
Copy link
Contributor Author

@dhendriks sorry for the delay. I have not found any definitive documentation/guide-line how to name the arguments, but since the argument to add is definitively only handled by the launcher. Therefore I would be in favor of naming the flag --launcher.noRestart, which is similar to for example --launcher.suppressErrors. I have made a few comments below what I think needs to be changed.

Can you please try if that works, i.e. apply the changes and see the results in the CI? If it works I think this can be submitted.

If I understand the current implementation correct we have a -noRestart argument that controls the launcher behavior but only the presence of --launcher.noRestart is passed to the Eclipse application?

The way I understood it, is: There are options for the launcher. They are use short names. When passed on to the application, they get the longer form to indicate it is an option from the launcher, as an application also has options of itself.
Hence, in my version, the launcher got a -norestart and the Eclipse application got --launcher.noRestart.
There are separate lists in eclipseCommon.h for this very reason, I thought.
But, it was already not consistently applied, so I may be misinterpreting the naming idea: I checked the defined constants, and the ones that are options of the launcher have a one space indentation:

 #define CONSOLE            _T_ECLIPSE("-console")
 #define CONSOLELOG         _T_ECLIPSE("-consoleLog")
 #define DEBUG_ARG          _T_ECLIPSE("-debug") // Post-fixing with _ARG. Otherwise it causes failure in macOS build
 #define OS                 _T_ECLIPSE("-os")
 #define OSARCH             _T_ECLIPSE("-arch")
 #define NOSPLASH           _T_ECLIPSE("-nosplash")
 #define NORESTART          _T_ECLIPSE("-norestart")
#define LAUNCHER           _T_ECLIPSE("-launcher")
 #define SHOWSPLASH         _T_ECLIPSE("-showsplash")
#define EXITDATA           _T_ECLIPSE("-exitdata")
 #define STARTUP            _T_ECLIPSE("-startup")
 #define VM                 _T_ECLIPSE("-vm")
 #define WS                 _T_ECLIPSE("-ws")
 #define NAME               _T_ECLIPSE("-name")
#define VMARGS             _T_ECLIPSE("-vmargs")  /* special option processing required */
#define CP                 _T_ECLIPSE("-cp")
#define CLASSPATH          _T_ECLIPSE("-classpath")
#define JAR                _T_ECLIPSE("-jar")
 #define PROTECT            _T_ECLIPSE("-protect")
#define ROOT               _T_ECLIPSE("root")  /* the only level of protection we care now */

 #define OPENFILE           _T_ECLIPSE("--launcher.openFile")
 #define DEFAULTACTION      _T_ECLIPSE("--launcher.defaultAction")
 #define TIMEOUT            _T_ECLIPSE("--launcher.timeout")
 #define LIBRARY            _T_ECLIPSE("--launcher.library")
 #define SUPRESSERRORS      _T_ECLIPSE("--launcher.suppressErrors")
 #define INI                _T_ECLIPSE("--launcher.ini")
 #define APPEND_VMARGS      _T_ECLIPSE("--launcher.appendVmargs")
 #define OVERRIDE_VMARGS    _T_ECLIPSE("--launcher.overrideVmargs")
#define LAUNCHER_NORESTART _T_ECLIPSE("--launcher.noRestart")
 #define SECOND_THREAD      _T_ECLIPSE("--launcher.secondThread")
 #define PERM_GEN           _T_ECLIPSE("--launcher.XXMaxPermSize")
#define OLD_ARGS_START     _T_ECLIPSE("--launcher.oldUserArgsStart")
#define OLD_ARGS_END       _T_ECLIPSE("--launcher.oldUserArgsEnd")
#define SKIP_OLD_ARGS      _T_ECLIPSE("--launcher.skipOldUserArgs")

#define XXPERMGEN          _T_ECLIPSE("-XX:MaxPermSize=")
#define ADDMODULES         _T_ECLIPSE("--add-modules")
#define ACTION_OPENFILE    _T_ECLIPSE("openFile")
 #define GTK_VERSION        _T_ECLIPSE("--launcher.GTK_version")

It gets things from multiple lists, and none of the lists is completely present. So, I guess I also don't get the naming convention.

Your proposal does look weird though, as in eclipse.c there is a list of options for the command line help text, and none of them have --launcher.xxx syntax...
Are you sure the names you proposed are a good idea? I personally find the current names more logical.

I have made a few comments below what I think needs to be changed.

That is incomplete, as it does not account for JavaDocs, tests, etc. I can make the necessary changes, but I'm not sure we should, since I don't see the logic of the new names you propose just yet.

- Fixed comment to match implementation.
- Align comment/count lines to make it easier to keep them consistent.
- Fixed source code indentation
@HannesWell HannesWell force-pushed the add-norestart-option-to-launcher branch 3 times, most recently from 3334340 to 6db9c3c Compare July 21, 2024 21:48
@HannesWell
Copy link
Member

Thank you for your detailed answer, I have checked also the surrounding code in more detail.

The way I understood it, is: There are options for the launcher. They are use short names. When passed on to the application, they get the longer form to indicate it is an option from the launcher, as an application also has options of itself. Hence, in my version, the launcher got a -norestart and the Eclipse application got --launcher.noRestart. There are separate lists in eclipseCommon.h for this very reason, I thought.

While it is correct that there are options that are only processed by the launcher (and not passed to the application) and options that are only passed to the application (and not processed by the launcher), I didn't find an option that is processed by the launcher and then passed to the app under a different name (maybe there are options that imply other options?). And I would also find it confusing as a user if I specify some option -A on the CLI and get another option -B passed into my application.
I think it should really be the same name. Which name that is, is something that can be discussed.

Your proposal does look weird though, as in eclipse.c there is a list of options for the command line help text, and none of them have --launcher.xxx syntax... Are you sure the names you proposed are a good idea? I personally find the current names more logical.

The reasons I find --launcher.norestart more suitable is that is it similar to --launcher.suppressErrors and since both affect a similar area (i.e. the handling of exit codes) I think they should follow the same naming schema. Furthermore the norestart flag is actually just processed by the launcher. It is just passed to the application for informational purpose and that we can disable the restart button.
It is similar to the --launcher.library argument, which is also passed through respectively the -launcher argument (even though that doesn't have the --launcher.X prefix again).
And because I assume that that the norestart flag is used very often I also don't think it is very important to make it short.

Why do you prefer just -norestart?

The doc gives the full list of supported options:
https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html
The sources for it are in:
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/3bd05fbd8610fa57766a0399b59ac256e5f50424/eclipse.platform.common/bundles/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html#L114-L117

Eventually we should update that as well.

There are separate lists in eclipseCommon.h for this very reason, I thought.
But, it was already not consistently applied,

Yes it looks like that. For example I cannot find a any definition nor a usage of the -library argument, although it is listed in the Eclipse program launcher argument list in the beginning of eclipse.c. Therefore I have the impression that list is outdated already and since it is only in this c file, I assume it is not 'normative' in any way.

I have made a few comments below what I think needs to be changed.

That is incomplete, as it does not account for JavaDocs, tests, etc.

That's right. I have adapted to and it should succeed now (at least my local tests after a local rebuild did). I hope I didn't forget something.

@dhendriks dhendriks force-pushed the add-norestart-option-to-launcher branch from 6db9c3c to 5c79e82 Compare July 22, 2024 14:37
@dhendriks
Copy link
Contributor Author

I changed --launcher.norestart disables the restart behavior of exit codes 23 and 24. to --launcher.noRestart disables the restart behavior of exit codes 23 and 24., capitalizing the R of noRestart. With that, it is now consistently --launcher.noRestart.

@dhendriks dhendriks changed the title Add -norestart option to launcher. Add --launcher.noRestart option to launcher. Jul 22, 2024
@dhendriks
Copy link
Contributor Author

I updated the merge request title to account for now having --launcher.noRestart, rather than -norestart.

@dhendriks
Copy link
Contributor Author

I think it should really be the same name. Which name that is, is something that can be discussed.

Alright. Lets go with only --launcher.noRestart then.

@HannesWell Probably another build needs to be approved. If that succeeds, can we merge this?

@HannesWell HannesWell force-pushed the add-norestart-option-to-launcher branch from 5c79e82 to 14076d9 Compare July 22, 2024 19:11
Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should really be the same name. Which name that is, is something that can be discussed.

Alright. Lets go with only --launcher.noRestart then.

Great.

I changed --launcher.norestart disables the restart behavior of exit codes 23 and 24. to --launcher.noRestart disables the restart behavior of exit codes 23 and 24., capitalizing the R of noRestart. With that, it is now consistently --launcher.noRestart.

Yes, that makes sense. Thanks.
I have now squashed the commit that applies the suggestions from code review into your last commit and also adapted the commit message to the new name.

@HannesWell Probably another build needs to be approved. If that succeeds, can we merge this?

Yes, absolutely. I'm fine with this now and I assume we won't get more reviews from other committers, but I think it's a sane enhancements now.

Thanks for this enhancement and your patience. Also thanks to @umairsair for your help!

@HannesWell HannesWell merged commit 42978e3 into eclipse-equinox:master Jul 22, 2024
20 of 24 checks passed
@dhendriks
Copy link
Contributor Author

Thanks for this enhancement and your patience. Also thanks to @umairsair for your help!

Indeed, thanks @umairsair. And thanks to you as well, @HannesWell. And to the others that participated/helped.

@dhendriks
Copy link
Contributor Author

@dhendriks would you be so kind and also provide a PR to add documentation for this new flag [...]

I created a pull request for it: eclipse-platform/eclipse.platform.releng.aggregator#2195

@merks
Copy link
Contributor

merks commented Jul 23, 2024

@dhendriks

Thanks for your persistence and patience! 🏆

@dhendriks
Copy link
Contributor Author

I was looking at how to pick up the option in the IDE, and I'm not sure passing it as an argument is the right way to go. I can't figure out how to get them. Maybe it should be passed as a property, as @laeubi suggested?

@HannesWell What do you think?

@dhendriks
Copy link
Contributor Author

Ah, they seem to already be available, as Java property eclipse.commands. I can use that.

@dhendriks
Copy link
Contributor Author

I've created a PR for the workbench restart not being available. See eclipse-platform/eclipse.platform.ui#2125.

HannesWell pushed a commit to dhendriks/eclipse.platform.releng.aggregator that referenced this pull request Jul 24, 2024
HannesWell pushed a commit to eclipse-platform/eclipse.platform.releng.aggregator that referenced this pull request Jul 24, 2024
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.

6 participants