I'm trying to use Pre-/Post-Build-Events (Delphi 10.1 Berlin, if that matters). Is there a variable, parameter, option etc to distinguish between a "make" and a "build"? The Events are fired in both cases, but I would like to do some special handling only if I "build" the project.
I'm trying to use Pre-/Post-Build-Events (Delphi 10.1 Berlin, if that matters). Is there a variable, parameter, option etc to distinguish between a "make" and a "build"? The Events are fired in both cases, but I would like to do some special handling only if I "build" the project.
(Yes, I have googled for that several hours)
TIA
Achim
(Yes, I have googled for that several hours)
TIA
Achim
Interesting idea! I've not noticed any environment variables that could help me there yet.
ReplyDeleteI don't think there is.
ReplyDeleteWhy build on your workstation when you can set up a build server? Every commit can trigger unit tests, exe builds, exe signing, copying the exe files to their staging directories, building install scripts, upgrade the test servers.
ReplyDeleteThere is nothing. I wrote a plugin to get around that. If I recall I hooked the compiler notifications and set environment variables to distinguish between make and build.
ReplyDeleteThis was important to me because my pre build actions involve compiling C code outside the project and so not part of the compiler's make logic.
David Heffernan I think more than just Achim Kalwa is interested for that plugin (:
ReplyDeletehttps://github.com/davidheff/DelphiProjectCompileMode
ReplyDeleteDavid Heffernan thanks a lot! I've not done OTA work for a long time so I assumed it would be a much more complex job. Your code is a great OTA example which I'm sure to mention in my blog.
ReplyDeleteDavid Heffernan That is exactly what I need! Thank you very much, David!
ReplyDeleteDid you (David, Achim) enter a feature request QP?
ReplyDeleteDavid Millington No, I did not. What are the chances to get this implemented in the near future?
ReplyDeleteAchim Kalwa Well, no promises, and it'd be post-Godzilla, but it seems likely to be fairly small and simple to me.
ReplyDeleteI did not. How would you see it working? An environment variable presented to the build action?
ReplyDeleteNot sure - we'd investigate what's possible or useful. Maybe you can comment in the QP your use case, ie what you'd like it to be? But certainly providing something that changes / is set or not set / similar based on either a build or make (build or compile) should be possible.
ReplyDeleteMay I ask: why it's not possible to create a new build configuration (something like Debug, Release, FullRelease)? You can just add different post-build events to each configuration...
ReplyDeleteAndrei Aleksandrov It is possible - right-click on the Build Configurations item in the Project Manager tree, and select New Configuration.
ReplyDeleteDavid Millington thanks for response! :) I know it, but wrote unclear comment, sorry.
ReplyDeleteI'm just wondering, why was it necessary to write a plugin for such a task and not use many build configurations with different pre-/post-build tasks...
Andrei Aleksandrov Read the question. Asker wants to distinguish between make and build actions, from the same configuration.
ReplyDeleteDavid Heffernan cool. What is the difference between distinguishing between make/build and two different build configurations?
ReplyDeleteDavid Heffernan, Andrei Aleksandrov Since the Delphi IDE distinguishes between "make" and "build", the "Build events" should also do: I use a pre-build event to increase the build number (in an external .rc file), and signtool in a post-build-event. Both needs to be run on a build (Shift+F9) only. On a normal compile/make (Ctrl+F9) or run (F9) this external tools are not required. A distinct build configuration would be a solution, but is not accessable by simple keyboard shortcuts.
ReplyDeleteAchim Kalwa that is what I wanted to know. Thanks for answer :)
ReplyDeleteAchim Kalwa Makes sense, although I'm not sure why the external tools (including signing) are not needing on a make? But the general use case is clear. Can you point me at a QP? I'll see if we can make this more powerful in an upcoming release.
ReplyDeleteDavid Millington can you add shortcuts for switching build configurations? :))))
ReplyDeleteDavid Millington in my build environment I compile C source files which are then linked with $LINK. For obvious reasons I'd like to be able to compile only outdated ones when doing a make, but compile all when doing a build.
ReplyDeleteI have achieved that crudely using an IDE design time package that sets an environment variable depending on whether the action is make or build.
It would be helpful if Delphi had something built in for this.
As far as signing the executable goes then that is fine to happen every time in my view, but perhaps the asker here wants to save even more time.
David Heffernan Can't you achieve that by putting the C files in their own project, which is first in the build order before the project linking them?
ReplyDeleteDavid Millington They are compiled by cl, so no
ReplyDelete