Fixed master index building

This commit is contained in:
Alejandro R. Mosteo
2018-03-11 23:14:17 +01:00
parent e637c27bca
commit fe92837155
5 changed files with 82 additions and 70 deletions
Vendored
+1 -1
+55 -54
View File
@@ -23,68 +23,69 @@ package Alire.Index.Alire is
Windows_100 : Catalog_Entry;
-- A few fake release to spice descriptions a bit up.
Syntax_Example : constant Release := Example_Project.Register
(V ("1.0.0"),
Origins.New_Filesystem ("/alire"),
Dependencies =>
Half_Life_3.Current and -- unconditional
On_Condition -- conditional
(Operating_System = GNU_Linux,
When_True => Elite_Dangerous >= "2.0" and Star_Citizen >= V ("3.0"), -- Wish...
When_False => Windows_100 > V ("1.0")) and
When_Available -- Chained preferences
(Preferred => Within_Major (Alire.Project, V ("1.0")), -- as function
Otherwise => Alire.Project.Within_Major (V ("0.0"))) and -- or dot notation
When_Available -- Chained preferences
(Preferred => Alire.Project.Within_Major ("2.0"),
Otherwise => When_Available -- Chained preferences multi-level
(Preferred => Within_Major (Alire.Project, V ("1.0")),
Otherwise => Alire.Project.Within_Major ("0.5"))), -- V () is optional
Syntax_Example : constant Release :=
Example_Project.Register
(V ("1.0.0"),
Origins.New_Filesystem ("/alire"),
Dependencies =>
Half_Life_3.Current and -- unconditional
On_Condition -- conditional
(Operating_System = GNU_Linux,
When_True => Elite_Dangerous >= "2.0" and Star_Citizen >= V ("3.0"), -- Wish...
When_False => Windows_100 > V ("1.0")) and
When_Available -- Chained preferences
(Preferred => Within_Major (Alire.Project, V ("1.0")), -- as function
Otherwise => Alire.Project.Within_Major (V ("0.0"))) and -- or dot notation
When_Available -- Chained preferences
(Preferred => Alire.Project.Within_Major ("2.0"),
Otherwise => When_Available -- Chained preferences multi-level
(Preferred => Within_Major (Alire.Project, V ("1.0")),
Otherwise => Alire.Project.Within_Major ("0.5"))), -- V () is optional
Private_Properties => -- These are only interesting to alr, not users
GPR_External ("Profile", "False"),
-- Sample extra params for build
Private_Properties => -- These are only interesting to alr, not users
GPR_External ("Profile", "False"),
-- Sample extra params for build
Properties =>
GPR_Scenario ("Build", "Debug" or "Release") and
GPR_Free_Scenario ("Path_To_Something") and
-- Known scenario variables
Properties =>
GPR_Scenario ("Build", "Debug" or "Release") and
GPR_Free_Scenario ("Path_To_Something") and
-- Known scenario variables
GPR_File ("scenarios/catastrophical.gpr") and
-- Way to specify a project file not named like the project
-- Path separators are always "/" and internally converted to native ones
GPR_File ("scenarios/catastrophical.gpr") and
-- Way to specify a project file not named like the project
-- Path separators are always "/" and internally converted to native ones
On_Condition
(Operating_System = Windows,
GPR_File ("project_win.gpr")) and
On_Condition
(Operating_System = GNU_Linux,
On_Condition (Distribution = Ubuntu, -- Nested conditions
GPR_File ("project_ubuntu.gpr"))) and
-- Conditional project file
On_Condition
(Operating_System = Windows,
GPR_File ("project_win.gpr")) and
On_Condition
(Operating_System = GNU_Linux,
On_Condition (Distribution = Ubuntu, -- Nested conditions
GPR_File ("project_ubuntu.gpr"))) and
-- Conditional project file
On_Condition
(Operating_System = GNU_Linux,
Comment ("Long life the penguin")) and
-- Conditions on operating system
On_Condition
(Operating_System = GNU_Linux,
Comment ("Long life the penguin")) and
-- Conditions on operating system
On_Condition
(Compiler = GNAT_Unknown, -- /= also works
Comment ("Never saw that compiler") and Comment ("But I would like to")) and
-- Conditions on compiler version
On_Condition
(Compiler = GNAT_Unknown, -- /= also works
Comment ("Never saw that compiler") and Comment ("But I would like to")) and
-- Conditions on compiler version
On_Condition
(Distro_Release = Ubuntu_Artful,
When_True => Comment ("Living on the edge"),
When_False => Comment ("I am a rock")) and
-- Conditions on distribution release
On_Condition
(Distro_Release = Ubuntu_Artful,
When_True => Comment ("Living on the edge"),
When_False => Comment ("I am a rock")) and
-- Conditions on distribution release
Comment ("Tell me about your mother") and
Website ("http://www.www.www"),
-- Unconditional properties
Comment ("Tell me about your mother") and
Website ("http://www.www.www"),
-- Unconditional properties
Available_When => -- Impossible mix
(Operating_System = Windows and Operating_System /= GNU_Linux) or
(Compiler = GNAT_Unknown and Compiler /= GNAT_Unknown));
Available_When => -- Impossible mix
(Operating_System = Windows and Operating_System /= GNU_Linux) or
(Compiler = GNAT_Unknown and Compiler /= GNAT_Unknown));
end Alire.Index.Alire;
+1 -1
View File
@@ -2,7 +2,7 @@ with Alire.Index.Libhello;
package Alire.Index.Hello is
function Project is new Catalogued_Project (Projects.LibHello);
function Project is new Catalogued_Project (Projects.Hello);
Repo : constant URL := "https://bitbucket.org/aleteolabs/hello.git";
+12 -12
View File
@@ -15,17 +15,7 @@ package body Alire.Index is
-- Catalogued_Project --
------------------------
function Catalogued_Project return Catalog_Entry is
begin
return C : constant Catalog_Entry := (Name, Parent) do
if Master_Entries.Contains (Name) then
Trace.Error ("Duplicate master project registration");
raise Constraint_Error with "Duplicate project master entry";
else
Master_Entries.Insert (Name, C);
end if;
end return;
end Catalogued_Project;
function Catalogued_Project return Catalog_Entry is (Name, Parent);
-------------
-- Current --
@@ -47,7 +37,14 @@ package body Alire.Index is
---------
function Get (Name : Projects.Names) return Catalog_Entry is
(Master_Entries.Element (Name));
(Master_Entries.Element (Name));
--------------------------
-- Is_Currently_Indexed --
--------------------------
function Is_Currently_Indexed (Name : Projects.Names) return Boolean is
(Master_Entries.Contains (Name));
------------
-- Exists --
@@ -115,6 +112,9 @@ package body Alire.Index is
pragma Unreferenced (XXXXXXXXXXXXXX);
use all type Alire.Properties.Labeled.Labels;
begin
Master_Entries.Include (Project.Name, Project);
-- Only once would be optimal, but we cannot do that any other way I can think of
return Rel : constant Alire.Releases.Release :=
Alire.Releases.New_Release (Project.Name,
Version,
+13 -2
View File
@@ -47,6 +47,9 @@ package Alire.Index is
function Callable_String (C : Catalog_Entry) return String;
-- Returns Name.Project, for master projects
-- Returns Parent.Subproject_Name, for subprojects
function Package_Name (C : Catalog_Entry) return String;
-- Returns the unique part only, e.g. Alr for Alire.Index.Alr
-----------------
-- Index types --
@@ -90,6 +93,9 @@ package Alire.Index is
-- BASIC QUERIES --
---------------------
function Is_Currently_Indexed (Name : Projects.Names) return Boolean;
-- It will depend on the compilation scope
function Current (C : Catalog_Entry) return Release;
-- Get newest release of C project
@@ -289,8 +295,13 @@ private
function Callable_String (C : Catalog_Entry) return String is
(if C.Parent = C.Name
then Utils.To_Mixed_Case (Projects.Image (C.Name) & ".Project")
else Utils.To_Mixed_Case (Projects.Image (C.Parent) & ".Subproject_" & Image (C.Name)));
then Utils.To_Mixed_Case (C.Package_Name & ".Project")
else Utils.To_Mixed_Case (C.Package_Name & ".Subproject_" & Image (C.Name)));
function Package_Name (C : Catalog_Entry) return String is
(if C.Parent = C.Name
then Utils.To_Mixed_Case (Projects.Image (C.Name))
else Utils.To_Mixed_Case (Projects.Image (C.Parent)));
function Current (C : Catalog_Entry) return Conditional.Dependencies is
(Conditional.New_Dependency (C.Name, Semver.Any));