Towards platform properties
This commit is contained in:
@@ -7,10 +7,8 @@ package Alire.Index.Example_Dependencies is
|
||||
V ("1.0.0"),
|
||||
Repositories.Local.Repo,
|
||||
Repositories.Local.Local_Id,
|
||||
Properties => Default_Properties and Available_On (GNU_Linux),
|
||||
Requisites => Available_On (GNU_Linux) or not Available_On (GNU_Linux)
|
||||
-- No_Requisites and
|
||||
-- (Available_On (GNU_Linux) or not Available_On (GNU_Linux)));
|
||||
Requisites => Available_On (GNU_Linux) and
|
||||
(Available_On (GNU_Linux) or not Available_On (GNU_Linux))
|
||||
-- Compiles_With (GNAT_GPL_2017)));
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
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;
|
||||
@@ -14,10 +14,6 @@ package body Alire.Index is
|
||||
Native : Boolean := False) return Release
|
||||
is
|
||||
begin
|
||||
if not Requisites.Is_Empty then
|
||||
Alire.Requisites.Trees.Print_Skeleton (Requisites);
|
||||
end if;
|
||||
|
||||
return Rel : constant Alire.Releases.Release :=
|
||||
Alire.Releases.New_Release (Project,
|
||||
Version,
|
||||
|
||||
+29
-28
@@ -1,8 +1,8 @@
|
||||
with Alire.Containers;
|
||||
with Alire.Compilers;
|
||||
with Alire.Depends;
|
||||
with Alire.Platform;
|
||||
with Alire.Operating_Systems;
|
||||
with Alire.Properties;
|
||||
with Alire.Properties.Platform;
|
||||
with Alire.Releases;
|
||||
with Alire.Repositories.Git;
|
||||
with Alire.Requisites;
|
||||
@@ -12,29 +12,30 @@ with Semantic_Versioning;
|
||||
|
||||
package Alire.Index is
|
||||
|
||||
Releases : Containers.Release_Set;
|
||||
Releases : Containers.Release_Set;
|
||||
|
||||
subtype Dependencies is Depends.Dependencies;
|
||||
use all type Dependencies;
|
||||
|
||||
subtype Release is Alire.Releases.Release;
|
||||
|
||||
subtype Solution is Containers.Version_Map; -- A dependence-valid mapping of project -> version
|
||||
subtype Instance is Containers.Release_Map; -- A list of releases complying with a Solution
|
||||
-- subtype Solution is Containers.Version_Map; -- A dependence-valid mapping of project -> version
|
||||
-- subtype Instance is Containers.Release_Map; -- A list of releases complying with a Solution
|
||||
|
||||
Empty_Instance : constant Instance := Containers.Project_Release_Maps.Empty_Map;
|
||||
-- Empty_Instance : constant Instance := Containers.Project_Release_Maps.Empty_Map;
|
||||
|
||||
function V (Semantic_Version : String) return Semantic_Versioning.Version
|
||||
renames Semantic_Versioning.New_Version;
|
||||
|
||||
function Register (Project : Project_Name;
|
||||
Version : Semantic_Versioning.Version;
|
||||
Hosting : Repositories.Repository'Class;
|
||||
Id : Repositories.Release_Id;
|
||||
Depends_On : Dependencies := Depends.Nothing;
|
||||
Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector;
|
||||
Requisites : Alire.Requisites.Tree := Alire.Requisites.No_Requisites;
|
||||
Native : Boolean := False) return Release;
|
||||
function Register (Project : Project_Name;
|
||||
Version : Semantic_Versioning.Version;
|
||||
Hosting : Repositories.Repository'Class;
|
||||
Id : Repositories.Release_Id;
|
||||
Depends_On : Dependencies := Depends.Nothing;
|
||||
Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector;
|
||||
Requisites : Alire.Requisites.Tree := Alire.Requisites.No_Requisites;
|
||||
Available_On : Alire.Requisites.Tree := Alire.Requisites.No_Requisites;
|
||||
Native : Boolean := False) return Release;
|
||||
-- Properties are of the Release; currently not used but could support License or other attributes.
|
||||
-- Requisites are properties that dependencies have to fulfill, again not used yet.
|
||||
-- Available_On are properties the platform has to fulfill; these are checked on registration.
|
||||
|
||||
function Register_Git (Project : Project_Name;
|
||||
Version : Semantic_Versioning.Version;
|
||||
@@ -45,6 +46,9 @@ package Alire.Index is
|
||||
Depends_On : Dependencies := Depends.Nothing) return Release;
|
||||
|
||||
-- Shortcuts to give dependencies:
|
||||
|
||||
function V (Semantic_Version : String) return Semantic_Versioning.Version
|
||||
renames Semantic_Versioning.New_Version;
|
||||
|
||||
function At_Least_Within_Major (R : Release) return Dependencies;
|
||||
|
||||
@@ -68,8 +72,8 @@ package Alire.Index is
|
||||
function Except (P : Project_Name; V : Version) return Dependencies;
|
||||
|
||||
-- Shortcuts for properties/requisites:
|
||||
use all type Platform.Compilers;
|
||||
use all type Platform.Operating_Systems;
|
||||
use all type Compilers.Compilers;
|
||||
use all type Operating_Systems.Operating_Systems;
|
||||
|
||||
use all type Properties.Property'Class; -- for "and" operator
|
||||
use all type Requisites.Requisite'Class;
|
||||
@@ -84,16 +88,13 @@ package Alire.Index is
|
||||
function Requires (R : Requisites.Requisite'Class) return Requisites.Tree;
|
||||
function "+" (R : Requisites.Requisite'Class) return Requisites.Tree renames Requires;
|
||||
|
||||
-- Specific shortcuts:
|
||||
-- Specific shortcuts:
|
||||
|
||||
function Compiler_Is (V : Compilers.Compilers) return Requisites.Requisite'Class
|
||||
renames Requisites.Platform.Compiler_Is;
|
||||
|
||||
function Available_On (V : Alire.Platform.Operating_Systems) return Properties.Property'Class
|
||||
renames Properties.Platform.Available_On;
|
||||
|
||||
function Compiles_With (C : Alire.Platform.Compilers) return Properties.Property'Class
|
||||
renames Properties.Platform.Compiles_With;
|
||||
|
||||
function Available_On (V : Alire.Platform.Operating_Systems) return Requisites.Requisite'Class
|
||||
renames Requisites.Platform.Available_On;
|
||||
function System_is (V : Operating_Systems.Operating_Systems) return Requisites.Requisite'Class
|
||||
renames Requisites.Platform.System_Is;
|
||||
|
||||
private
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
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;
|
||||
@@ -1,13 +1,3 @@
|
||||
package Alire.Platform with Preelaborate is
|
||||
|
||||
-- OSs supported by a release
|
||||
type Operating_Systems is (Cross_Platform,
|
||||
GNU_Linux,
|
||||
Windows);
|
||||
|
||||
-- Compilers known to compile a release
|
||||
type Compilers is (GNAT_Any,
|
||||
GNAT_FSF_7_2,
|
||||
GNAT_GPL_2017);
|
||||
|
||||
end Alire.Platform;
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
with Alire.Platform;
|
||||
with Alire.Compilers;
|
||||
with Alire.Operating_Systems;
|
||||
|
||||
package Alire.Properties.Platform with Preelaborate is
|
||||
|
||||
package Compilers is new Values (Alire.Platform.Compilers);
|
||||
package Operating_Systems is new Values (Alire.Platform.Operating_Systems);
|
||||
package Compilers is new Values (Alire.Compilers.Compilers);
|
||||
package Operating_Systems is new Values (Alire.Operating_Systems.Operating_Systems);
|
||||
|
||||
function Available_On (V : Alire.Platform.Operating_Systems) return Property'Class;
|
||||
|
||||
function Compiles_With (C : Alire.Platform.Compilers) return Property'Class;
|
||||
function Current return Properties.Vector;
|
||||
|
||||
private
|
||||
|
||||
function Available_On (V : Alire.Platform.Operating_Systems) return Property'Class is
|
||||
function System_Is (V : Alire.Operating_Systems.Operating_Systems) return Property'Class is
|
||||
(Operating_Systems.New_Property (V));
|
||||
|
||||
function Compiles_With (C : Alire.Platform.Compilers) return Property'Class is
|
||||
(Compilers.New_Property (C));
|
||||
function Compiler_Is (C : Alire.Compilers.Compilers) return Property'Class is
|
||||
(Compilers.New_Property (C));
|
||||
|
||||
function Current return Properties.Vector is
|
||||
(Compiler_Is (Alire.Compilers.Compiler) and
|
||||
System_Is (Alire.Operating_Systems.Current));
|
||||
|
||||
end Alire.Properties.Platform;
|
||||
|
||||
Reference in New Issue
Block a user