Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtkada-gps.gpr project seems incorrect #37

Open
pjljvandelaar opened this issue Jul 14, 2021 · 0 comments
Open

gtkada-gps.gpr project seems incorrect #37

pjljvandelaar opened this issue Jul 14, 2021 · 0 comments

Comments

@pjljvandelaar
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant