iloveeclipse / filesync4eclipse

File synchronization plugin for Eclipse
https://github.com/iloveeclipse/plugins/wiki
Eclipse Public License 1.0
6 stars 3 forks source link

dynamic destination folder caching issue #48

Closed lsalomon closed 8 years ago

lsalomon commented 8 years ago

Hi !

First of all great job !

I'm using filesync for years now, and I'm using Eclipse Neon M5 with PDT on Mac os X.

I'm having issues I think with some kind of file prefs caching...

Using eclipse variables, I've managed to write a very agile config file :

WARNING=DO NOT MODIFY THIS FILE IF YOU DON'T UNDERSTAND defaultDestination= defaultVariables= eclipse.preferences.version=1 includeTeamPrivateFiles=false map|0=/|${env_var:HOME}/backup/${project_name}/${current_date:yyyyMMdd}/${git_branch}|,|/|.properties map|1=/|${env_var:HOME}/Public/php01.vm/www/domain/${project_name}-dist/releases/${git_branch}|,|/|.properties map|2=/|${env_var:HOME}/Public/php02.vm/www/domain/${project_name}-dist/releases/${git_branch}|,|/|.properties map|3=/|${env_var:HOME}/Public/php03.vm/www/domain/${project_name}-dist/releases/${git_branch}|,|/|.properties useCurrentDateForDestinationFiles=false

This allow me when I switch to any git branch, to filesync my code in a git branch dedicated directory dynamically accessible via apache and its magic directive VirtualDocumentRoot, which worked like a charm.

Now I have to disable, enable a project in order to force update the filesync destination file paths.

Do you think It's caused to some eclipse caching layer, some Filesync caching layer, or else ?

Is it really a bug, I don't think so, but saddly, it's a downgrading and unexpected side-effect for me and my teams. (As it has became a shared configuration file.)

Can you help me ?

iloveeclipse commented 8 years ago

So to be sure I understood it right: after update to Neon M5 filesync doesn't work unless you "enable/disable" the project? What do you mean by "enable/disable" the project? Anyway, try to create a new workspace and a simple project and use a simple stupid config to sync a folder "a" to /tmp. No extras, no PDT, no variables etc- just to see if filesync basics are working in you environment. If this simple example doesn't work, then try to downgrade to Eclipse version you've used before and check again. If the simple example works, try to make it step by step more like your original setup, each time checking for regression. This way please try to find where the problem starts for you. Also please check if you see some related errors in Eclipse error log.

iloveeclipse commented 8 years ago

BTW you can try Neon M6 which is just arrived (SDK is there, other projects will be there with M6 next week).

lsalomon commented 8 years ago

Thanks for the reply.

What doesn't work is when I switch to another git branch in the "Team > Switch To" menu; the dynamic paths in the filesync pref file are no longer dynamics; they are sticked to the previous git branch. And so, in order to force the update of these paths, I have to uncheck the "Properties > File synchronization > Enable FilesSync Builder for project" checkbox, apply, ok. Then I can check it back, and it forces the paths update.

Like I said, just like there was some kind of a new cache layer.

iloveeclipse commented 8 years ago

OK, you probably mean that for the filesync the ${git_branch} is still pointing to the old branch. I think this can be the problem that filesync doesn't listen to the variables change events (if there are any?). I have to debug this.

lsalomon commented 8 years ago

Yes exactly ! But I wonder why it worked before, and when it stopped working precisely ?

That would be fantastic !

iloveeclipse commented 8 years ago

Laurent, have you changed egit version? If it worked before, and now it doesn't, it must be a regression in egit (and per coincidence I'm also committer in egit too :-)), because I haven't touched FileSync for a long period of time. Please check the egit versions you had/have now and if they differ, create a bug report here: https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EGit

iloveeclipse commented 8 years ago

But wait, the related code in FileSync never listened to variables change, see de.loskutov.fs.command.PathVariableHelper.resolveVariable(String, IPath) callers and especially de.loskutov.fs.properties.ProjectProperties.buildPathMap(IEclipsePreferences).

The FileSync must add IValueVariableListener to org.eclipse.core.variables.IStringVariableManager.

So I wonder why it worked before?

May be there were some PreferenceChangeEvent's flying around after the branch switch, and now they are gone? FileSync listens to the project preferences change and re-creates FileMapping instances if they change.

So can you please check if the project preferences (located under /.settings) are identical in both branches today and if they were different before? If yes, than the easiest workaround would be to put some dummy preferences node which differs for all branches to affected projects.

iloveeclipse commented 8 years ago

Laurent, I've created a "pre-release": https://github.com/iloveeclipse/filesync4eclipse/releases/tag/1.3.10 with changes I think needed for your bug. I must confess, I haven't tested anything and also didn't even started the debugger to verify if this works or not. Please put the attached jar to the eclipse/dropins folder and restart Eclipse. In theory, this should fix your problem.

lsalomon commented 8 years ago

well, that was quick !!!

I droped the jar in the dropins folder but nothing happens :/

I tried to launch eclipse with -clean but the version of the filesync is stil 1.3.9

iloveeclipse commented 8 years ago

Restart eclipse with "-clean" argument. In case this does not help, create new eclipse installation, do not install old FS version but just put the new one into that dropins folder.

lsalomon commented 8 years ago

I've been able to test it in a fresh install (neon M6) with a new PHP project. And still, changing branch doesn't change the ${git_branch} in the path. still have to disable / enable the builder to see the changes.

iloveeclipse commented 8 years ago

Laurent, I will try to debug this on weekend, but it would be really interesting if you could check 2 things as proposed above: 1) Try to find the Eclipse configuration change which might have caused this (egit update?) 2) Try to check if my guess is right/not regarding the project preferences: check if the project preferences (located under /.settings) are identical in both branches today and if they were different before? If yes, than the easiest workaround would be to put some dummy preferences node which differs for all branches to affected projects.

lsalomon commented 8 years ago

Hi Andrey,

I've been searching but I can't find any leads on the configuration change...

the .settings directory is in my .gitignore file. As I change/create/delete branches daily, it won't be a long term solution. I use gitflow and usualy have to switch between feature branches while creating weekly release or hotfix branches :/

Any leads on your side ?

iloveeclipse commented 8 years ago

Laurent, I think I found the problem. I've pushed a new jar file, please repeat the steps to install it again from https://github.com/iloveeclipse/filesync4eclipse/releases/tag/1.3.10 Feedback is welcome, you will be the first tester :-) Regards, Andrey

lsalomon commented 8 years ago

AND IT WORKS !!!!

Thank you very much andrey !!!

And sorry for the delay I was on holidays :/

Filesync is definitly the best eclipse plugin ever !!!