Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hudson on Windows: what is better - Ant files or Batch files?

I have some hudson servers for our CI process.

The build tasks use Ant scripts and also old-school *.bat files.

What do you prefer? What are the pros and cons?

(I think of readability, familiarity to developers and extensibility...)

Are there any other options? We have .Net, Java and PHP apps to test.

like image 928
Tobias Schittkowski Avatar asked Dec 10 '22 09:12

Tobias Schittkowski


2 Answers

Batch is a programming language (and not a very good one at that). Ant is a dependency matrix language. What's the difference?

  • In a programming language, you specify the order everything occurs in. You're responsible to say what is built and the order.

  • In a dependency matrix language, you merely state the dependencies, and the program figures out what to do and the order it should be done in. One of the biggest issues developers have with Ant or Make is to try to force a build order instead of letting the build system take care of it.

Builds should always be done with a dependency matrix language like Ant.

Let Ant determine what needs to be built and the order it should be built. Don't use Batch. If you're using Batch scripts to call a bunch of Ant script in the order you think they should be called, you're doing it wrong. Have a master Ant script do it and use <subant> calls. Let Ant do the tricky stuff.

You can use batch script to do preliminary work (such as setting ANT_OPTS if Ant needs more memory, or setting environment variables like ANT_HOME and JAVA_HOME and your %PATH% variable to make sure you're using the correct Java and Ant versions. In Hudson, you can set all of this in the Hudson job itself, so you don't have to call the Batch script.

like image 62
David W. Avatar answered Mar 23 '23 17:03

David W.


*.bat files pretty much restrict you to dos/windows, like how shell scripts are for linux, whereas Ant/Maven is cross-platform and gives you the option to use a non-Windows CI server

like image 23
prusswan Avatar answered Mar 23 '23 17:03

prusswan