0

I have some files for some different (mainly re-branding) setups, we can add more in the future (these versions are not very much related and can include some of the files). Now, these files can also be grouped by equipment category, more to be added in the future, of course. I can make a setup for just an equipment or for all. So, for a file, I can have a combination of any setup types and an equipment (or all of them).

Hence, I can imagine a line like this:

<copy file="${dir.binaries}/A.dll" todir="${dir.install.ProgramFiles}" <IF (NOT (conf.1 or conf.2)) AND (equipment.1 or ALL) />

Now, I can make a condition for all these cases and use if:set, but these conditions can soon be flooding my ant file, didn't they ? A worst case scenario: 4 setups and 5 equipments (or all) => (4+6+4+1)*(5+1) = 90 conditions, isn't it :) ? I can imagine a macrodef, something like IsFileIncluded(equipment, excluded setups, actual setup, actual equipment) - can this work? Another solution?

I want pure ant since this has to also work on the server or a very good reason to convince them to include something else.

Community
  • 1
  • 1
Liviu
  • 1,859
  • 2
  • 22
  • 48
  • Related: http://stackoverflow.com/questions/18097555/execute-ant-task-if-two-conditions-are-met – Liviu Nov 05 '15 at 10:22
  • Could you give a solid example? Not entirely clear what the problem is. Would this problem be better solved by a script? Called by ANT or if necessary embedded within ANT. – Mark O'Connor Nov 05 '15 at 22:22
  • The problem is that I have to provide a large number of `` to cover all the files, when some "expression language" will greatly reduce complexity ([using multiple properties in the 'if' and 'unless' conditions](http://ant.1045680.n5.nabble.com/using-multiple-properties-in-the-if-and-unless-conditions-td1363405.html)) I'll try to provide an example over the week-end. A script :(? I thought And was enough by itself, I'm already trying to eliminate some pearl script that cannot be supporter anymore. – Liviu Nov 06 '15 at 10:32
  • ANT is not a scripting language. It's a DSL for building applications. You can of course call scripts using "exec" task or embed scripting languages like Javascript or my favourite groovy. – Mark O'Connor Nov 06 '15 at 23:59
  • Why including scripts for copying files, which should be the ANT business ? Maybe I should replace ANT with cmake or SCons, which are more appropriate for scripting? – Liviu Nov 09 '15 at 10:19

0 Answers0