Delphi build-events are not batch files. They are statements concatenated into one big statement using ampersands.. Which means that when you use if statements, you need to wrap them in parentheses:

Delphi build-events are not batch files. They are statements concatenated into one big statement using ampersands.. Which means that when you use if statements, you need to wrap them in parentheses:

https://stackoverflow.com/questions/51386746/post-build-event-with-multiple-if-copy-combinations-only-execute-if-first-file-d

Which means I need to update https://wiert.me/2014/11/20/delphi-prebuildpostbuild-events/
https://stackoverflow.com/questions/51386746/post-build-event-with-multiple-if-copy-combinations-only-execute-if-first-file-d

Comments

  1. Which is why my build events don't contain the actual code but instead call external script files which can then be clearly visible in revision control

    ReplyDelete
  2. David Heffernan I tried that. Success depends on how many parameters you need to push to that script.

    ReplyDelete
  3. Jeroen Wiert Pluimers Why are you pushing lots of parameters? I encode the project specific details in the script.

    ReplyDelete
  4. David Heffernan Dear professor can you please show us a sample?

    ReplyDelete
  5. David Heffernan to ensure the batch file has all the information at hand.

    ReplyDelete
  6. Jeroen Wiert Pluimers Usually variations are project specific and so would be coded in the script. In my experience I've not had to pass many parameters. Perhaps the target arch, but what else might be needed?

    ReplyDelete
  7. various directories, defines, project name, build platform/bitness/type, quoted appropriately.

    ReplyDelete
  8. Directories are seldom needed, they come with the working directory. As for the others, that's similar to what I do, but it's not very difficult to do. Certainly it's not as hard as you claim.

    ReplyDelete
  9. David Heffernan you make too many absolute statements.

    ReplyDelete
  10. Jeroen Wiert Pluimers passing any of those things as parameters is quite easy. I don't see the complication.

    ReplyDelete
  11. David Heffernan parameter quoting and order makes this convoluted, just like any other child process you start.

    ReplyDelete
  12. Jeroen Wiert Pluimers I honestly don't see it as hard to pass parameters in the correct order

    ReplyDelete
  13. David Heffernan Try dissecting the list of conditional defines if your target systems have just batch files or PowerShell 2.0.

    But maybe your perception of difficulty is different than mine.

    ReplyDelete
  14. Jeroen Wiert Pluimers Are you talking about writing the code in the script, or passing the arguments. I'm talking about the latter. For the former I shell out to Python and then everything is peachy!!!!

    ReplyDelete
  15. David Heffernan I'm not in the luxury to have Python available at all sites. Even with it, passing more parameters means more complexity (because order, quoting and delimiting matter). It helps a lot for instance to put "$(DEFINES)" at the end.

    ReplyDelete

Post a Comment