1
votes

I am very new to whole Delphi EcoSystem. I am using Rad Studio XE2.

Let's say I have a very simple case.

Projects A, B and C. C is dependent on B. B is dependent on A.

This is also how I have setup the dependencies using the 'Project Dependencies' IDE GUI.

C is the project that produces the executable. It is set as the 'current project'.

If I modify a file in project B and hit F5 (run) I would expect only projects B and C to compile.

However project A is rebuilt always!! This is the case even if I modify a source file in project C.

Am I doing something wrong? If so, any ideas as to what it could be?

Or is this just the way the IDE works?

A customer has a large legacy codebase and use XE2. At the moment they are manually handling the recompilation of dependent projects by right clicking on the lowest project that needs to be recompiled and selecting 'Build From Here...'.

When I discovered the 'Project Dependencies' feature in XE2 I thought this would be the solution to this problem.

* EDIT *

Ok. I will try to explain this a little bit better, as I see my question/concern is not really coming through.

I have a groupproject which consists of many BPL projects (which as far as I understand output a DLL) and one executable project: C.exe.

C.exe references all the BPL projects, including A.BPL and B.BPL. Now if I modify the code in any of the BPL projects and just execute 'Run' C.exe will launch but the changes I just did will not take effect as the BPL projects were not recompiled. This is actually my pain point. All IDE's I have used so far would also recompile the dependent dll's. Of course, assuming the project is setup properly. And now to my question. I do not know if the project is just not setup properly or if this is a limitation of the IDE. If I right click on the modified BPL project and select 'Compile From Here' and then execute 'Run' my changes will take effect. However it is quite annoying to have to do this, when I am so accustomed to just running the executable without having to worry about recompiling dependencies.

As described above I did try using the 'Dependencies' feature of the IDE. However the behavior is very odd (to me). It will recompile dependencies even when their source code was not modified.

3

3 Answers

4
votes

Your expectations are wrong. The documentation says:

Project > Dependencies

Creates project dependencies within a project group. From the list, choose the projects to build before building the selected project.

The behaviour you see is intended.

2
votes

First, you say "F5 (run)". It is F9...

Second, you can have a time problem on your system. The DCUs are touched by a process or something similar is happening.

Third, you can mess up the directories. You have:

Tools|Options
Environment Options|Delphi Options|Library-Win32
    (1) "Library Path:" Edit Box
    (2) "Debug DCU Path:" Edit Box

Also, open Your Project

Project | Options
Directories/Conditionals
(3) Search Path: Edit Box

See if you have some problems there. Also, try to delete ALL the DCUs from everywhere (see also Temp directories etc.). Also, if you have DPKs, BPLs aso. try to 'hide' them by creating a subfolder called 'hidden' (or whatever). After this, if needed, fix the (output) directory structure of the projects A, B and C and do a fresh build for everything. After this, see if the problem persists.

Fourth, you can have an unit which is used both in C and A. If you change it "for the project C", of course that it will trigger a rebuild for A.

Good luck.

1
votes

For projects with complex build dependencies, I often simply make an external build script and build things in an order that is known to work. That is to say, rather than working purely from the IDE, I simply go to a command prompt and type build and a batch file (build.cmd) that I have written, takes care of cleaning up previous DCUs, running msbuild several times to build all the things I need built, and in that way I have repeatable easy to build products.

When developing on one of those projects, I might work for a while in the IDE, but I always return to command line builds for these cases.

Delphi IDE's dependency system is a sad little hack. A command line build isn't a true C style make system, when Delphi is involved, it's more of a brute-force full-rebuild-each-time solution. However, as that's what continuous integration (when run on a server) usually does anyways, and as you can run such a command line build while you keep working away on another project, I find it a workable way to "not have to worry about dependency issues and build orders anymore", which is my underlying issue.