Important Note: Be extra careful when doing batch compilation of projects in project groups, or using external build tools. There are IDE bugs and other issues, which may pass incorrect information to EurekaLog (via OpenTools API in case of IDE). Pay close attention which configuration file is passed to compilers by external build tools. Always double-check the final executables.
This article will discuss how you can control EurekaLog manually - without assistance of IDE expert. This may be useful if you want to use EurekaLog without IDE expert installed, if you want consistent behavior between IDE and your build tool, or for any other reason.
Step 1: get working solution for single build configurationFirst, we create a new VCL application and place a button to raise exception. Then go to Project/EurekaLog options, enable EurekaLog and specify type of this application (VCL Forms). You can also set other options as you desire. Now run the application and confirm it's working as expected.
Step 2: reconfigure project for manual control
A: Creating options For the next step you should go to "Project" / "EurekaLog options" and use "Export" button to create .eof file. Place it in the same folder as your project (by default "Profiles" folder is suggested, switch to your project's folder). Name it as you like. For example: Project1_Custom_Config.eof.
B: Disable IDE assist Now, don't close options dialog, but go to "Advanced" / "Custom/Manual" and add "DoNotTouch=1" line (without quotes) in any place (as new line). This will disable any assist for your project from IDE expert. Close settings and save your project.
Note: do not add "DoNotTouch=1" line to configuration created on step A above.
You can confirm if option is taking effect by disabling EurekaLog, saving your project and observing that there are no changes in your .dpr file - all units are still included even if no EurekaLog is enabled.
Note: EurekaLog also supports "DoNotTouchCompilation", "DoNotTouchOptions", "DoNotTouchUnits", and "DoNotTouchPackages" options for more precise control over options. Set "DoNotTouch" option to completely disable EurekaLog assist for the project; or set one or several "DoNotTouchXYZ" options. "DoNotTouchCompilation" option disables post-processing assist. Enable this option if you intend to invoke ecc32/emake manually. "DoNotTouchOptions" disables modification of project options and defines. Enable this option if you want to manage project options manually. "DoNotTouchUnits" disables modification of units in uses clause. Enable this option if you want to manually manage your units. "DoNotTouchPackages" option disables modifications in run-time packages list.
Alternatively, you may simply disable/remove EurekaLog IDE expert.
C: Setting up post-processing Now, it's time to restore post-processing for your application. Go to "Project" / "Options" (not EurekaLog options) and look for build events options.
Add the following command as pre-build event which is invoked before compilation:
IF EXIST "C:\Program Files (x86)\Neos Eureka S.r.l\EurekaLog 7\Packages\Studio16\ecc32.exe" "C:\Program Files (x86)\Neos Eureka S.r.l\EurekaLog 7\Packages\Studio16\ecc32.exe" "--el_prepare=$(PROJECTPATH)" "--el_config=Project1_Custom_Config.eof"
Add the following command as post-build event which is invoked after successful compilation:
IF EXIST "C:\Program Files (x86)\Neos Eureka S.r.l\EurekaLog 7\Packages\Studio16\ecc32.exe" "C:\Program Files (x86)\Neos Eureka S.r.l\EurekaLog 7\Packages\Studio16\ecc32.exe" "--el_alter_exe=$(PROJECTPATH);$(OUTPUTPATH)" "--el_config=Project1_Custom_Config.eof"
Notes:
So, the resulting command-line may look like this when run:
IF EXIST "C:\Program Files (x86)\Neos Eureka S.r.l\EurekaLog 7\Packages\Studio16\ecc32.exe" "C:\Program Files (x86)\Neos Eureka S.r.l\EurekaLog 7\Packages\Studio16\ecc32.exe" --el_alter_exe"C:\Projects\Project1.dproj;C:\Projects\Debug\Win32\Project1.exe" "--el_config=Project1_Custom_Config.eof"
Note that this is an example of final command as it will be executed by IDE. You should NOT use this form of command (with already expanded variables) - please use the first example with $(...) variables.
D: Check that everything works Now compile your project and run it. If you have done everything correctly - the result must be the same as on step 1: the correct EurekaLog-enabled application with expected behavior as set in external .eof file (even though the EurekaLog was disabled in project).
In case of any build errors - take a look at compiler output as shown in "Messages" window. It's docked at the bottom of IDE window by default. "Output" tab is near "Build" tab, which is active by default. If you don't see "Messages" window - use View/Messages command to show it, then switch to output window. The correct compilation will get you such messages:
Build started 2012.06.29 16:58:04. __________________________________________________ Project "C:\Projects\Project1.dproj" (Build target(s)): Target _PasCoreCompile: C:\program files (x86)\embarcadero\rad studio\8.0\bin\dcc32.exe //-- options cut to save space --// Project1.dpr Target PostBuildEvent: IF EXIST "C:\Program Files (x86)\Neos Eureka S.r.l\EurekaLog 7\Packages\Studio16\ecc32.exe" "C:\Program Files (x86)\Neos Eureka S.r.l\EurekaLog 7\Packages\Studio16\ecc32.exe" "--el_alter_exe=C:\Projects\Project1.dproj;.\Debug\Win32\Project1.exe" "--el_config=Project1_Custom_Config.eof" EurekaLog Command-Line Compiler v7.0.1.0 for Delphi 15.0 ----------------------------------------------------------------
Loading EurekaLog options... EurekaLog postprocessor start... EurekaLog's code was added EurekaLog's options were added EurekaLog's data was added File size before: 2'159'616 File size after: 2'185'216 File size diff: +25'600 Debug info size: 287'554 Symbols size: 58 Functions size: 4 Stripped size: -138'240 Number of units: 209 Number of procedures: 10'136 Number of lines: 28'124 Total time: 00:00:00.639 Compilation time: 00:00:00.026 Prepare time: 00:00:00.015 Post-process time: 00:00:00.597 Events time: 00:00:00.001 Memory usage: Allocated: 7'576'806 RAM: 29'999'104 Private: 27'066'368 Virtual: 105'299'968 EurekaLog postprocessor end Build succeeded. 0 Warning(s) 0 Error(s) Time Elapsed 00:00:01.91
Step 3: [optional] configuring alternative build configurationsFinally, you may create any number of additional build configurations. The first thing you need to do - is to decide if you want EurekaLog for this build configuration or not. The difference is that you need different project options set for different cases. As well as different unit set.
First, conditional directives. Go to "Project" / "Options" and look to "Delphi Compiler" / "Conditional Defines" option. Now, if you want EurekaLog for this build configuration - add EUREKALOG conditional symbol. If you don't want EurekaLog for this build configuration - remove EUREKALOG conditional symbol. Repeat this step for each build configuration of your project that you're going to use.
Second, the options of the project. EurekaLog requires certain options to be set in order to work. Also, some option may increase or decrease detalization of EurekaLog. So, if you want to use EurekaLog in certain build configuration - then you have to setup all required options manually. Please, read this article to know what options must be set. For other build configurations (in which EurekaLog will not be used) you can set options as you desire, there are no limitations.
Third, included units - those will be handled by --el_prepare switch which is used above.
Fourth, you have to create .eof file for each build configuration and save it with corresponding name.
At last - make sure that pre/post-build events that we set in options at previous step are applied for all build configurations (you can do this by entering command to Base build configuration and checking that it wasn't overwritten in other build configurations).
Notes:
Now, do a test - switch to different build configurations, make a build, run application and test it.
Important Note: it's recommended to make a full rebuild when changing build configuration or target platform.
ConclusionThis article explained the basics of manual control over configuration of your project.
As a side note - let's discuss relation between settings and build configurations names:
See also:
|