Some additions to Root type

This commit is contained in:
Alejandro R Mosteo
2018-03-09 20:18:55 +01:00
parent 674bf29fec
commit e832543685
2 changed files with 16 additions and 15 deletions
+8 -6
View File
@@ -262,14 +262,16 @@ package Alire.Index is
------------
-- The root determines the starting point to look for dependencies
function Set (Project : Projects.Names;
Version : Semantic_Versioning.Version)
return Roots.Root renames Root.Set;
subtype Root is Roots.Root;
function Set_Root (Project : Projects.Names;
Version : Semantic_Versioning.Version)
return Roots.Root renames Alire.Root.Set;
-- All information will be taken from the indexed release
function Set (Project : Name_String;
Dependencies : Conditional.Dependencies)
return Roots.Root renames Root.Set;
function Set_Root (Project : Name_String;
Dependencies : Conditional.Dependencies)
return Roots.Root renames Alire.Root.Set;
-- An unindexed working copy
private
+8 -9
View File
@@ -1,9 +1,8 @@
with Alire.Conditional;
with Alire.Containers;
with Alire.OS_Lib;
with Alire.Releases;
with Semantic_Versioning;
package Alire.Roots is
-- Type used to encapsulate the information about the root release/working copy
@@ -16,11 +15,11 @@ package Alire.Roots is
Dependencies : Conditional.Dependencies := Conditional.For_Dependencies.Empty)
return Root;
function Default_Executable (R : Root) return String;
function Dependencies (R : Root) return Conditional.Dependencies;
function Is_Released (R : Root) return Boolean;
function Name (R : Root) return Name_String;
function Release (R : Root) return Releases.Release with Pre => R.Is_Released;
function Version (R : Root) return Semantic_Versioning.Version with Pre => R.Is_Released;
function Release (R : Root) return Releases.Release with Pre => R.Is_Released;
private
@@ -42,6 +41,11 @@ private
return Root is
(Name'Length, False, Name, Dependencies);
function Default_Executable (R : Root) return String is
(if R.Released
then R.Release.Constant_Reference.Default_Executable
else R.Name & OS_Lib.Exe_Suffix);
function Dependencies (R : Root) return Conditional.Dependencies is
(if R.Released
then R.Release.Constant_Reference.Depends
@@ -56,9 +60,4 @@ private
function Release (R : Root) return Releases.Release is (R.Release.Element);
function Version (R : Root) return Semantic_Versioning.Version is
(if R.Released
then R.Release.Constant_Reference.Version
else raise Constraint_Error with "Unreleased root");
end Alire.Roots;