Skip to content

Commit

Permalink
Merge branch 'fix_implicit_load_for_codepeer' into 'master'
Browse files Browse the repository at this point in the history
Adapt Load_Implicit_Project for codepeer case

Closes #38

See merge request eng/toolchain/gnatcoll-core!79
  • Loading branch information
fedor-rybin committed Mar 4, 2024
2 parents 324e98d + d0799ca commit 86609fa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/projects/gnatcoll-projects.adb
Original file line number Diff line number Diff line change
Expand Up @@ -9946,6 +9946,14 @@ package body GNATCOLL.Projects is
Gprbuild_Path : Filesystem_String_Access;
Project : Project_Node_Id;

Codepeer_Fallback : Boolean := False;

Codepeer_Infix : constant String :=
"libexec" &
Directory_Separator &
"codepeer" &
Directory_Separator;

Implicit_Project_File_Path : constant String :=
"share" &
Directory_Separator &
Expand All @@ -9961,12 +9969,19 @@ package body GNATCOLL.Projects is
Reset (Self, Env);

Gprbuild_Path := Locate_Exec_On_Path ("gprbuild");
if Gprbuild_Path = null then
Gprbuild_Path := Locate_Exec_On_Path ("codepeer-gprbuild");
Codepeer_Fallback := True;
end if;
if Gprbuild_Path = null then
Trace (Me, "Gprbuild not found on path");
return;
end if;
Project_File := Get_Parent (Create (Dir_Name (Gprbuild_Path.all)));
Project_File := Join (Project_File, +Implicit_Project_File_Path);
Project_File := Join
(Project_File,
+((if Codepeer_Fallback then Codepeer_Infix else "")
& Implicit_Project_File_Path));
Free (Gprbuild_Path);

if not Project_File.Is_Regular_File then
Expand Down

0 comments on commit 86609fa

Please sign in to comment.