0

I'm working on eclipse envrioment that contains a lot of projects. On one of my project I'm holding several XML filse with an XML schema. I want that the compilation will not start or will fail if any xml file is inconsistent with the XML schema.

I wrote a python script that comparing each XML and schema and I'm running it as a pre-build step.

The problem is that the pre-build step isn't stoping the compilation in case of error.

Am i missing somthing ?

Thanks!

Omer Talmi
  • 128
  • 3
  • 11

1 Answers1

1

No, you did not miss anything. The eclipse documentation clearly says, that the build step is executed anyway, regardless of the result of the pre-build step. That is exactly what happens.

See: http://help.eclipse.org/luna/topic/org.eclipse.cdt.doc.user/reference/cdt_u_prop_build_settings_steps.htm?cp=5_4_7_0_3_3_1

A solution for you might be to put a file named "makefile.defs" in a project directory and add rules to it that trigger the python script. If the script fails, this will stop the build process. I tried something similar and it worked, but to find the correct rule was not so easy. As a result, I recommend to write your own makefiles and do not have eclipse generate them. That gives you maximum flexibility over the whole build process. A compromise could be to write an additional script that calls your script for checking the XML-files and then the makefiles that eclipse has generated.

By the way: Forget python. Use Ruby instead.

Lexi Pim
  • 11
  • 1