Fix #1, +AdaYaml

This commit is contained in:
Alejandro R Mosteo
2018-03-20 19:18:04 +01:00
parent e23754b3d1
commit dc993d232b
19 changed files with 180 additions and 146 deletions
+9 -10
View File
@@ -1,7 +1,8 @@
with Ada.Containers.Ordered_Maps;
with Ada.Directories;
with Ada.Strings.Maps;
with Gnat.OS_Lib;
package body Alire.Index is
use all type Version;
@@ -173,15 +174,13 @@ package body Alire.Index is
function To_Native (Path : Platform_Independent_Path) return String is
use Ada.Strings.Maps;
begin
for I in Path'Range loop
if Is_In (Path (I), Dir_Seps) then
return Ada.Directories.Compose
(Path (Path'First .. I - 1),
To_Native (Path (I + 1 .. Path'Last)));
end if;
end loop;
return Path;
return Native : String := Path do
for I in Native'Range loop
if Is_In (Path (I), Dir_Seps) then
Native (I) := GNAT.OS_Lib.Directory_Separator;
end if;
end loop;
end return;
end To_Native;
-----------
+7 -9
View File
@@ -234,13 +234,12 @@ package Alire.Index is
function Comment is new PL.Cond_New_Label (Properties.Labeled.Comment);
function Executable is new PL.Cond_New_Label (Properties.Labeled.Executable);
function Maintainer is new PL.Cond_New_Label (Properties.Labeled.Maintainer);
function Project_File is new PL.Cond_New_Label (Properties.Labeled.Project_File);
function Website is new PL.Cond_New_Label (Properties.Labeled.Website);
function U (Prop : Properties.Vector) return Conditional.Properties
renames Conditional.For_Properties.New_Value;
-- Non-label attributes require a custom builder function
-- Non-label attributes or processed data require a custom builder function
function GPR_Free_Scenario (Name : String) return Properties.Vector is (+Properties.Scenarios.New_Property (GPR.Free_Variable (Name)));
function GPR_Free_Scenario (Name : String) return Conditional.Properties is (U (GPR_Free_Scenario (Name)));
@@ -250,6 +249,9 @@ package Alire.Index is
function License (L : Licensing.Licenses) return Properties.Vector is (+Properties.Licenses.Values.New_Property (L));
function License (L : Licensing.Licenses) return Conditional.Properties is (U (License (L)));
function Project_File (File : Platform_Independent_Path) return Release_Properties;
-- Concatenate
function "and" (L, R : Release_Properties) return Release_Properties
renames Conditional.For_Properties."and";
@@ -260,9 +262,6 @@ package Alire.Index is
function GPR_External (Name : String; Value : String) return Conditional.Properties is
(U (+Properties.Scenarios.New_Property (GPR.External_Value (Name, Value))));
function GPR_File (File : Platform_Independent_Path) return Release_Properties;
function GPR_Path (Path : Platform_Independent_Path) return Release_Properties;
------------------
-- REQUISITES --
@@ -349,11 +348,10 @@ private
function Name (C : Catalog_Entry) return Projects.Names is (C.Name);
function GPR_File_Unsafe is new PL.Cond_New_Label (Properties.Labeled.GPR_File);
function GPR_Path_Unsafe is new PL.Cond_New_Label (Properties.Labeled.GPR_Path);
function Project_File_Unsafe is new PL.Cond_New_Label (Properties.Labeled.Project_File);
function GPR_File (File : Platform_Independent_Path) return Release_Properties renames GPR_File_Unsafe;
function GPR_Path (Path : Platform_Independent_Path) return Release_Properties renames GPR_Path_Unsafe;
function Project_File (File : Platform_Independent_Path) return Release_Properties is
(Project_File_Unsafe (To_Native (File)));
function Unavailable return Conditional.Dependencies is
(Conditional.For_Dependencies.New_Value -- A conditional (without condition) dependency vector
+2 -7
View File
@@ -12,13 +12,8 @@ package Alire.Properties.Labeled with Preelaborate is
Description, -- One-liner description, so it is searched too
Executable, -- A resulting executable built by the project
Maintainer, -- Info about the maintainer of the alr-packaged project
Project_File,-- GPR files that the user can use. No path. Search paths given with GPR_Path
Website, -- A website other than the repository
-- internal labels
GPR_File, -- Alternative naming of the project file (or aditional ones)
-- Those are used when testing the build, and must include full relative path
GPR_Path -- Extra path to add to the environment to look for projects
Project_File,-- Buildable project files in the release, with full relative path
Website -- A website other than the repository
);
type Label (<>) is new Properties.Property with private;
+46 -23
View File
@@ -62,36 +62,59 @@ package body Alire.Releases is
end return;
end Executables;
---------------
-- GPR_Files --
---------------
function GPR_Files (R : Release;
P : Properties.Vector)
return Utils.String_Vector is
begin
return Files : Utils.String_Vector := Values (R.All_Properties.Evaluate (P), GPR_File) do
if Files.Is_Empty then
Files.Append (R.Project & ".gpr");
end if;
end return;
end GPR_Files;
-------------------
-- Project_Files --
-------------------
function Project_Files (R : Release;
P : Properties.Vector)
return Utils.String_Vector is
function Project_Files (R : Release;
P : Properties.Vector;
With_Path : Boolean)
return Utils.String_Vector
is
use Utils;
With_Paths : Utils.String_Vector := Values (R.All_Properties.Evaluate (P), Project_File);
Without : Utils.String_Vector;
begin
return Files : Utils.String_Vector := Values (R.All_Properties.Evaluate (P), Project_File) do
if Files.Is_Empty then
Files.Append (R.Project & ".gpr");
end if;
end return;
if With_Paths.Is_Empty then
With_Paths.Append (String'(R.Project & ".gpr"));
end if;
if With_Path then
return With_Paths;
else
for File of With_Paths loop
-- Has path or not
if Tail (File, '/') = "" then
Without.Append (File); -- As is
else
Without.Append (Tail (File, '/'));
end if;
end loop;
return Without;
end if;
end Project_Files;
-------------------
-- Project_Paths --
-------------------
function Project_Paths (R : Release;
P : Properties.Vector) return Utils.String_Set
is
use Utils;
Files : constant String_Vector := Project_Files (R, P, With_Path => True);
begin
return Paths : String_Set do
for File of Files loop
if Contains (File, "/") then
Paths.Include (Head (File, '/'));
end if;
end loop;
end return;
end Project_Paths;
------------------------
-- Labeled_Properties --
------------------------
+7 -10
View File
@@ -58,18 +58,15 @@ package Alire.Releases with Preelaborate is
-- Only explicity declared ones
-- Under some conditions (usually current platform)
function GPR_Files (R : Release;
P : Properties.Vector)
return Utils.String_Vector;
-- Explicitly declared ones, or default one if none declared
-- Under some conditions (usually current platform)
-- These have full paths to their exact location
function Project_Paths (R : Release;
P : Properties.Vector) return Utils.String_Set;
-- Deduced from Project_Files
function Project_Files (R : Release;
P : Properties.Vector)
function Project_Files (R : Release;
P : Properties.Vector;
With_Path : Boolean)
return Utils.String_Vector;
-- Informative ones, usable by anyone with-ing the library. May be anywhere in the given GPR_Path-s.
-- Only a basename without path.
-- with relative path on demand
function Image (R : Release) return Folder_String;
-- Unique string built as name_version_id
+4
View File
@@ -1,3 +1,4 @@
with Ada.Containers.Indefinite_Ordered_Sets;
with Ada.Containers.Indefinite_Vectors;
package Alire.Utils with Preelaborate is
@@ -23,6 +24,9 @@ package Alire.Utils with Preelaborate is
When_Empty : String := "(empty)";
function Image_One_Line (V : Vector) return String;
package String_Sets is new Ada.Containers.Indefinite_Ordered_Sets (String);
type String_Set is new String_Sets.Set with null record;
--------------------
-- String_Vectors --
--------------------