Build Java Code With Native Code on Multiple Platforms

I have what I believe is a unique need that I'm not sure how to meet. I'm sure (I hope) there's a way to do this with TeamCity, but I don't know what it might be. (FYI: I'm using IDEA as my development environment and Apache Ant as my build script, but I'm open to considering using something other than Ant if it makes achieving my goal easier or if it's just impossible with Ant.)

I am developing a Java library (open source, but not public yet because I have just started it) that also relies on some native code I am writing. Because of this, I have a need to ensure platform portability. I am currently using TeamCity 6.0.3 (I need to upgrade to 6.5) and Apache Ant to perform my builds on other projects and I'd like to use the same for this project. My TeamCity installation is running on OpenSUSE Linux 11.4 and I have just the one agent running on that machine.

Part A: At first I want to install two more agents, one on a single Mac OS X machine and one on a single Windows XP machine (eventually, I will expand to other machines as well). Potentially, these other machines might be Amazon EC2 instances (which I know the latest TeamCity can launch for me). Then, I want this build to build on ALL agents to ensure that the pending changes work on every platform.

Part B (Here's the kicker): If possible, I would like the .so/.jnilib/.dll files built by the builds on each agent to be returned to (or retrieved by, or whatever) the "master" build configuration (the one running on the Linux agent) so that ALL of these native library files can be automatically packaged up into a single zip file containing the .jar files and the native libraries.

I know this is probably going to be a complex combination of build configurations and Ant scripts, but I don't even know where to start.

Thoughts? Suggestions? Anyone else done this before? It's not a deal breaker if Part B isn't possible (I can package manually), but getting Part A to work is very critical.

Thanks!

2 comments
Comment actions Permalink

Hi Nicholas

Both parts of the build can be automated.
You need to extract platform-dependent tasks into standalone configurations. Like here:
Capture.PNG
Agent requirements can be used to limit build execution to specific platform.

Note that:

  • Java sources are compiled just once. That can be done on any platform. Resulted binaries are published as build artifacts and reused in next build configurations by artifact dependencies.
  • Snapshot dependencies helps to synchronize whole build chain - when you trigger new Package build all dependent builds are started automatically.
  • Configurations can have different VCS roots - i.e. Package build doesn't need Java sources, just binaries that are obtained by an artifact dependency
  • If build configurations have similar settings, templates allow to simplify administrative tasks.
0
Comment actions Permalink

Excellent! Thank you very much for you help. I'll need to read a little more an artifacts and artifact dependencies, but I'm confident this will get me what I need.

Thanks!

Nick

0

Please sign in to leave a comment.