AdaCore / AdaCore/gtkada

gtkada-gps.gpr project seems incorrect

Open
#37 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ada
Stars
110
Forks
22
PR merge metrics
No merged PRs in 30d

Description

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing gtkada/gtkada-gps.gpr with gtkada/gtk.gpr and reproduce the failure at Project.Load in the shown Analyze_Project entry point. Trace the INVALID_PROJECT raised while loading gtkada-gps.gpr; done means the project file loads successfully through this path without that exception.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.