New packaging way without version redundancy

This commit is contained in:
Alejandro R Mosteo
2018-05-03 11:25:02 +02:00
parent 1d2adfa49f
commit a19b03e642
9 changed files with 169 additions and 50 deletions
Vendored
+1 -1
+30 -43
View File
@@ -10,57 +10,44 @@ package Alire.Index.AdaYaml is
Prj_Author : constant String := "Felix Krause";
Prj_Website : constant URL := "https://ada.yaml.io/";
V_0_2 : constant Release :=
Project.Register
(V ("0.2"),
Git (Prj_Repo, "0264b03fd92eeedfe3e2713ed1da3f0d255c1727"),
Base : constant Release :=
Project.Unreleased
(Dependencies =>
AUnit.Project >= AUnit.V_2017,
Dependencies =>
AUnit.Project >= AUnit.V_2017,
Properties =>
Project_File ("yaml.gpr") and
Project_File ("yaml-utils.gpr") and
Properties =>
Project_File ("yaml.gpr") and
Project_File ("yaml-utils.gpr") and
GPR_Scenario ("Mode", "debug" or "release") and
GPR_Scenario ("Mode", "debug" or "release") and
Author (Prj_Author) and
Website (Prj_Website) and
License (MIT),
Author (Prj_Author) and
Website (Prj_Website) and
License (MIT),
Private_Properties =>
Project_File ("yaml-tests.gpr"));
package V_0_3 is new Released
(Base
.Replacing (Git (Prj_Repo, "2017a7c2523499c03b8d7fe06546a5a8bae6476d"))
.Extending (Properties =>
Project_File ("yaml-annotation_processor.gpr"),
Private_Properties =>
Project_File ("yaml-tests.gpr") and
Executable ("yaml-dumping_tests-harness") and
Executable ("yaml-loading_tests-harness") and
Executable ("yaml-transformation_tests-harness")));
package V_0_2 is new Released
(Base
.Replacing (Git (Prj_Repo, "0264b03fd92eeedfe3e2713ed1da3f0d255c1727"))
.Extending (Private_Properties =>
Executable ("yaml-lexer-harness") and
Executable ("yaml-parser-harness")
);
Executable ("yaml-parser-harness")));
V_0_3 : constant Release :=
Project.Register
(V ("0.3"),
Git (Prj_Repo, "2017a7c2523499c03b8d7fe06546a5a8bae6476d"),
Dependencies =>
AUnit.Project >= AUnit.V_2017,
Properties =>
Project_File ("yaml.gpr") and
Project_File ("yaml-annotation_processor.gpr") and
Project_File ("yaml-utils.gpr") and
GPR_Scenario ("Mode", "debug" or "release") and
Author (Prj_Author) and
Website (Prj_Website) and
License (MIT),
Private_Properties =>
Project_File ("yaml-tests.gpr") and
Executable ("yaml-dumping_tests-harness") and
Executable ("yaml-loading_tests-harness") and
Executable ("yaml-transformation_tests-harness")
);
------------
-- Server --
------------
package Server is
@@ -69,7 +56,7 @@ package Alire.Index.AdaYaml is
V_0_3 : constant Release :=
Project.Register
(AdaYaml.V_0_3
(AdaYaml.V_0_3.Release
.Extending
(Properties =>
Project_File ("yaml-server.gpr") and
+4 -4
View File
@@ -9,7 +9,7 @@ package Alire.Index.Alr is
Repo : constant URL := "https://github.com/alire-project/alr.git";
V_0 : constant Release :=
Base : constant Release :=
Project.Unreleased
(Dependencies =>
Simple_Logging.V_1_0.Within_Major,
@@ -20,7 +20,7 @@ package Alire.Index.Alr is
V_0_4 : constant Release :=
Project.Register
(V_0
(Base
.Upgrading
(V ("0.4"),
Git (Repo, "721d111225cf30b9c298ff23587664510f4c4ea1"))
@@ -31,7 +31,7 @@ package Alire.Index.Alr is
V_0_2 : constant Release :=
Project.Register
(V_0
(Base
.Upgrading
(V ("0.2"),
Git (Repo, "481a22aceb07242cabaefedbb41b2d6fe7a8bd1e"))
@@ -41,7 +41,7 @@ package Alire.Index.Alr is
V_0_1_2 : constant Release :=
Project.Register
(V_0
(Base
.Upgrading
(V ("0.1.2"),
Git (Repo, "4002536beea8aee12b455077df4dd144b409bde4"))
+33
View File
@@ -245,4 +245,37 @@ package body Alire.Index is
Available => Available_When);
end Unreleased;
-----------------
-- New_Release --
-----------------
package body Released is
The_Release : constant Index.Release :=
Project.Register -- Add to catalog
(Base.Retagging -- Overriding the version
(Versions.From_Identifier -- with the one in the
(Identify -- package name
(GNAT.Source_Info.Enclosing_Entity).Identifier)));
-------------
-- Release --
-------------
function Release return Index.Release is
begin
return The_Release;
end Release;
function This_Version return Conditional.Dependencies is
(The_Release.This_Version);
function Within_Major return Conditional.Dependencies is
(The_Release.Within_Major);
function Within_Minor return Conditional.Dependencies is
(The_Release.Within_Minor);
end Released;
end Alire.Index;
+14 -1
View File
@@ -122,7 +122,20 @@ package Alire.Index is
------------------------------------------------------------------
-- NEW INDEXING FACILITIES USING Enclosing_Entity for the version
------------------------------------------------------------------
generic
Base : Release;
with function Project return Catalog_Entry is <>;
package Released is
function Release return Index.Release;
function This_Version return Conditional.Dependencies;
function Within_Major return Conditional.Dependencies;
function Within_Minor return Conditional.Dependencies;
end Released;
------------------------------------------------------------------
---------------------
-- BASIC QUERIES --
+12
View File
@@ -83,6 +83,18 @@ package body Alire.Releases is
end return;
end Replacing;
---------------
-- Retagging --
---------------
function Retagging (Base : Release;
Version : Semantic_Versioning.Version) return Release is
begin
return Upgraded : Release := Base do
Upgraded.Version := Version;
end return;
end Retagging;
---------------
-- Upgrading --
---------------
+5 -1
View File
@@ -48,7 +48,11 @@ package Alire.Releases with Preelaborate is
-- Takes a release and replaces the given fields
function Replacing (Base : Release;
Origin : Origins.Origin) return Release;
Origin : Origins.Origin) return Release;
function Retagging (Base : Release;
Version : Semantic_Versioning.Version) return Release;
-- Keep all data but version
function Upgrading (Base : Release;
Version : Semantic_Versioning.Version;
+60
View File
@@ -0,0 +1,60 @@
with Ada.Characters.Handling;
package body Alire.Versions is
---------------------
-- From_Identifier --
---------------------
function From_Identifier (S : String) return Semantic_Versioning.Version is
-----------
-- Error --
-----------
procedure Error is
begin
Trace.Error ("Given identifier cannot be a version: " & S);
raise Constraint_Error;
end Error;
use Ada.Characters.Handling;
Img : String := S;
First : Positive := Img'First;
Seen : Natural := 0;
begin
if Img'Length < 2 then
Error;
end if;
-- Skip leading text
while First <= Img'Last and then Is_Letter (Img (First)) loop
First := First + 1;
end loop;
if First > Img'Last then
Error;
end if;
-- Skip optional underscore
if Img (First) = '_' then
First := First + 1;
end if;
-- Convert remaining underscores to proper symbol:
for I in First + 1 .. Img'Last loop
if S (I) = '_' then
Seen := Seen + 1;
case Seen is
when 1 .. 2 => Img (I) := '.';
when 3 => Img (I) := '-';
when 4 => Img (I) := '+';
when others => exit;
end case;
end if;
end loop;
return Semantic_Versioning.Relaxed (Img (First .. S'Last));
end From_Identifier;
end Alire.Versions;
+10
View File
@@ -35,6 +35,16 @@ package Alire.Versions with Preelaborate is
package Expressions_With_Versioned is new Expressions.Against (Versioned'Class,
Version_Classwide);
-- Utils dealing with versions
function From_Identifier (S : String) return Semantic_Versioning.Version;
-- Convert an Ada Identifier into a version
-- This is used by the package releases in Index to autodetect the version
-- and avoid duplication
-- EXAMPLES OF VALID IDENTIFIERS:
-- V1_2_3_Prerelease_Build
-- V_1_2_3
private
use Semantic_Versioning;