Disable Build automatically & change Keyboard Shortcuts - Faster builds, less waiting

Resulting from discussions like this or this by and with @kriegfrj I came up with something I’d like to share.

I disabled Build automatically and changed default eclipse keyboard shortcuts for building the current project manually

  • Build Project: Command + B
  • Build all: Shift + Command + B

Environment:

  • MacOS
  • Eclipse 2021-12
  • bndtools 6.1.0

image

What will happen with the changes above?

  • From now I build manually by pressing Cmd + B (MacOS) after each change. I do that almost automatically like Command + S for saving a file.
  • only the current bundle is rebuilt, the .jar is created in generated folder and even automatically redeployed when the application is currently running (allows live coding in some cases)… so changes might become visible right away.
  • Project / Build automatically = disabled avoids rebuild of 50 other dependent bundles automatically after such a change.

What problem does it solve?

Slow build speed in Eclipse by bndtools builder when saving e.g. MyCoreUtils.java file in a Bundle on which a lot of other bundles depend on.
With Build automatically enabled a single change in a bundle in the root of the dependecy chain causes a rebuild + packaging / creation of the .jar of 50+ other bundles.
But I have just changed e.g. just a logging statement… No method signature, no interface… This causes regular CPU spikes and UI freezes… basically a lot of waiting.

What is a drawback of this approach / workaround above?

Of course a rebuild of a single bundle can lead to the problem that things go out-of-sync e.g. if you add new interface methods etc.

In that case I do a full build from time to time using Build all: Shift + Command + B

Conclusion

This little change of habit increases my productivity a lot until there is some progress in tickets like this.

Any feedback?
Anybody else doing something similar?
Or is it plain crazy :wink:

Have fun :slight_smile:

I once experimented with disabling “build automatically”, and relying on the automatic “build before launch”. However, your approach seems more practical when doing hot-coding on an instance that’s already running. I’ll have to give it a try!

Here is slight optimization of my approach:

  • I enabled the option Save automatically before manual build

Advantage: I only need to press Build Project: Command + B which saves the current file and then a builds the current project (instead of Command + S and Command + B).

I noticed that I sometimes saved the file but forgot to build project. Now I just have to force myself to forget about Command + S, and only use Command + B which does both.