This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
There was a lot of request to solve the problem specific tailoring of the product for certain operation systems' specifics (recently for example issue 46808 or issue 46807, more historically the ide/applemenu module, J2ME emulators, etc.). In my opinion it makes sence to invest a bit of time and try to solve it in a bit more systematic way instead of neverending hacking.
The solution I have in mind is inspired by the way RPM would handle dependencies (any dependency on specific OS is like dependency on a specific library/token). So module that would like to restrict itself to be executed on a specific OS could use OpenIDE-Module-Requires: blablabla to request the OS. The list of OSes does not need to be big, we have explicit requrest for MacOSX right now, but it can surely grow in a future as we get new requirements.
Created attachment 16611 [details] Support for dependencies on MacOSX, Unix and Windows
My patch defines new API - three tokens that other modules can depend on and thus restrict its enablement only to certain platforms. The code may not be nicest (attaches the OS token to org.openide), but I tried to separate it to NbInstaller, so it does not influence the generic module system and also it can be rewritten any time still keeping those three new tokens working. I guess this solution should work well with autoupdate (e.g. not offer applemenu for download or at least warn when it is selected) but I have not tested that. Now I am waiting for Jesse to review it.
Created attachment 16615 [details] Improved patch that works on MacOSX as well (actually it is also Unix so it has both tokens)
Patch looks fine to me, except for new ArrayList() should be new ArrayList(2), and it would be nice to have a unit test. Might need to separately patch autoupdate in order to get that to work. Not sure if it will pick up the "live" Module for org.openide w/ the adjusted provides list. Maybe.
Created attachment 16623 [details] Unit test was in the original diff, I messed the second one on mac. Here is a complete version.
Looks fine.
Of course need patch to openide/api/doc/org/openide/modules/doc-files/api.html at some point as well, and also openide/api/doc/changes/apichanges.xml at time of integration.
I think the review has not brought any problems, I am ready to integrate this, I'll apply the latest diff and update API changes and the documentation as Jesse pointed out.
Hey, guys isn't it too late for D? Even if we do this for D, who would be the users of the new API in D timeframe?
Thanks for rising your objection. I agree, that this is not the best time for enhancements, but I've been under the impression that there is a pressing need to support mac os and support it well, so I justified the fix for myself. The problem is longstanding, we were just unwilling to address it during more sooner phases of the promoD, it is summarized as: "be able to enable a module only on a specific class of OS". We desperatelly need such functionality - we've encountered this when writing the ide/applemenu module, Dafe would use it for fixing different shortcuts between Unix and Windows, mobility might do that for their emulators and now issue 46811 needs similar functionality for Mac. If the patch is integrated, there will be an immediate user benefit - applemenu will be completely disabled on all other platforms than Mac. Another consumer of the patch is issue 46881, which Tim seems to be willing to integrate for promoD. Those would be the two consumers of this API for promoD. If this is not convicing enough, feel free to change the target milestone (probably to promoE). I'd like to emphatize that without this issue Tim can hardly solve issue 46881 without bunch of hacks - to prevent that, I am ready to suffer the maintainance problems related to this enhancement (which I do not expect any).
Agreed that this RFE is sensible in general and the best solution I can see for Mac support in the D timeframe - decent Mac KB support needs *some* kind of infrastructure change in order to work, and this is most straightforward and apparent. The patch itself is quite simple. One other thing: I would request that ModuleInstaller.refineProvides get a @since tag and that core/manifest.mf have its spec version increased. Generally I try to track API changes in the module subsystem.
cvs ci -m "#46833: Allow a module to be run only on some class of operating systems" Checking in core/manifest.mf; /cvs/core/manifest.mf,v <-- manifest.mf new revision: 1.38; previous revision: 1.37 done Processing log script arguments... More commits to come... Checking in core/src/org/netbeans/core/modules/Module.java; /cvs/core/src/org/netbeans/core/modules/Module.java,v <-- Module.java new revision: 1.55; previous revision: 1.54 done Checking in core/src/org/netbeans/core/modules/ModuleInstaller.java; /cvs/core/src/org/netbeans/core/modules/ModuleInstaller.java,v <-- ModuleInstaller.java new revision: 1.10; previous revision: 1.9 done Checking in core/src/org/netbeans/core/modules/ModuleManager.java; /cvs/core/src/org/netbeans/core/modules/ModuleManager.java,v <-- ModuleManager.java new revision: 1.63; previous revision: 1.62 done Checking in core/src/org/netbeans/core/modules/NbInstaller.java; /cvs/core/src/org/netbeans/core/modules/NbInstaller.java,v <-- NbInstaller.java new revision: 1.77; previous revision: 1.76 done Processing log script arguments... More commits to come... RCS file: /cvs/core/test/unit/src/org/netbeans/core/modules/PlatformDependencySatisfiedTest.java,v done Checking in core/test/unit/src/org/netbeans/core/modules/PlatformDependencySatisfiedTest.java; /cvs/core/test/unit/src/org/netbeans/core/modules/PlatformDependencySatisfiedTest.java,v <-- PlatformDependencySatisfiedTest.java initial revision: 1.1 done Processing log script arguments... More commits to come... Checking in ide/applemenu/manifest.mf; /cvs/ide/applemenu/manifest.mf,v <-- manifest.mf new revision: 1.2; previous revision: 1.1 done Processing log script arguments... More commits to come... Checking in ide/applemenu/nbproject/project.properties; /cvs/ide/applemenu/nbproject/project.properties,v <-- project.properties new revision: 1.2; previous revision: 1.1 done Processing log script arguments... More commits to come... Checking in openide/openide-spec-vers.properties; /cvs/openide/openide-spec-vers.properties,v <-- openide-spec-vers.properties new revision: 1.154; previous revision: 1.153 done Processing log script arguments... More commits to come... Checking in openide/api/doc/changes/apichanges.xml; /cvs/openide/api/doc/changes/apichanges.xml,v <-- apichanges.xml new revision: 1.214; previous revision: 1.213 done Processing log script arguments... More commits to come... Checking in openide/api/doc/org/openide/modules/doc-files/api.html; /cvs/openide/api/doc/org/openide/modules/doc-files/api.html,v <-- api.html new revision: 1.96; previous revision: 1.95 done