After some investigation, I noticed that there even is an option for that, but
it is not actually checked in the proper place.

(These are the defaults so they wouldn't normally be written to the project 
file)
<ExecuteBefore>
<Command Value="echo test"/>
<CompileReasons Compile="True" Build="True" Run="True"/>
</ExecuteBefore>

So, a build tool is by default defined to be executed for all compile events as
well as "Run" events. In my opinion, this means that it should also be executed
for lazbuild runs that do not result in a build - they should be treated as
crCompile. If Lazbuild was invoked with -B, that should be a crBuild reason.
However, in the IDE (TMainIDE.DoBuildProject) crBuild only means "Rebuild" if
pbfCleanCompile is given as well, there is no difference between crBuild and
crCompile other than tool enable/disable flags. For me, crBuild=pbfCleanCompile
and crRun=pbfOnlyIfNeeded, so these separate flags seem superfluous?

The intended behaviour for the IDE is documented in the wiki at
<http://wiki.lazarus.freepascal.org/IDE_Window:_Project_Options#Execute_before>
Note the definition for "Run" - this is currently not true, and technically the
current LazBuild behaviour is more like "Run" than "Compile" since it skips
building completely if not needed, while crCompile should at least compile the
main file and relink.

This is confusing.
The only thing I'm sure about is that tool invocation needs to be moved *before*
the check weather any compiler action is needed. On a side note, I've checked
with Delphi's MSBuild configuration, and for them, Pre-Build commands are also
independent of whether the compiler actually does something.

There is a lot of redundancy in this, but before I start working on it, I'd
rather have some info on what the intention was behind the current structure.


Regards,

Sebastian


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to