Closed Phillipus closed 3 years ago
I'll leave this issue open for a while in case anyone wants to comment (please don't, I want to move on). And then it should be copied as a new entry in the wiki.
(And this, ladies and gentlemen, is why I spend countless days and weeks on just making sure Archi launches, never mind implementing your pet feature. Something like this means testing on three different versions of Mac, two configurations of Windows, and three configurations of Linux...)
I'll leave this issue open for a while in case anyone wants to comment (please don't, I want to move on). And then it should be copied as a new entry in the wiki.
I absolutely have to comment to make it clear that I have no comments ;-)
I personally have a comment about this:
I confirm @Phillipus and @jbsarrodie are doing a tremendous work and I would like to thanks you again guys 🥇
I also know of a hard working guy who has released a quantity of plug-ins that have provided enormous value to end users. Thanks to @herve91 as well! 😄
Created a wiki entry - https://github.com/archimatetool/archi/wiki/The-Archi.ini-file
Summary
This issue is to record why we have a
-cleanConfig
entry in theArchi.ini
file in Archi 4.8.1 and later.Why do this?
To stop Eclipse from caching stale file paths to Archi plug-ins and not loading them if the Archi app or the
dropins
location is moved or changed.Background
See #429
Technical Eclipse stuff
When an Eclipse based app launches it caches information about plug-ins (bundles) and jar files in the config area. This is the
osgi.configuration.area
location as set inArchi.ini
file.One such file that Eclipse creates at launch is:
.config/org.eclipse.equinox.simpleconfigurator/bundles.info
This stores the paths to all bundles.
Here's the entry for jArchi from that file on Mac:
com.archimatetool.script,1.1.0.202101121529,../../../../../Library/Application%20Support/Archi4/dropins/com.archimatetool.script_1.1.0.202101121529.jar,4,false
That file path is relative to Archi's intallation location. In this example, on Mac, Archi is installed on the Desktop.
The file locations in
bundles.info
can also be absolute if Archi and thedropins
folder are on different volumes/drives.What's the impact of this?
If I now move the Archi app to a new location (say from the Desktop to a sub-folder) and launch Archi, that file path in
bundles.info
no longer resolves and Archi's plug-ins in thedropins
folder are not loaded.Basically, if the location of Archi and/or the
dropins
location is moved the end user has a bad experience because their nice Archi plug-ins (jAchi, coArchi, Herve's plug-ins) no longer load and there's no message to say why.However, if we delete all of that cached info in
.config
it all works fine.I thought we had this covered?
Yes and no.
In earlier versions of Archi (4.8 and earlier) the
WorkbenchCleaner
class deletes thisbundles.info
file and other cached information from the.config
folder at startup. We also have an Eclipse-clean
entry inArchi.ini
to tell Eclipse to re-create theorg.eclipse.osgi
folder at startup. Eclipse is then forced to re-create this information each time when Archi is launched. This is slightly slower but safer for us.This kind of works, and the cached information is re-created on each launch.
But since then I've found that not all of these files are deleted at startup by our
WorkbenchCleaner
because of timing issues (Eclipse re-creates them after we have deleted them) and that the situation can get out of sync if Archi is launched more than once and if the-clean
option is set. I.e, it's not really safe.So how do we solve this?
We delete all of these
.config
files when Archi exits. This is safer and means that most of the files will not be in use or locked by Eclipse on exit.So from Archi 4.8.1 onward there is no longer a
-clean
option inArchi.ini
but a-cleanConfig
option. This flags to theWorkbenchCleaner
to delete these files on exit. (-clean
is an Eclipse setting while-cleanConfig
is an Archi setting. We don't want the Eclipse setting any more.)For information, here's the source of the
WorkbenchCleaner
- https://github.com/archimatetool/archi/blob/master/com.archimatetool.editor/src/com/archimatetool/editor/WorkbenchCleaner.javaWhat happens if I remove the -cleanConfig option from Archi.ini (in Archi 4.8.1 and later)?
The files in the
.config
location will not be deleted when Archi exits.If you install Archi and know that you will not move its installation location or the location of the
dropins
folder you can do this without impact. It will also mean that Archi will launch slightly quicker since it does not have to re-create these files each time at startup.But be warned - if you do move Archi's installation location or its
dropins
location Archi might not load any additional plug-ins in thedropins
folder the next time you launch it.What can I do if it all goes wrong?
Delete the
.config
folder manually or make sure the-cleanConfig
setting is present in theArchi.ini
file (Archi 4.8.1 and later).The location of the
.config
folder is set inArchi.ini
for the-Dosgi.configuration.area
setting as:(
user.home
denotes the user's home folder)Wouldn't it be nice if...
...there was some setting that told Eclipse to not create all of these files at startup or to clear them?
Well, yes. I am not aware of such a setting. Unless there's an Eclipse expert out there...