Saturday, March 14, 2020

Which Delphi Files to Store in a Source Control System

Which Delphi Files to Store in a Source Control System Delphi employs a number of files for its configuration, some global to the Delphi environment, some project specific. Various tools in the Delphi IDE store data in files of other types. The following list describes the files and their filename extensions that Delphi creates for a typical stand-alone application, plus a dozen more. Also, get to know which Delphi generated files should be stored in a source control system. Delphi Project Specific .PAS - Delphi Source FilePAS should be stored in Source ControlIn Delphi, PAS files are always the source code to either a unit or a form. Unit source files contain most of the code in an application. The unit contains the source code for any event handlers attached to the events of the form or the components it contains. We may edit .pas files using Delphis code editor. Do not delete .pas files. .DCU - Delphi Compiled UnitA compiled unit (.pas) file. By default, the compiled version of each unit is stored in a separate binary-format file with the same name as the unit file, but with the extension .DCU (Delphi compiled unit). For example unit1.dcu contains the code and data declared in the unit1.pas file. When you rebuild a project, individual units are not recompiled unless their source (.PAS) files have changed since the last compilation, or their .DCU files cannot be found. Safely delete .dcu file because Delphi recreates it when you compile the application. .DFM - Delphi FormDFM should be stored in Source ControlThese files are always paired with .pas files. A DFM file contains the details (properties) of the objects contained in a form. It can be view as text by right clicking on the form and selecting view as text from the pop-up menu. Delphi copies information in .dfm files into the finished .exe code file. Caution should be used in altering this file as changes to it could prevent the IDE from being able to load the form. Form files can be saved in either binary or text format. The Environment Options dialog lets you indicate which format you want to use for newly created forms. Do not delete .dfm files. .DPR - Delphi ProjectDPR should be stored in Source ControlThe .DPR file is the central file to a Delphi project (one .dpr file per a project), actually a Pascal source file. It serves as the primary entry point for the executable. The DPR contains the references to the other files in the project and links forms with their associated units. Although we can modify the .DPR  file, we should not modify it manually. Do not delete .DPR files. .RES - Windows Resource FileA Windows resource file generated automatically by Delphi and required by the compilation process. This binary-format file contains the version info resource (if required) and the application’s main icon. The file may also contain other resources used within the application but these are preserved as is. .EXE - Application ExecutableThe first time we build an application or a standard dynamic-link library, the compiler produces a .DCU file for each new unit used in your project; all the .DCU files in your project are then linked to create a single .EXE (executable) or .DLL file. This binary-format file is the only one (in most cases) you have to distribute to your users. Safely delete your projects .exe file because Delphi recreates it when you compile the application. .~ - Delphi Backup FilesFiles with names ending in .~ (e.g. unit2.~pa) are backup copies of modified and saved files. Safely delete those files at any time, however, you might want to keep the for recovering damaged programming. .DLL - Application ExtensionCode for dynamic link library. A dynamic-link library (DLL) is a collection of routines that can be called by applications and by other DLLs. Like units, DLLs contain shareable code or resources. But a DLL is a separately compiled executable that is linked at runtime to the programs that use it. Do not delete a .DLL file unless you wrote it. Go see DLLs and Delphi for more information on programming. .DPK - Delphi PackageDPK should be stored in Source ControlThis file contains the source code for a package, which is most often a collection of multiple units. Package source files are similar to project files, but they are used to construct special dynamic-link libraries called packages. Do not delete .dpk files. .DCPThis binary image file consists of the actual compiled package. Symbol information and additional header information required by the IDE are all contained within the .DCP file. The IDE must have access to this file in order to build a project. Do not delete .DCP files. .BPL or .DPLThis is the actual design-time or run-time package. This file is a Windows DLL with Delphi-specific features integrated into it. This file is essential for the deployment of an application that uses a package. In version 4 and above this is Borland package library in version 3 its Delphi package library. See BPL vs. DLL for more information on programming with packages. The following list describes the files and their filename extensions that Delphi IDE creates for a typical stand-alone application   Ã‚  Ã‚  IDE Specific.BPG, .BDSGROUP - Borland Project Group (Borland Developer Studio Project Group)BPG should be stored in Source ControlCreate project groups to handle related projects at once. For example, you can create a project group that contains multiple executable files such as a .DLL and an .EXE. .DCRDCR should be stored in Source ControlDelphi component resource files contain a components icon as it appears on the VCL palette. We may use .dcr files when construction our own custom components. Do not delete .dpr files. .DOFDOF should be stored in Source ControlThis text file contains the current settings for project options, such as compiler and linker settings, directories, conditional directives, and command-line parameters. The only reason to delete .dof file is to revert to standard options for a project. .DSKThis text file stores information about the state of your project, such as which windows are open and what position they are in. This allows you to restore your project’s workspace whenever you reopen the Delphi project. .DROThis text file contains information about the object repository. Each entry in this file contains specific information about each available item in the object repository. .DMTThis proprietary binary file contains the shipped and user-defined menu templates information. .TLBThe file is a proprietary binary type library file. This file provides a way for identifying what types of objects and interfaces are available on an ActiveX server. Like a unit or a header file the .TLB serves as a repository for necessary symbol information for an application. .DEMThis text file contains some standard country-specific formats for a TMaskEdit component. The list of the file extensions you see when Developing with Delphi continues .... .CABThis is the file format that Delphi offers its users for web deployment. The cabinet format is an efficient way to package multiple files. .DBFiles with this extension are standard Paradox files. .DBFFiles with this extension are standard dBASE files. .GDBFiles with this extension are standard Interbase files. .DBIThis text file contains initialization information for the Database Explorer.   Ã‚  Ã‚  CautionNever delete files with names ending in .dfm, .dpr, or .pas, unless you want to throw away your project. These files contain the applications properties and source code. When backing up an application, these are the critical files to save.