-
Notifications
You must be signed in to change notification settings - Fork 115
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 methods to identify the current OS to the class Platform #704
Add methods to identify the current OS to the class Platform #704
Conversation
Is there intention for these to be used outside of the tests too? |
dd6a150
to
2c674f9
Compare
I haven't changed any other existing calls of the type
Good point, I missed those ones. I took your suggestion and replaced the methods with a single method called |
2c674f9
to
9994f32
Compare
I think
so one can then handle the case that |
This could have unintentional effects if an older version of Windows supports different features than a newer version e.g. here: Lines 43 to 44 in 5a3244b
I'd rather keep the API "low level" in this case and -if necessary- provide another method that checks for the OS-"family" in a different PR. What do you think? |
I agree that there should only be one general
|
I just wanted to mention the following:
If we now replace the one generic one with the next generic one that only differs a very tiny bit in the call structure |
I see your points. From my point of view, the problem with Still, I do not have a strong opinion on whether to have one or multiple methods. But in case of having one method for every OS, I would still suppose to not bloat up the |
At least it is the way if one need maximum flexibility
What should be kept in mind is that these constants are already not any raw values, these are already processed (see for example here https://docs.osgi.org/reference/osnames.html for a list of "real" os and their alias) int o a somewhat normalized form, so usually the variants are handled at another place
I'm not sure if "API design" really applies to this kind of code as we don't will have any competing implementations nor is this a general purpose data carrier or alike the main advantage for me is that one can use that as a boolean expression in lamda filter style methods like Also I'd like to mention that where this is used, we only use it in a very rough form, e.g. should a test run on windows or linux only, or should i try to use a DLL instead of a so file, it is not really meant as a fine grained feature switch that would more need something like is it an Redhat or Debian or Wayland versusx X11 or Windows XP 32 bit versus Windows 11 ARM and so on. Sadly especially for SWT there are sometimes some quirks where I use a similar check in user-code, also there I only need a very very rough categorization and really don't mind about any future OSes or ancient OSes that where supported 10 years ago ... |
So in sum:
The last point has no implications for this PR since there are no "related" values (constants) for the OSs at the moment, right? I left out the part about using What do you guys think? (👍 / 👎 ) |
@iloveeclipse which point would you like to change/scratch? |
In almost every test bundle we have some utility class with isWindows() isLinux() and is Mac(), so I don't understand the need for extra complicated constants, long method names etc. So basically what #704 (comment) says. |
In that case I humbly request some clarification from @laeubi about what he meant in #704 (comment) because I think I interpreted it completely differently: would you please list your proposals/wishes, @laeubi ? |
Would adding the following methods address all concerns?
|
But the rest would be OK. |
01d286d
to
0af08ad
Compare
Done in 0af08ad |
0af08ad
to
1e12096
Compare
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 me, changes would be fine as proposed now.
Test failures documented in #715 |
1e12096
to
3df3e0e
Compare
The pipeline error is unrelated, maybe a connection problem. [Pipeline] junit
Recording test results
No test report files were found. Configuration error?
Error when executing always post condition:
Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 10.40.62.179/10.40.62.179:46258
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1784)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel.call(Channel.java:1000)
at hudson.FilePath.act(FilePath.java:1192)
at hudson.FilePath.act(FilePath.java:1181)
at hudson.tasks.junit.JUnitParser.parseResult(JUnitParser.java:118)
at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:157)
at hudson.tasks.junit.JUnitResultArchiver.parseAndSummarize(JUnitResultArchiver.java:251)
at hudson.tasks.junit.pipeline.JUnitResultsStepExecution.run(JUnitResultsStepExecution.java:63)
at hudson.tasks.junit.pipeline.JUnitResultsStepExecution.run(JUnitResultsStepExecution.java:29)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:839)
hudson.AbortException: No test report files were found. Configuration error?
at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:184)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:377)
at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:125)
at java.base/java.lang.Thread.run(Thread.java:829) |
3df3e0e
to
64a6139
Compare
I case no one has objections to the current proposal, I propose to merge after the freeze period. |
Remove the 3 methods "isXYZ()" from org.eclipse.core.tests.resources.ResourceTest to stop fostering inheritance just to be able to reuse these methods. Contributes to eclipse-platform#448
64a6139
to
2136579
Compare
@laeubi Since you gave so much valuable input to improve the initial proposals, it would be great to have a short notice whether you see your concerns addressed and agree with the current proposal, so that we can merge. |
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.
Looks good.
(fulfill the changes requested in #446 (comment))
Move the methods
isLinux()
,isWindows()
andisMacOSX()
(renamed toisMac()
) to the new internal classorg.eclipse.core.runtime.Platform.OS
and add a new methodOS.is(String)
for legacy/flexibility purposes.Contributes to #448