How target platforms helped me to fix old bugs

ttoine's picture
Blog Categories: 

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:

  1. Create a new workspace (workspaceBranch).
  2. 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.

    The target platform is made up of all bundles of the product containing the bug

  3. Check out ONLY your old bugged bundle from the branch.

    A minimal and easy-to-use workspace

  4. Create your launch configuration which is made up of the product and your buggy bundle project from workspace.

    Configure your launch to use your product, with the patched bundle from your workspace

  5. Run and test your product to see the bug.
  6. Fix your old code.
  7. Test your fix.
  8. 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!