How target platforms helped me to fix old bugs
I've used target platforms to ensure that I only add dependencies that are available in our build platform. Until now, I found them useful, but I did not understand how powerful they really are. Here is a story that convinced me that target platforms are a master feature of RCP development.
A few days ago, I had to fix a bug on the 5.2.3 branch version of the Studio/RCP part of Bonita Open Solution. The classes I needed to modify had been strongly refactored in trunk (5.3), so that the fix would be different on the trunk than on the branch, and it was impossible to simply propagate a fix.
So I had to edit old code. But my workspace only contained trunk code, and the old code was not compiling because of several refactorings. I was wondering how the heck I would be able to easily work on code from the past...! But I found an answer and it's simple... TARGET PLATFORMS !
Here is what I suggest to isolate the branch fix from trunk development:
- Create a new workspace (workspaceBranch).
- Set the old version of your product (here the 5.2.2 version) as the target platform. This must be the version containing the bug.
- Check out ONLY your old bugged bundle from the branch.
- Create your launch configuration which is made up of the product and your buggy bundle project from workspace.
- Run and test your product to see the bug.
- Fix your old code.
- Test your fix.
- Commit your fix on the branch.
With this trick, I avoided the headaches of mixing trunk and branch code. It made my work much easier and less risky.
The only annoying thing is that you lose all your workspace preferences and Mylyn contexts during the time it takes to finish the fix, so this is not critical.
I can now say it: I ♥ target platforms!