Skip to content

Commit

Permalink
New warning for externally selected gnat
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Nov 12, 2023
1 parent 88f17ab commit 3c21b12
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
32 changes: 32 additions & 0 deletions src/alire/alire-solutions-diffs.adb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
with Alire.Origins;
with Alire.Toolchains;
with Alire.Utils.Tables;
with Alire.User_Pins;
with Alire.Utils.TTY;
Expand Down Expand Up @@ -389,6 +390,35 @@ package body Alire.Solutions.Diffs is
is
Table : Utils.Tables.Table;
Changed : Boolean := False;

procedure Warn_Unsatisfiable_GNAT_External is
begin
for Dep of This.Latter.All_Dependencies loop
if Dep.Crate = GNAT_Crate
and then not Dep.Is_Solved
and then Toolchains.Tool_Is_Configured (GNAT_Crate)
and then Toolchains.Tool_Milestone (GNAT_Crate).Crate
= GNAT_External_Crate
and then not Toolchains.Tool_Release (GNAT_Crate).Satisfies (Dep)
then
Trace.Log (Prefix, Level);
Trace.Log (Prefix & Icon (Missing)
& " The explicitly configured external compiler "
& Toolchains.Tool_Milestone (GNAT_Crate).TTY_Image);
Trace.Log (Prefix
& " cannot satisfy dependency in solution "
& Dep.As_Dependency.TTY_Image,
Log_Level);
Trace.Log (Prefix
& " You can select a different compiler for the "
& "workspace with");
Trace.Log (Prefix & " "
& TTY.Terminal ("alr toolchain --local --select"),
Log_Level);
end if;
end loop;
end Warn_Unsatisfiable_GNAT_External;

begin

-- Start with an empty line to separate from previous output
Expand Down Expand Up @@ -439,6 +469,8 @@ package body Alire.Solutions.Diffs is

if Changed then
Table.Print (Level);

Warn_Unsatisfiable_GNAT_External;
else
Trace.Log (Prefix & "No changes between former and new solution.",
Level);
Expand Down
4 changes: 3 additions & 1 deletion src/alire/alire-solver.adb
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,9 @@ package body Alire.Solver is

Check_Version_Pin;

elsif Index.Exists (Dep.Crate, Index_Query_Options) or else
elsif Index.Exists (Dep.Crate, Index_Query_Options)
or else Index.All_Crate_Aliases.Contains (Dep.Crate)
or else
not Index.Releases_Satisfying (Dep, Props,
Index_Query_Options).Is_Empty
then
Expand Down

0 comments on commit 3c21b12

Please sign in to comment.