News for hackers. Stuff that matters.
Re:How to write cross-platform code by js2 on Friday October 22, 2010 @12:25PM (#1820254)
By this I mean that once a new feature is implemented and tested on one platform (let’s say Windows), the programmer checks it into Subversion, then IMMEDIATELY checks it out on both Macintosh and Linux and compiles it.

Yuck. Here's how we do it:

  $ git commit
  $ git push origin HEAD:refs/for/master
The commit shows up in gerrit for code review. Immediately the buildbots (one for each platform) notice the change and attempt to compile it. The results are reported back to gerrit and a failed compile blocks the change from being submitted.

Assuming the change compiles cleanly and passes code review, it can then merged to the master branch. Importantly, broken code doesn't get checked-in in the first place.

Now, we happen to use git and gerrit and buildbot, but any decent system should have code review and a build farm that allow changes to be tested and reviewed before they are checked in.

If your developers aren't following some procedure (e.g., test compile on every platform), consider it may be because there is too much friction. Instead of firing the developers, ask why they aren't following it. Maybe other developers are impacted too and just have a higher tolerance for menial tasks, but those tasks are still costing the organization.

http://code.google.com/p/gerrit/

http://buildbot.net/trac

http://github.com/jaysoffian/buildbot/commit/e4c0d458374b9a0...

And if you happen to use hudson:

http://wiki.hudson-ci.org/display/HUDSON/Gerrit+Plugin

http://wiki.hudson-ci.org/display/HUDSON/Gerrit+Trigger

Re:How to write cross-platform code by brettmjohnson on Friday October 22, 2010 @01:51PM (#1820650)
Agreed. Using git or mercurial would get around this. I worked for nearly a decade on cross-platform code that followed a similar methodology.

Our rule was the code most compile w/o warnings on 3 dissimilar platforms before you could commit it. We were able to do this easily because we had network-mounted home directories, so when you logged into another machine, our development tree was automatically mounted. This made it easy to compile without checking in, then checking out.

Re:How to write cross-platform code by calloc on Friday October 22, 2010 @01:55PM (#1820670)
In our case we have a buildbot attached to a subversion along with a try server.

You test your changes on all the various platforms by pushing it to the try server, it compiles on the various platforms we have set up at the moment (FBSD, Mac OS X, Windows, Ubuntu Linux) and gives you a status report on what if anything broke. If nothing is broken you can push it out to Review Board, at which point someone reviews the code.

Once the code has been reviewed and ship-it has been tagged on RB, the code is checked into subversion proper. At this time the buildbot picks up the change and does a quick (svn update) build to make sure nothing was broken, and then does a full (rm -rf buildir; svn co) build at the top of the hour.

Reports get mailed, code is checked in.