diff --git a/index/alire-index-example_dependencies.ads b/index/alire-index-example_dependencies.ads index 0dac94c5..21bea481 100644 --- a/index/alire-index-example_dependencies.ads +++ b/index/alire-index-example_dependencies.ads @@ -3,12 +3,12 @@ with Alire.Origins; package Alire.Index.Example_Dependencies is V_1_0_0 : constant Release := - Register ("example_dependencies", + Register ("alr_example_dependencies", V ("1.0.0"), "Release with assorted advanced dependency conditions", Origins.New_Filesystem ("/fake"), Available_When => -- Impossible mix (System_Is (Windows) and System_Is (GNU_Linux)) or - (Compiler_Is_At_Least (GNAT_Any) and not Compiler_Is_At_Least (GNAT_Any))); + (Compiler_Is_At_Least (GNAT_Unknown) and not Compiler_Is_At_Least (GNAT_Unknown))); end Alire.Index.Example_Dependencies; diff --git a/src/alire-compilers.ads b/src/alire-compilers.ads deleted file mode 100644 index 47c3b16e..00000000 --- a/src/alire-compilers.ads +++ /dev/null @@ -1,24 +0,0 @@ -private with Ada.Strings.Fixed; -private with GNAT.Compiler_Version; - -package Alire.Compilers with Preelaborate is - - -- Known compilers - type Compilers is (GNAT_Any, - GNAT_FSF_7_2, - GNAT_GPL_2017); - - function Compiler return Compilers; - -private - - use Ada.Strings.Fixed; - - package GNAT_Version is new GNAT.Compiler_Version; - - function Compiler return Compilers is - (if Index (GNAT_Version.Version, "2017") > 0 then GNAT_GPL_2017 - elsif Index (GNAT_Version.Version, "7.2") > 0 then GNAT_FSF_7_2 - else GNAT_Any); - -end Alire.Compilers; diff --git a/src/alire-index.adb b/src/alire-index.adb index d34071dc..36d482df 100644 --- a/src/alire-index.adb +++ b/src/alire-index.adb @@ -1,10 +1,5 @@ -with Alire.Properties.Platform; - package body Alire.Index is - Platform_Properties : constant Properties.Vector := - Properties.Platform.Current; - -------------- -- Register -- -------------- @@ -16,8 +11,7 @@ package body Alire.Index is Depends_On : Dependencies := No_Dependencies; Properties : Alire.Properties.Vector := No_Properties; Requisites : Alire.Requisites.Tree := No_Requisites; - Available_When : Alire.Requisites.Tree := No_Requisites; - Native : Boolean := False) return Release + Available_When : Alire.Requisites.Tree := No_Requisites) return Release is begin return Rel : constant Alire.Releases.Release := @@ -28,16 +22,10 @@ package body Alire.Index is Depends_On, Properties => Properties, Requisites => Requisites, - Native => Native) + Available => Available_When) do - 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"); - return; - end if; - if Releases.Contains (Rel) then - Log ("Attempt to register duplicate versions: " & Rel.Milestone_Image, Warning); + Log ("Attempt to register duplicate versions: " & Rel.Milestone.Image, Warning); else Releases.Insert (Rel); end if; diff --git a/src/alire-index.ads b/src/alire-index.ads index 6bd595bb..9a5f1137 100644 --- a/src/alire-index.ads +++ b/src/alire-index.ads @@ -3,12 +3,11 @@ private with Alire_Early_Elaboration; pragma Unreferenced (Alire_Early_Elaborati with Ada.Directories; with Alire.Containers; -with Alire.Compilers; with Alire.Dependencies.Vectors; with Alire.GPR; with Alire.Licensing; -with Alire.Operating_Systems; with Alire.Origins; +with Alire.Platforms; with Alire.Properties; with Alire.Properties.Labeled; with Alire.Properties.Licenses; @@ -41,8 +40,7 @@ package Alire.Index is Depends_On : Dependencies := No_Dependencies; Properties : Alire.Properties.Vector := No_Properties; Requisites : Alire.Requisites.Tree := No_Requisites; - Available_When : Alire.Requisites.Tree := No_Requisites; - Native : Boolean := False) return Release; + Available_When : Alire.Requisites.Tree := No_Requisites) return Release; -- Properties are of the Release -- Requisites are properties that dependencies have to fulfill, not used yet. -- Available_On are properties the platform has to fulfill. @@ -90,11 +88,11 @@ package Alire.Index is -- Shortcuts for properties/requisites: use all type Alire.Dependencies.Vectors.Vector; - use all type Compilers.Compilers; use all type GPR.Value; use all type GPR.Value_Vector; use all type Licensing.Licenses; - use all type Operating_Systems.Operating_Systems; + use all type Platforms.Compilers; + use all type Platforms.Operating_Systems; use all type Properties.Property'Class; use all type Requisites.Requisite'Class; use all type Requisites.Tree; @@ -125,10 +123,10 @@ package Alire.Index is -- Specific shortcuts: - function Compiler_Is_At_Least (V : Compilers.Compilers) return Requisites.Requisite'Class + function Compiler_Is_At_Least (V : Platforms.Compilers) return Requisites.Requisite'Class renames Requisites.Platform.Compiler_Is_At_Least; - function System_is (V : Operating_Systems.Operating_Systems) return Requisites.Requisite'Class + function System_is (V : Platforms.Operating_Systems) return Requisites.Requisite'Class renames Requisites.Platform.System_Is; -- Other useful functions diff --git a/src/alire-operating_systems.ads b/src/alire-operating_systems.ads deleted file mode 100644 index e39c2058..00000000 --- a/src/alire-operating_systems.ads +++ /dev/null @@ -1,8 +0,0 @@ -package Alire.Operating_Systems with Preelaborate is - - type Operating_Systems is (GNU_Linux, Windows); - - Current : constant Operating_Systems := GNU_Linux; - -- Until this is ported elswhere - -end Alire.Operating_Systems; diff --git a/src/alire-platforms.ads b/src/alire-platforms.ads new file mode 100644 index 00000000..dedf2662 --- /dev/null +++ b/src/alire-platforms.ads @@ -0,0 +1,12 @@ +package Alire.Platforms with Preelaborate is + + -- Platform information necessary for some releases + + type Compilers is (GNAT_Unknown, + GNAT_FSF_7_2, + GNAT_GPL_2017); + + type Operating_Systems is (GNU_Linux, + Windows); + +end Alire.Platforms; diff --git a/src/alire-properties-platform.ads b/src/alire-properties-platform.ads index 754e20a2..6c5fe406 100644 --- a/src/alire-properties-platform.ads +++ b/src/alire-properties-platform.ads @@ -1,25 +1,25 @@ -with Alire.Compilers; -with Alire.Operating_Systems; +with Alire.Platforms; package Alire.Properties.Platform with Preelaborate is - package Compilers is new Values (Alire.Compilers.Compilers, - Alire.Compilers.Compilers'IMage); - package Operating_Systems is new Values (Alire.Operating_Systems.Operating_Systems, - Alire.Operating_Systems.Operating_Systems'Image); + package Compilers is new Values (Platforms.Compilers, + Platforms.Compilers'IMage); + package Operating_Systems is new Values (Platforms.Operating_Systems, + Platforms.Operating_Systems'Image); - function Current return Properties.Vector; +-- function Current return Vector; + -- FIXME this will eventually have to go into Alr private - function System_Is (V : Alire.Operating_Systems.Operating_Systems) return Properties.Vector is + function System_Is (V : Platforms.Operating_Systems) return Vector is (+Operating_Systems.New_Property (V)); - function Compiler_Is (C : Alire.Compilers.Compilers) return Properties.Vector is + function Compiler_Is (C : Platforms.Compilers) return Vector is (+Compilers.New_Property (C)); - function Current return Properties.Vector is - (Compiler_Is (Alire.Compilers.Compiler) and - System_Is (Alire.Operating_Systems.Current)); +-- function Current return Vector is +-- (Compiler_Is (Alire.Compilers.Compiler) and +-- System_Is (Alire.Operating_Systems.Current)); end Alire.Properties.Platform; diff --git a/src/alire-query.adb b/src/alire-query.adb index 24b20d0d..10ebdcb3 100644 --- a/src/alire-query.adb +++ b/src/alire-query.adb @@ -108,7 +108,7 @@ package body Alire.Query is use Containers.Project_Release_Maps; begin for Rel of I loop - Log (" " & Rel.Milestone_Image, Debug); + Log (" " & Rel.Milestone.Image, Debug); end loop; end Print_Solution; diff --git a/src/alire-releases.adb b/src/alire-releases.adb index e5635d72..5aa5a0d8 100644 --- a/src/alire-releases.adb +++ b/src/alire-releases.adb @@ -62,7 +62,7 @@ package body Alire.Releases is use GNAT.IO; begin -- MILESTONE - Put_Line (R.Milestone_Image & ": " & R.Description); + Put_Line (R.Milestone.Image & ": " & R.Description); -- ORIGIN Put_Line ("Origin: " & R.Origin.Image); diff --git a/src/alire-releases.ads b/src/alire-releases.ads index 6d32dad3..188673d2 100644 --- a/src/alire-releases.ads +++ b/src/alire-releases.ads @@ -23,7 +23,7 @@ package Alire.Releases with Preelaborate is Depends_On : Dependencies; Properties : Alire.Properties.Vector; Requisites : Alire.Requisites.Tree; - Native : Boolean) return Release; + Available : Alire.Requisites.Tree) return Release; function "<" (L, R : Release) return Boolean; @@ -32,7 +32,7 @@ package Alire.Releases with Preelaborate is function Version (R : Release) return Semantic_Versioning.Version; function Depends (R : Release) return Dependencies; function Origin (R : Release) return Origins.Origin; --- function Origin_Image (R : Release) return String; + function Available (R : Release) return Requisites.Tree; function Default_Executable (R : Release) return String; -- We encapsulate here the fixing of platform extension @@ -49,12 +49,6 @@ package Alire.Releases with Preelaborate is function Milestone (R : Release) return Milestones.Milestone; - function Milestone_Image (R : Release) return String; - -- project=version string - - function Is_Native (R : Release) return Boolean; - -- not alr packaged but from the platform - procedure Print (R : Release); -- Dump info to console @@ -69,14 +63,14 @@ private function Describe is new Properties.Labeled.Generic_New_Label (Properties.Labeled.Description); type Release (Name_Len, Descr_Len : Natural) is tagged record - Name : Project_Name (1 .. Name_Len); - Description: Project_Description (1 .. Descr_Len); + Name : Project_Name (1 .. Name_Len); + Description : Project_Description (1 .. Descr_Len); Version : Semantic_Versioning.Version; - Origin : Origins.Origin; - Depends_On : Dependencies; - Props : Properties.Vector; - Reqs : Requisites.Tree; - Native : Boolean; + Origin : Origins.Origin; + Depends_On : Dependencies; + Props : Properties.Vector; + Reqs : Requisites.Tree; + Available : Requisites.Tree; end record; function New_Release (Name : Project_Name; @@ -86,7 +80,7 @@ private Depends_On : Dependencies; Properties : Alire.Properties.Vector; Requisites : Alire.Requisites.Tree; - Native : Boolean) return Release is + Available : Alire.Requisites.Tree) return Release is (Name'Length, Description'Length, Name, Description, @@ -95,7 +89,7 @@ private Depends_On, Properties and Describe (Description), Requisites, - Native); + Available); use Semantic_Versioning; @@ -112,6 +106,7 @@ private function Version (R : Release) return Semantic_Versioning.Version is (R.Version); function Depends (R : Release) return Dependencies is (R.Depends_On); function Origin (R : Release) return Origins.Origin is (R.Origin); + function Available (R : Release) return Requisites.Tree is (R.Available); function Milestone (R : Release) return Milestones.Milestone is (Milestones.New_Milestone (R.Name, R.Version)); @@ -119,14 +114,10 @@ private function Default_Executable (R : Release) return String is (R.Name & OS_Lib.Exe_Suffix); - function Is_Native (R : Release) return Boolean is (R.Native); - function Image (R : Release) return Path_String is (R.Name & "_" & Image (R.Version) & "_" & (if R.Origin.Id'Length <= 8 then R.Origin.Id else R.Origin.Id (R.Origin.Id'First .. R.Origin.Id'First + 7))); - function Milestone_Image (R : Release) return String is (R.Milestone.Image); - end Alire.Releases; diff --git a/src/alire-requisites-platform.ads b/src/alire-requisites-platform.ads index 6bd78e62..27566a78 100644 --- a/src/alire-requisites-platform.ads +++ b/src/alire-requisites-platform.ads @@ -1,26 +1,25 @@ -with Alire.Compilers; +with Alire.Platforms; with Alire.Properties.Platform; -with Alire.Operating_Systems; package Alire.Requisites.Platform with Preelaborate is - function Compiler_Is_At_Least (V : Compilers.Compilers) return Requisites.Requisite'Class; + function Compiler_Is_At_Least (V : Platforms.Compilers) return Requisites.Requisite'Class; - function System_Is (V : Operating_Systems.Operating_Systems) return Requisites.Requisite'Class; + function System_Is (V : Platforms.Operating_Systems) return Requisites.Requisite'Class; private -- Preparation for OS requisites mimicking OS properties - use all type Compilers.Compilers; - use all type Operating_Systems.Operating_Systems; + use all type Platforms.Compilers; + use all type Platforms.Operating_Systems; package Props renames Alire.Properties.Platform; package System_Requisites is new Typed_Requisites (Props.Operating_Systems.Property'Class); type OS_Requisite is new System_Requisites.Requisite with record - Value : Operating_Systems.Operating_Systems; + Value : Platforms.Operating_Systems; end record; overriding function Is_Satisfied (R : OS_Requisite; @@ -31,7 +30,7 @@ private package Compiler_Requisites is new Typed_Requisites (Props.Compilers.Property'Class); type Compiler_Requisite is new Compiler_Requisites.Requisite with record - Value : Compilers.Compilers; + Value : Platforms.Compilers; end record; overriding function Is_Satisfied (R : Compiler_Requisite; @@ -42,14 +41,14 @@ private -- Compiler_Is_At_Least -- -------------------------- - function Compiler_Is_At_Least (V : Compilers.Compilers) return Requisites.Requisite'Class is + function Compiler_Is_At_Least (V : Platforms.Compilers) return Requisites.Requisite'Class is (Compiler_Requisite'(Value => V)); --------------- -- System_Is -- --------------- - function System_Is (V : Operating_Systems.Operating_Systems) return Requisites.Requisite'Class is + function System_Is (V : Platforms.Operating_Systems) return Requisites.Requisite'Class is (OS_Requisite'(Value => V)); end Alire.Requisites.Platform; diff --git a/src/alire-root_project.adb b/src/alire-root_project.adb index 76d7191a..de03edfe 100644 --- a/src/alire-root_project.adb +++ b/src/alire-root_project.adb @@ -48,7 +48,7 @@ package body Alire.Root_Project is Depends_On, Properties => Properties, Requisites => Requisites.No_Requisites, - Native => False); + Available => Requisites.No_Requisites); begin if Query.Exists (Project, Version) then -- This is done to ensure that properties are all available