Next: , Previous: Importing Projects, Up: GNAT Project Manager


11.6 Project Extension

During development of a large system, it is sometimes necessary to use modified versions of some of the source files, without changing the original sources. This can be achieved through the project extension facility.

        project Modified_Utilities extends "/baseline/utilities.gpr" is ...

A project extension declaration introduces an extending project (the child) and a project being extended (the parent).

By default, a child project inherits all the sources of its parent. However, inherited sources can be overridden: a unit in a parent is hidden by a unit of the same name in the child.

Inherited sources are considered to be sources (but not immediate sources) of the child project; see Project File Syntax.

An inherited source file retains any switches specified in the parent project.

For example if the project Utilities contains the specification and the body of an Ada package Util_IO, then the project Modified_Utilities can contain a new body for package Util_IO. The original body of Util_IO will not be considered in program builds. However, the package specification will still be found in the project Utilities.

A child project can have only one parent but it may import any number of other projects.

A project is not allowed to import directly or indirectly at the same time a child project and any of its ancestors.