Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding files to the DPR file vs project paths in Delphi 2010

We are just migrating from D7 to D2010 and are having a debate about cleaning up the project paths. We have a number of directories with a large number of Pas files that are included on some project paths, but only a few of the files are actually used by any single project.

One option is to eliminate the project paths completely and only have all used files in the dpr.

The second option is to keep only the needed files in the dpr and have project paths to the directories for the rest of the files.

Is there any argument for one option over the other?

like image 551
Robert McCabe Avatar asked May 05 '10 21:05

Robert McCabe


2 Answers

Having all your units explicitly in the dpr immensely improves compilation time, code completion, error insight and general navigation.
It does not prevent you from keeping your files organized in folders and sub-folders, but just don't rely on the different paths to find them.
On a big project with millions LOC, it makes a huge difference.

like image 172
Francesca Avatar answered Oct 19 '22 07:10

Francesca


I'm in favor of separating "library units" from "project units" and keeping all "library units" in the search path, with all the "project units" in the project file. Here's why:

  • Our line-of-business projects are large, almost million-LOC type of projects, but besides those there are literally hundreds of smaller projects for all sorts of tiny little things. Having the "library units" available on the search path makes it really easy to just use those units without adding them to the project: One less step that adds up!
  • Using the search path makes moving PAS files around easier. This matters allot to me since I'm in the process of re-organizing our whole "build environment" to make better use of version control systems.
  • When you change one of the shared units and it becomes dependent on yet an other shared unit, you don't need to updates lots of projects, they just work.
  • I'd never consider adding third-party components (or VCL components) to my project, so why add my "library units" to the project? We need to draw the line somewhere, because if we'd add absolutely all files to the project hoping for faster compile times we'd end up with unmanageably large projects!
  • Delphi automatically changes the name of the files in it's DPR file to be relative file names. Because of this you can't really move your project from it's current position. Now try "branching" and keeping two copies of the project alive at the same time, on the same machine (a "release" and a "work-in-progress"). (this is me tring preparing my build enviroment for GIT, with the sole purpose of being able to BRANCH).

For reference, my "library units" are those units that are used in unrelated projects (think: components and utilities).

like image 26
Cosmin Prund Avatar answered Oct 19 '22 06:10

Cosmin Prund