Proper early elaboration at last
This commit is contained in:
+2
-4
@@ -30,11 +30,9 @@ package body Alire.Index is
|
||||
Requisites => Requisites,
|
||||
Native => Native)
|
||||
do
|
||||
if not Available_When.Is_Empty and then
|
||||
not Available_When.Check (Platform_Properties)
|
||||
if not Available_When.Is_Empty and Then not Available_When.Check (Platform_Properties)
|
||||
then
|
||||
Trace.Debug ("Release " & Rel.Milestone_Image &
|
||||
" requisites not met by platform");
|
||||
Trace.Debug ("Release " & Rel.Milestone_Image & " requisites not met by platform");
|
||||
return;
|
||||
end if;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
private with Alire_Early_Elaboration; pragma Unreferenced (Alire_Early_Elaboration);
|
||||
|
||||
with Alire.Containers;
|
||||
with Alire.Compilers;
|
||||
with Alire.Depends;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
with Alire; -- Kind of circularity here but somehow it slips past static GNAT rules??
|
||||
|
||||
with GNAT.Command_Line;
|
||||
with GNAT.OS_Lib;
|
||||
|
||||
with Simple_Logging;
|
||||
|
||||
package body Alire_Early_Elaboration is
|
||||
|
||||
----------------------------
|
||||
-- Early_Switch_Detection --
|
||||
----------------------------
|
||||
|
||||
procedure Early_Switch_Detection is
|
||||
use GNAT.Command_Line;
|
||||
|
||||
Config : Command_Line_Configuration;
|
||||
|
||||
begin
|
||||
Define_Switch (Config,
|
||||
Switch_Q'Access,
|
||||
"-q",
|
||||
Help => "Limit output to errors");
|
||||
Define_Switch (Config,
|
||||
Switch_V'Access,
|
||||
"-v",
|
||||
Help => "Be more verbose");
|
||||
|
||||
Define_Switch (Config,
|
||||
Switch_D'Access,
|
||||
"-d",
|
||||
Help => "Be even more verbose (including debug messages)");
|
||||
|
||||
Getopt (Config);
|
||||
|
||||
-- Exclusivity check
|
||||
if (Switch_D and Switch_V) or (Switch_D and Switch_Q) or (Switch_V and Switch_Q) then
|
||||
Alire.Trace.Info ("Ada Library Repository manager (alr)");
|
||||
Alire.Trace.Error ("Only one verbosity switch allowed (either -d, -v or -q)");
|
||||
GNAT.OS_Lib.OS_Exit (1);
|
||||
end if;
|
||||
|
||||
-- Level setting
|
||||
if Switch_D then
|
||||
Alire.Log_Level := Simple_Logging.Debug;
|
||||
elsif Switch_V then
|
||||
Alire.Log_Level := Simple_Logging.Detail;
|
||||
elsif Switch_Q then
|
||||
Alire.Log_Level := Simple_Logging.Error;
|
||||
end if;
|
||||
end Early_Switch_Detection;
|
||||
|
||||
begin
|
||||
Early_Switch_Detection;
|
||||
end Alire_Early_Elaboration;
|
||||
@@ -0,0 +1,13 @@
|
||||
package Alire_Early_Elaboration with Elaborate_Body is
|
||||
|
||||
-- This body should be elaborated among the first ones.
|
||||
-- For anything requiring early elaboration (e.g. logging setup)
|
||||
|
||||
-- Not directly a child of Alire to avoid circularity
|
||||
|
||||
Switch_D,
|
||||
Switch_Q,
|
||||
Switch_V : aliased Boolean := False;
|
||||
-- Verbosity switches detected during early elaboration
|
||||
|
||||
end Alire_Early_Elaboration;
|
||||
Reference in New Issue
Block a user