Descriptions and assorted fixes

This commit is contained in:
Jano at Zelda
2018-02-14 21:37:24 +01:00
parent df66ef3a69
commit 01db1970af
9 changed files with 97 additions and 60 deletions
@@ -5,6 +5,7 @@ package Alire.Index.Example_Dependencies is
V_1_0_0 : constant Release := V_1_0_0 : constant Release :=
Register ("example_dependencies", Register ("example_dependencies",
V ("1.0.0"), V ("1.0.0"),
"Release with assorted advanced dependency conditions",
Repositories.Local.Repo, Repositories.Local.Repo,
Repositories.Local.Local_Id, Repositories.Local.Local_Id,
Available_When => -- Note that it's impossible Available_When => -- Note that it's impossible
+4
View File
@@ -5,9 +5,12 @@ package Alire.Index.Hello is
Name : constant Project_Name := "hello"; Name : constant Project_Name := "hello";
Repo : constant URL := "https://bitbucket.org/aleteolabs/hello.git"; Repo : constant URL := "https://bitbucket.org/aleteolabs/hello.git";
Desc : constant Project_Description := """Hello, world!"" demonstration project";
V_1_0_0 : constant Release := V_1_0_0 : constant Release :=
Register_Git (Name, Register_Git (Name,
V ("1.0.0"), V ("1.0.0"),
Desc,
Repo, Repo,
"8cac0afddc505794ae3e5634745ce0830129d241", "8cac0afddc505794ae3e5634745ce0830129d241",
Depends_On => At_Least_Within_Major (Libhello.V_1_0_0)); Depends_On => At_Least_Within_Major (Libhello.V_1_0_0));
@@ -15,6 +18,7 @@ package Alire.Index.Hello is
V_1_0_1 : constant Release := V_1_0_1 : constant Release :=
Register_Git (Name, Register_Git (Name,
V ("1.0.1"), V ("1.0.1"),
Desc,
Repo, Repo,
"65725c20778875eef12b61a01b437120932965f3", "65725c20778875eef12b61a01b437120932965f3",
Depends_On => At_Least_Within_Major (Libhello.V_1_0_0)); Depends_On => At_Least_Within_Major (Libhello.V_1_0_0));
+3
View File
@@ -3,9 +3,12 @@ package Alire.Index.Libhello is
Name : constant Project_Name := "libhello"; Name : constant Project_Name := "libhello";
Repo : constant URL := "https://bitbucket.org/aleteolabs/libhello.git"; Repo : constant URL := "https://bitbucket.org/aleteolabs/libhello.git";
Desc : constant Project_Description := "A sample dependency for the hello project";
V_1_0_0 : constant Release := V_1_0_0 : constant Release :=
Register_Git (Name, Register_Git (Name,
V ("1.0.0"), V ("1.0.0"),
Desc,
Repo, Repo,
"ce78e7706c9d3f97605df48d8befca5407f8d328"); "ce78e7706c9d3f97605df48d8befca5407f8d328");
+3
View File
@@ -3,9 +3,12 @@ package Alire.Index.Simple_Logging is
Name : constant Project_Name := "simple_logging"; Name : constant Project_Name := "simple_logging";
Repo : constant URL := "https://github.com/mosteo/simple_logging.git"; Repo : constant URL := "https://github.com/mosteo/simple_logging.git";
Desc : constant Project_Description := "Simple logging to console";
V_1_0_0 : constant Release := V_1_0_0 : constant Release :=
Register_Git (Name, Register_Git (Name,
V ("1.0.0"), V ("1.0.0"),
Desc,
Repo, Repo,
"77896e4a9d0539a63e6bfb657ab955656c2e3c0f"); "77896e4a9d0539a63e6bfb657ab955656c2e3c0f");
+8 -6
View File
@@ -9,19 +9,21 @@ package body Alire.Index is
-- Register -- -- Register --
-------------- --------------
function Register (Project : Project_Name; function Register (Project : Project_Name;
Version : Semantic_Versioning.Version; Version : Semantic_Versioning.Version;
Hosting : Repositories.Repository'Class; Description : Project_Description;
Id : Repositories.Release_Id; Hosting : Repositories.Repository'Class;
Depends_On : Dependencies := Depends.Nothing; Id : Repositories.Release_Id;
Depends_On : Dependencies := Depends.Nothing;
Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector; Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector;
Requisites : Alire.Requisites.Tree := Alire.Requisites.No_Requisites; Requisites : Alire.Requisites.Tree := Alire.Requisites.No_Requisites;
Available_When : Alire.Requisites.Tree := Alire.Requisites.No_Requisites; Available_When : Alire.Requisites.Tree := Alire.Requisites.No_Requisites;
Native : Boolean := False) return Release Native : Boolean := False) return Release
is is
begin begin
return Rel : constant Alire.Releases.Release := return Rel : constant Alire.Releases.Release :=
Alire.Releases.New_Release (Project, Alire.Releases.New_Release (Project,
Description,
Version, Version,
Hosting, Hosting,
Id, Id,
+10 -3
View File
@@ -21,11 +21,14 @@ package Alire.Index is
subtype Release is Alire.Releases.Release; subtype Release is Alire.Releases.Release;
function Register (Project : Project_Name; function Register (-- Mandatory
Project : Project_Name;
Version : Semantic_Versioning.Version; Version : Semantic_Versioning.Version;
Description : Project_Description;
Hosting : Repositories.Repository'Class; Hosting : Repositories.Repository'Class;
Id : Repositories.Release_Id; Id : Repositories.Release_Id;
Depends_On : Dependencies := Depends.Nothing; -- Optional
Depends_On : Dependencies := Depends.Nothing;
Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector; Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector;
Requisites : Alire.Requisites.Tree := Alire.Requisites.No_Requisites; Requisites : Alire.Requisites.Tree := Alire.Requisites.No_Requisites;
Available_When : Alire.Requisites.Tree := Alire.Requisites.No_Requisites; Available_When : Alire.Requisites.Tree := Alire.Requisites.No_Requisites;
@@ -36,11 +39,13 @@ package Alire.Index is
function Register_Git (Project : Project_Name; function Register_Git (Project : Project_Name;
Version : Semantic_Versioning.Version; Version : Semantic_Versioning.Version;
Description : Project_Description;
Hosting : URL; Hosting : URL;
Commit : Repositories.Git.Commit_ID; Commit : Repositories.Git.Commit_ID;
-- Optional
Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector; Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector;
Requisites : Alire.Requisites.Tree := Alire.Requisites.No_Requisites; Requisites : Alire.Requisites.Tree := Alire.Requisites.No_Requisites;
Depends_On : Dependencies := Depends.Nothing) return Release; Depends_On : Dependencies := Depends.Nothing) return Release;
-- Shortcuts to give dependencies: -- Shortcuts to give dependencies:
@@ -97,6 +102,7 @@ private
function Register_Git (Project : Project_Name; function Register_Git (Project : Project_Name;
Version : Semantic_Versioning.Version; Version : Semantic_Versioning.Version;
Description : Project_Description;
Hosting : URL; Hosting : URL;
Commit : Repositories.Git.Commit_ID; Commit : Repositories.Git.Commit_ID;
Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector; Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector;
@@ -104,6 +110,7 @@ private
Depends_On : Dependencies := Depends.Nothing) return Release Depends_On : Dependencies := Depends.Nothing) return Release
is (Register (Project, is (Register (Project,
Version, Version,
Description,
Repositories.Git.New_Repository (String (Hosting)), Repositories.Git.New_Repository (String (Hosting)),
Repositories.Release_Id (Commit), Repositories.Release_Id (Commit),
Depends_On, Depends_On,
+27 -21
View File
@@ -11,18 +11,20 @@ is
type Release (<>) is tagged private; type Release (<>) is tagged private;
function New_Release (Project : Project_Name; function New_Release (Name : Project_Name;
Version : Semantic_Versioning.Version; Description : Project_Description;
Repository : Repositories.Repository'Class; Version : Semantic_Versioning.Version;
Id : Repositories.Release_Id; Repository : Repositories.Repository'Class;
Depends_On : Dependencies; Id : Repositories.Release_Id;
Properties : Alire.Properties.Vector; Depends_On : Dependencies;
Requisites : Alire.Requisites.Tree; Properties : Alire.Properties.Vector;
Native : Boolean) return Release; Requisites : Alire.Requisites.Tree;
Native : Boolean) return Release;
function "<" (L, R : Release) return Boolean; function "<" (L, R : Release) return Boolean;
function Project (R : Release) return Project_Name; function Project (R : Release) return Project_Name;
function Description (R : Release) return Project_Description;
function Version (R : Release) return Semantic_Versioning.Version; function Version (R : Release) return Semantic_Versioning.Version;
function Depends (R : Release) return Dependencies; function Depends (R : Release) return Dependencies;
function Repo_Image (R : Release) return String; function Repo_Image (R : Release) return String;
@@ -43,8 +45,9 @@ is
private private
type Release (Name_Len, Id_Len : Positive) is tagged record type Release (Name_Len, Descr_Len, Id_Len : Natural) is tagged record
Project : Project_Name (1 .. Name_Len); Name : Project_Name (1 .. Name_Len);
Description: Project_Description (1 .. Descr_Len);
Version : Semantic_Versioning.Version; Version : Semantic_Versioning.Version;
Repository : Repositories.Repository_H; Repository : Repositories.Repository_H;
Id : Repositories.Release_Id (1 .. Id_Len); Id : Repositories.Release_Id (1 .. Id_Len);
@@ -54,16 +57,18 @@ private
Native : Boolean; Native : Boolean;
end record; end record;
function New_Release (Project : Project_Name; function New_Release (Name : Project_Name;
Version : Semantic_Versioning.Version; Description : Project_Description;
Repository : Repositories.Repository'Class; Version : Semantic_Versioning.Version;
Id : Repositories.Release_Id; Repository : Repositories.Repository'Class;
Depends_On : Dependencies; Id : Repositories.Release_Id;
Properties : Alire.Properties.Vector; Depends_On : Dependencies;
Requisites : Alire.Requisites.Tree; Properties : Alire.Properties.Vector;
Native : Boolean) return Release is Requisites : Alire.Requisites.Tree;
(Project'Length, Id'Length, Native : Boolean) return Release is
Project, (Name'Length, Description'Length, Id'Length,
Name,
Description,
Version, Version,
Repositories.To_Holder (Repository), Repositories.To_Holder (Repository),
Id, Id,
@@ -79,7 +84,8 @@ private
L.Version = R.Version and then L.Version = R.Version and then
L.Repository.Element.Image < R.Repository.Element.Image)); L.Repository.Element.Image < R.Repository.Element.Image));
function Project (R : Release) return Project_Name is (R.Project); function Project (R : Release) return Project_Name is (R.Name);
function Description (R : Release) return Project_Description is (R.Description);
function Version (R : Release) return Semantic_Versioning.Version is (R.Version); function Version (R : Release) return Semantic_Versioning.Version is (R.Version);
function Depends (R : Release) return Dependencies is (R.Depends_On); function Depends (R : Release) return Dependencies is (R.Depends_On);
+13 -2
View File
@@ -12,8 +12,19 @@ package Alire with Preelaborate is
type URL is new String; type URL is new String;
subtype Project_Name is String; Max_Name_Length : constant := 72; -- Github maximum is 100 and bitbucket 128, but since Description is 72...
-- FIXME: add predicate on valid characters (must be a valid gnat filename part) Max_Description_Length : constant := 72; -- Git line recommendation (although it's 50 for subject line)
subtype Project_Name is String with Dynamic_Predicate =>
Project_Name'Length >= 3 and then
Project_Name'Length <= Max_Name_Length and then
Project_Name (Project_Name'First) /= '_' and then
(for all C of Project_Name => C in 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_');
subtype Project_Description is String with Dynamic_Predicate =>
Project_Description'Length <= Max_Description_Length;
type Dependency (<>) is tagged private; type Dependency (<>) is tagged private;
+17 -17
View File
@@ -13,25 +13,25 @@ package body Alire_Early_Elaboration is
procedure Early_Switch_Detection is procedure Early_Switch_Detection is
use GNAT.Command_Line; use GNAT.Command_Line;
Config : Command_Line_Configuration;
begin begin
Define_Switch (Config,
Switch_Q'Access,
"-q",
Help => "Limit output to errors");
Define_Switch (Config,
Switch_V'Access,
"-v",
Help => "Be more verbose");
Define_Switch (Config, -- We use the simpler Getopt form to avoid built-in help and other shenanigans
Switch_D'Access, begin
"-d", loop
Help => "Be even more verbose (including debug messages)"); case Getopt ("* d q v") is
when ASCII.NUL => exit;
Getopt (Config); when 'd' => Switch_D := True;
when 'q' => Switch_Q := True;
when 'v' => Switch_V := True;
when others => null;
end case;
end loop;
exception
when Exit_From_Command_Line =>
-- Something unexpected happened but it will be properly dealt with later on,
-- in the regular command-line parser
null;
end;
-- Exclusivity check -- Exclusivity check
if (Switch_D and Switch_V) or (Switch_D and Switch_Q) or (Switch_V and Switch_Q) then if (Switch_D and Switch_V) or (Switch_D and Switch_Q) or (Switch_V and Switch_Q) then