DunitX and FinalBuilder - delphi

I have both C++ and Delphi tests in DunitX. I am trying to get it to Build in FinalBuilder. C++ tests builds fine, but Delphi tests has the error:
"Error creating cfg file: C:\Tests.cfg Error expanding variables in Library Path : [Expression Error]: Variable\Object "DUnitX" does not exist! [$(DUnitX.);$(BDSLIB)\Win32\rele]
The FinalBuilder does not have a DunitX action, but has Dunit and NUnit ones. For both C++ and Delphi ones the action is Build. Thoughts on FinalBuilder integration appreciated.
IDE: RAD Berlin 10.1
FinalBuilder: 8

Open the failing project and look into the project options
Delphi Compiler -> Search path for any Target might contain $(DUnitX.) <- notice the dot
Make sure to remove the dot and make sure that you have the DUnitX environment variable set - for additional information see this article: https://www.finalbuilder.com/resources/blogs/postid/702/dunitx-has-a-wizard
If you are using the DUnitX version that ships with Delphi you can just remove the $(DUnitX.) from the search path as the DUnitX sources should be in the BDSLib directory.
However keep in mind that when you create new DUnitX projects via the Wizard it adds that variable to the project (that is probably where it came from originally) which then might again fail when building with FinalBuilder. I don't know how it behaves without that wrong dot if the variable does not exist.

Related

Can't add Action manager to Delphi 10.3.3 unit

I'm using Delphi 10.3.3. Today, I added a TActionManager to a form containing a TCheckList and set a few actions.
When I tried to compile, the IDE insisted on adding IDETheme.ActnCtrls to my Uses list, then failed to compile because it couldn't find the file.
I've been using Delphi since Borland Pascal, and this one is new to me.
What can I do? I've tried deleting, building instead of compiling, starting a new unit, a new project, restarting the IDE and starting a new project.
John Treder
Known issue in 10.3.3:
RSP-27035: [dcc32 Fatal Error] F2613 Unit 'IDETheme.ActnCtrls' not found.
Marco Cantu said:
Unfortunately there is a an incorrect dependency in the IDE. If you close the file unit from the IDE, and remove that uses statement with another editor, it should compile (from the IDE) and work correctly. We are looking into a solution
Patrick Premartin said:
il you add an empty unit named IDETheme.ActnCtrls to the project, you probably can compile without changing source file outside Delphi
A patch was released for the issue:
#30903: RAD Studio 10.3.3 IDE and VCL Patch

C++ Builder 10.3 Rio - Testframework

It seems that C++ builder 10.3. comes with a new testframework.hpp. The class Assert does not exist any longer.
Can anyone tell me how to use this new framework?
I am desperate because I wrote a lot of code and obviously Rio is not really compatible.
for example the following code line, written in Builder 10.2.3, doesn't work any longer:
Dunitx.Testframework::Assert::IsTrue (result == true);
I found the solution in the testframework.hpp - file. The usage is now a lot easier but you will have to know how to handle it. The description in the embaracdero help system is wrong and should be corrected.
You seem to have found the TestFramework.hpp for DUnit. But it is obvious your code was using DUnitX before. These are similar but incompatible test frameworks.
To get the Dunitx.Testframework.hpp you need, simply add DUnitX.TestFramework.pas to your C++Builder test project (add it in the project manager) and completely re-build your project. The Pascal compiler will generate the necessary .hpp file for you.
But before you do all that, you may want to copy your project to a new folder, and load it from there, just to be sure. That way, the older project will not be modified. Be sure to update all your paths in the project manager and C++ library settings too, if necessary.
If you think DUnit is easier to use (I certainly do), then keep on using that. But you will have to rewrite some parts of your tests. More info can be found in the Delphi help files (and on the web counterpart) and on the DUnit website.
DUnit was the former test framework for Delphi (hence the D), but at some time in the past, it was replaced by the more modern DUnitX. But that uses some Delphi features (like Delphi attributes) that make it harder to use in C++Builder. DUnit is still part of the RAD Studio installation.

Error: F1026 File not found: 'System.Actions.dcu' by Command Line Compiler

The editor automatically adds the System.Actions unit when one of my forms is saved.
It compiles without a problem in the IDE, but unfortunately the Command Line Compiler can not find the file and gives me the error:
Error: F1026 File not found: 'System.Actions.dcu'
What am I missing?
In what follows, I am assuming that you are using msbuild to compile your program.
The System.Actions unit was added in XE3 to support actions in both FMX and VCL frameworks. Prior to that release FMX had no actions. Some classes were moved around, out of VCL units and into the new System.Actions unit which can be used by both FMX and VCL code.
So, the compiler error that you see suggests to me that you are unintentionally compiling with a version that pre-dates this change. My guess is that your IDE is XE3 or later, but that your command line build is configured to use an earlier version of Delphi. Most likely through the PATH environment variable, and whatever Embarcadero entry happens to be first in that variable.
If my hunch is correct then you need to ensure that you compile with the desired version.
The way I organise machines that have multiple Delphi installations is as follows:
Remove all Embarcadero entries from your PATH environment variable.
Whenever you need to build at the command line, configure the environment, for instance by running the appropriate rsvars.bat script (found in the bin directory of your Delphi installation) before you call msbuild.
This way you cannot accidentally find the wrong version because you have to explicitly configure an environment.
On the other hand, perhaps you are calling dcc32 directly. Don't do that. You will have to supply all the options and paths that are already defined in your project file. Repeating that is just a way to create a maintenence headache and make it likely that your command line build won't match the IDE build.
Instead, use msbuild to build your program. That way you can use the settings defined in your project file.
Thanks Hefferman for your advice but we shall stick with dcc32. It's easier to customize. For example we didn't figure out how to use more than one 'define' parameter with msbuild. It's possible to use dcc32 with the -NS switch for dependent 'uses' and that is our solution. We also create some .dpr files with code and in that case we do not have a corresponding .dproj file.

How to compile a Win32 program from the command line with Delphi

as the title says, I'm trying to compile a Win32 program without the aid of an IDE, just so I can learn. I'm using Borland Studio 2006, and my first thought was to take some files generated from a Forms application from the IDE and compile the project file... that gave me errors about expecting unit and finding object instead. I know that's from the dfm file which holds all the settings for a form, but I don't get how the IDE deals with that file, can anyone help me understand the system better? :)
If I have understood correctly, you need to grasp the structure of a Delphi project and how Forms and units work together. You cannot just cherry-pick some files and expect to be able to feed them to the compiler.
You also have to set the path to the library/components/used files so that the compiler can find everything it needs, starting with the project dpr.
I would recommend that you try first to run your project from the IDE, then once it runs, you can try it from the command line.
I found out all I needed to do is compile the top level unit into a dcu, and then the project will compile :) If anyone else is trying to do the same thing, there's some great info at the bottom of this page
http://www.codexterity.com/raw-delphi/index.htm
WANT automates the process of building, testing, and packaging applications and libraries much like Jakarta Ant does
You wrote in question that you are using BDS 2006. If you want to learn more recent build process in Delphi I suggest you to upgrade at least to Delphi 2007 which introduced MS Build usage.
Of course MS Build acts like "wrapper" so this is not must have but nice have :-)

Set build configuration for command line build in Codegear 2009 IDE

This is a follow up question. Is it possible to set the build configuration for a command line build in Codegear 2009?
For example:
msbuild /property:BuildConfiguration=Release workspaceX.groupproj
Yes. In fact you're very close with your example. Use /p:Configuration="Name":
msbuild YourProj.cbproj /p:Configuration="Release Build"
It is Configuration="Name" for a C++Builder project, and config="Name" for a Delphi project, which you'll need to be aware of if your project group mixes Delphi and C++Builder projects. (I don't know why this is, but there you go. You would not believe how long that took to figure out. Edit: according to a comment, 'config' works in 2009. I can only state that for certain it did not work for us in 2010.)
You can also use /t: to specify a target, such as cleaning, building or making your project; /verbosity to set an output level ('quiet' is the closest that mimics the old C++Builder 6 compiler output without writing a custom MSBuild logger); and other switches which you can see if you type msbuild /? at a command line. You can end up with something like this:
msbuild YourProj.cbproj /p:Configuration="Release Build" /t:Make /verbosity:quiet /nologo
You'll need to include a line like this in your build script for each project in your project group. As far as I'm aware, you can't build or make a project group itself as a whole from the command line.

Resources