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 :=
Register ("example_dependencies",
V ("1.0.0"),
"Release with assorted advanced dependency conditions",
Repositories.Local.Repo,
Repositories.Local.Local_Id,
Available_When => -- Note that it's impossible
+9 -5
View File
@@ -4,19 +4,23 @@ package Alire.Index.Hello is
Name : constant Project_Name := "hello";
Repo : constant URL := "https://bitbucket.org/aleteolabs/hello.git";
V_1_0_0 : constant Release :=
Desc : constant Project_Description := """Hello, world!"" demonstration project";
V_1_0_0 : constant Release :=
Register_Git (Name,
V ("1.0.0"),
Desc,
Repo,
"8cac0afddc505794ae3e5634745ce0830129d241",
Depends_On => At_Least_Within_Major (Libhello.V_1_0_0));
V_1_0_1 : constant Release :=
V_1_0_1 : constant Release :=
Register_Git (Name,
V ("1.0.1"),
Desc,
Repo,
"65725c20778875eef12b61a01b437120932965f3",
Depends_On => At_Least_Within_Major (Libhello.V_1_0_0));
end Alire.Index.Hello;
+7 -4
View File
@@ -1,11 +1,14 @@
package Alire.Index.Libhello is
Name : constant Project_Name := "libhello";
Name : constant Project_Name := "libhello";
Repo : constant URL := "https://bitbucket.org/aleteolabs/libhello.git";
V_1_0_0 : constant Release :=
Desc : constant Project_Description := "A sample dependency for the hello project";
V_1_0_0 : constant Release :=
Register_Git (Name,
V ("1.0.0"),
Desc,
Repo,
"ce78e7706c9d3f97605df48d8befca5407f8d328");
+3
View File
@@ -3,9 +3,12 @@ package Alire.Index.Simple_Logging is
Name : constant Project_Name := "simple_logging";
Repo : constant URL := "https://github.com/mosteo/simple_logging.git";
Desc : constant Project_Description := "Simple logging to console";
V_1_0_0 : constant Release :=
Register_Git (Name,
V ("1.0.0"),
Desc,
Repo,
"77896e4a9d0539a63e6bfb657ab955656c2e3c0f");
+8 -6
View File
@@ -9,19 +9,21 @@ package body Alire.Index is
-- Register --
--------------
function Register (Project : Project_Name;
Version : Semantic_Versioning.Version;
Hosting : Repositories.Repository'Class;
Id : Repositories.Release_Id;
Depends_On : Dependencies := Depends.Nothing;
function Register (Project : Project_Name;
Version : Semantic_Versioning.Version;
Description : Project_Description;
Hosting : Repositories.Repository'Class;
Id : Repositories.Release_Id;
Depends_On : Dependencies := Depends.Nothing;
Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector;
Requisites : 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
begin
return Rel : constant Alire.Releases.Release :=
Alire.Releases.New_Release (Project,
Description,
Version,
Hosting,
Id,
+12 -5
View File
@@ -21,11 +21,14 @@ package Alire.Index is
subtype Release is Alire.Releases.Release;
function Register (Project : Project_Name;
Version : Semantic_Versioning.Version;
function Register (-- Mandatory
Project : Project_Name;
Version : Semantic_Versioning.Version;
Description : Project_Description;
Hosting : Repositories.Repository'Class;
Id : Repositories.Release_Id;
Depends_On : Dependencies := Depends.Nothing;
Id : Repositories.Release_Id;
-- Optional
Depends_On : Dependencies := Depends.Nothing;
Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector;
Requisites : 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;
Version : Semantic_Versioning.Version;
Description : Project_Description;
Hosting : URL;
Commit : Repositories.Git.Commit_ID;
-- Optional
Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector;
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:
@@ -97,6 +102,7 @@ private
function Register_Git (Project : Project_Name;
Version : Semantic_Versioning.Version;
Description : Project_Description;
Hosting : URL;
Commit : Repositories.Git.Commit_ID;
Properties : Alire.Properties.Vector := Alire.Properties.Vectors.Empty_Vector;
@@ -104,6 +110,7 @@ private
Depends_On : Dependencies := Depends.Nothing) return Release
is (Register (Project,
Version,
Description,
Repositories.Git.New_Repository (String (Hosting)),
Repositories.Release_Id (Commit),
Depends_On,
+27 -21
View File
@@ -11,18 +11,20 @@ is
type Release (<>) is tagged private;
function New_Release (Project : Project_Name;
Version : Semantic_Versioning.Version;
Repository : Repositories.Repository'Class;
Id : Repositories.Release_Id;
Depends_On : Dependencies;
Properties : Alire.Properties.Vector;
Requisites : Alire.Requisites.Tree;
Native : Boolean) return Release;
function New_Release (Name : Project_Name;
Description : Project_Description;
Version : Semantic_Versioning.Version;
Repository : Repositories.Repository'Class;
Id : Repositories.Release_Id;
Depends_On : Dependencies;
Properties : Alire.Properties.Vector;
Requisites : Alire.Requisites.Tree;
Native : Boolean) return Release;
function "<" (L, R : Release) return Boolean;
function Project (R : Release) return Project_Name;
function Description (R : Release) return Project_Description;
function Version (R : Release) return Semantic_Versioning.Version;
function Depends (R : Release) return Dependencies;
function Repo_Image (R : Release) return String;
@@ -43,8 +45,9 @@ is
private
type Release (Name_Len, Id_Len : Positive) is tagged record
Project : Project_Name (1 .. Name_Len);
type Release (Name_Len, Descr_Len, Id_Len : Natural) is tagged record
Name : Project_Name (1 .. Name_Len);
Description: Project_Description (1 .. Descr_Len);
Version : Semantic_Versioning.Version;
Repository : Repositories.Repository_H;
Id : Repositories.Release_Id (1 .. Id_Len);
@@ -54,16 +57,18 @@ private
Native : Boolean;
end record;
function New_Release (Project : Project_Name;
Version : Semantic_Versioning.Version;
Repository : Repositories.Repository'Class;
Id : Repositories.Release_Id;
Depends_On : Dependencies;
Properties : Alire.Properties.Vector;
Requisites : Alire.Requisites.Tree;
Native : Boolean) return Release is
(Project'Length, Id'Length,
Project,
function New_Release (Name : Project_Name;
Description : Project_Description;
Version : Semantic_Versioning.Version;
Repository : Repositories.Repository'Class;
Id : Repositories.Release_Id;
Depends_On : Dependencies;
Properties : Alire.Properties.Vector;
Requisites : Alire.Requisites.Tree;
Native : Boolean) return Release is
(Name'Length, Description'Length, Id'Length,
Name,
Description,
Version,
Repositories.To_Holder (Repository),
Id,
@@ -79,7 +84,8 @@ private
L.Version = R.Version and then
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 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;
subtype Project_Name is String;
-- FIXME: add predicate on valid characters (must be a valid gnat filename part)
Max_Name_Length : constant := 72; -- Github maximum is 100 and bitbucket 128, but since Description is 72...
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;
+17 -17
View File
@@ -13,25 +13,25 @@ package body Alire_Early_Elaboration is
procedure Early_Switch_Detection is
use GNAT.Command_Line;
Config : Command_Line_Configuration;
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,
Switch_D'Access,
"-d",
Help => "Be even more verbose (including debug messages)");
Getopt (Config);
-- We use the simpler Getopt form to avoid built-in help and other shenanigans
begin
loop
case Getopt ("* d q v") is
when ASCII.NUL => exit;
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
if (Switch_D and Switch_V) or (Switch_D and Switch_Q) or (Switch_V and Switch_Q) then