Previous topic

15. Geometry: primitive geometric operations

Next topic

17. Refcount: Reference counting

16. Projects: manipulating gpr filesΒΆ

The package GNATCOLL.Projects provides an extensive interface to parse, manipulate and edit project files (.gpr files).

Although the interface is best used using the Ada05 notation, it is fully compatible with Ada95.

Here is a quick example on how to use the interface, although the spec file itself contains much more detailed information on all the subprograms related to the manipulation of project files:

with GNATCOLL.Projects; use GNATCOLL.Projects;
with GNATCOLL.VFS;      use GNATCOLL.VFS;

Tree  : Project_Tree;
Files : File_Array_Access;

Tree.Load (GNATCOLL.VFS.Create (+"path_to_project.gpr"));

--  List the source files for project and all imported projects

Files := Tree.Root_Project.Source_Files (Recursive => True);
for F in Files'Range loop
   Put_Line ("File is: " & Files (F).Display_Full_Name);
end loop;