A project file may contain `packages', that group attributes (typically all the attributes that are used by one of the GNAT tools).
A package with a given name may only appear once in a project file. The following packages are currently supported in project files (See Attributes for the list of attributes that each can contain).
This package specifies the naming conventions that apply to the source files in a project. In particular, these conventions are used to automatically find all source files in the source directories, or given a file name to find out its language for proper processing. See Naming Schemes.
In its simplest form, a package may be empty:
project Simple is package Builder is end Builder; end Simple;
A package may contain `attribute declarations', `variable declarations' and `case constructions', as will be described below.
When there is ambiguity between a project name and a package name, the name always designates the project. To avoid possible confusion, it is always a good idea to avoid naming a project with one of the names allowed for packages or any name that starts with gnat.
A package can also be defined by a `renaming declaration'. The new package renames a package declared in a different project file, and has the same attributes as the package it renames. The name of the renamed package must be the same as the name of the renaming package. The project must contain a package declaration with this name, and the project must appear in the context clause of the current project, or be its parent project. It is not possible to add or override attributes to the renaming project. If you need to do so, you should use an `extending declaration' (see below).
Packages that are renamed in other project files often come from project files that have no sources: they are just used as templates. Any modification in the template will be reflected automatically in all the project files that rename a package from the template. This is a very common way to share settings between projects.
Finally, a package can also be defined by an `extending declaration'. This is similar to a `renaming declaration', except that it is possible to add or override attributes.
package_declaration ::= package_spec | package_renaming | package_extension package_spec ::= package <package_>simple_name is {simple_declarative_item} end package_identifier ; package_renaming ::== package <package_>simple_name renames <project_>simple_name.package_identifier ; package_extension ::== package <package_>simple_name extends <project_>simple_name.package_identifier is {simple_declarative_item} end package_identifier ;