Skip to content

Commit

Permalink
Workaround for GNAT 13 troubles with expr. funcs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Feb 15, 2024
1 parent 359d475 commit 88def3b
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions src/alire/alire-roots-editable.adb
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ package body Alire.Roots.Editable is
-------------------------

function Pin_Is_Parent_Crate return Boolean
is (Directories.Find_Relative_Path_To (Path) = "..");
is
begin
return Directories.Find_Relative_Path_To (Path) = "..";
end Pin_Is_Parent_Crate;

begin
-- When adding a pin from a folder other than the root, notify about it.
Expand Down Expand Up @@ -297,14 +300,28 @@ package body Alire.Roots.Editable is
-- aesthetic, as pins will always override the version.

if not This.Solution.Depends_On (Crate) then
This.Add_Dependency
(Dependencies.New_Dependency
(Crate,
(if Pin_Root.Is_Valid and then not Pin_Is_Parent_Crate
then Pin_Root.Updatable_Dependency.Versions
else Semver.Extended.Any)),
Allow_Unknown => True);
-- Pins to local paths are more likely not to be indexed
declare
-- This temporary is used to work around a bug in GNAT 13
Dep_Ver : Semver.Extended.Version_Set;
begin
if Pin_Root.Is_Valid and then not Pin_Is_Parent_Crate then
declare
-- This temporary is used to work around a bug in GNAT 13
Updatable_Dep : constant Dependencies.Dependency
:= Pin_Root.Updatable_Dependency;
begin
Dep_Ver := Updatable_Dep.Versions;
end;
else
Dep_Ver := Semver.Extended.Any;
end if;

This.Add_Dependency
(Dependencies.New_Dependency (Crate, Dep_Ver),
Allow_Unknown => True);
-- Pins to local paths are more likely not to be indexed, so we
-- allow unknown dependencies here.
end;
end if;

-- Remove any previous pin for this crate
Expand Down

0 comments on commit 88def3b

Please sign in to comment.