diff --git a/src/alire-index.ads b/src/alire-index.ads index 01292a3b..0731fce0 100644 --- a/src/alire-index.ads +++ b/src/alire-index.ads @@ -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 diff --git a/src/alire-roots.ads b/src/alire-roots.ads index 8e177258..7a36df09 100644 --- a/src/alire-roots.ads +++ b/src/alire-roots.ads @@ -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;