Descriptions and assorted fixes
This commit is contained in:
+8
-6
@@ -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
@@ -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
@@ -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
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user