AdaCore/gtkada

gtkada-gps.gpr project seems incorrect

Opened this issue · 0 comments

I just cloned this git archive.
Using my libadalang program to analyze gtkada\gtk.gpr went fine.
However, analysis of gtkada\gtkada-gps.gpr resulted in


raised GNATCOLL.PROJECTS.INVALID_PROJECT : gnatcoll-projects.adb:7609

Unfortunately, the error message is quite limited, so I don't know what exactly goes wrong.

The relevant parts of the code that imports the project is equal to

with GNATCOLL.Projects;           use GNATCOLL.Projects;
with GNATCOLL.VFS;                use GNATCOLL.VFS;
with Libadalang.Project_Provider; use Libadalang.Project_Provider;
...
package Analysis_Units is new Ada.Containers.Vectors (Positive, Analysis_Unit, "=");
...
   function Is_Ada_File
     (Tree : Project_Tree_Access;
      File : Virtual_File)
      return Boolean
   is
      FI : constant File_Info := Tree.Info (Create (+File.Display_Full_Name));
   begin
      return FI.Language = "ada";
   end Is_Ada_File;

   function Analyze_Project
     (Project_Filename : String;
      Recursive : Boolean := True)
      return Analysis_Units.Vector
   is
      Project_File : constant Virtual_File := Create (+Project_Filename);
      Env : Project_Environment_Access;
      Project : constant Project_Tree_Access := new Project_Tree;
   begin
      Initialize (Env);
      Project.Load (Project_File, Env);
      declare
         Provider : constant Unit_Provider_Reference :=
           Create_Project_Unit_Provider (Project, Project.Root_Project, Env);
         Context : constant Analysis_Context :=
           Create_Context (Unit_Provider => Provider);
         Results : Analysis_Units.Vector;
      begin
         for File of Project.Root_Project.Source_Files (Recursive => Recursive,
                                                        Include_Externally_Built => False).all loop
            if Is_Ada_File (Project, File) then
               Results.Append (Analyze_File_In_Context (+File.Full_Name, Context));
            end if;
         end loop;
         return Results;
      end;
   end Analyze_Project;

and called as follows

   Units : constant Analysis_Units.Vector :=
     -- Analyze_Project ("C:\AdaCore\gtkada\gtk.gpr");  -- goes fine
        Analyze_Project ("C:\AdaCore\gtkada\gtkada-gps.gpr");    -- raises an exception

Hopes this helps to make the gtkada-gps.gpr project correct!