Preparation to generalized version restrictions

This commit is contained in:
Jano at Zelda
2018-02-16 12:00:55 +01:00
parent 01db1970af
commit 724359c0d1
2 changed files with 44 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
package Alire.Properties.Versions with Preelaborate is
-- Internally we manage versions as a tree of conditions, so arbitrary logical expressions can be used
package Values is new Properties.values (Semantic_Versioning.Version);
function New_Version (V : Semantic_Versioning.Version) return Property'Class is
(Values.New_Property (V));
end Alire.Properties.Versions;
+34
View File
@@ -0,0 +1,34 @@
with Alire.Properties.Versions;
package Alire.Requisites.Versions with Preelaborate is
package Semver renames Semantic_Versioning;
function Exactly (V : Semver.Version) return Requisite'Class;
private
package Props renames Alire.Properties.Versions;
package Version_Requisites is new Typed_Requisites (Props.Values.Property'Class);
type Version_Requisite is new Version_Requisites.Requisite with record
Set : Semver.Version_Set;
end record;
------------------
-- Is_Satisfied --
------------------
overriding function Is_Satisfied (R : Version_Requisite;
P : Props.Values.Property'Class) return Boolean is
(Semver.Is_In (V => P.Element, VS => R.Set));
-------------
-- Exactly --
-------------
function Exactly (V : Semver.Version) return Requisite'Class is
(Version_Requisite'(Set => Semver.Exactly (V)));
end Alire.Requisites.Versions;