From bcb199257a6b453ed2f0806f6508a5201e69be22 Mon Sep 17 00:00:00 2001 From: Jano at Zelda Date: Fri, 26 Jan 2018 17:38:36 +0100 Subject: [PATCH] First approach --- .gitignore | 3 +- alire.gpr | 32 ++++++++++++++++++++-- index/alire-index-hello.ads | 11 ++++++++ index/alire-index-libhello.ads | 11 ++++++++ src/alire-index.ads | 38 ++++++++++++++++++++++++++ src/alire-repositories-git.ads | 15 ++++++++++ src/alire-repositories.ads | 7 +++++ src/alire.ads | 50 ++++++++++++++++++++++++++++++++++ 8 files changed, 164 insertions(+), 3 deletions(-) create mode 100644 index/alire-index-hello.ads create mode 100644 index/alire-index-libhello.ads create mode 100644 src/alire-index.ads create mode 100644 src/alire-repositories-git.ads create mode 100644 src/alire-repositories.ads create mode 100644 src/alire.ads diff --git a/.gitignore b/.gitignore index 8cdf0944..60979492 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -# Object file +# Object files +obj *.o # Ada Library Information diff --git a/alire.gpr b/alire.gpr index 0070c5d5..68226eac 100644 --- a/alire.gpr +++ b/alire.gpr @@ -1,3 +1,31 @@ -project Alire_Index is +with "semantic_versioning.gpr"; + +project Alire is + + for Source_Dirs use ("index", "src"); + for Object_Dir use "obj"; + for Library_Name use "alire"; + for Library_Dir use "lib"; + + package Pretty_Printer is + for Switches ("ada") use ("--no-separate-is"); + end Pretty_Printer; + + package Builder is + for Switches ("ada") use ("-s", "-m", "-j0", "-g"); + end Builder; + + package Compiler is + for Switches ("ada") use ("-gnatwa", "-gnatVa", "-g", "-O2", "-gnat12", "-gnato", "-fstack-check", "-gnata"); + end Compiler; + + package Binder is + for Switches ("ada") use ("-E", "-shared"); + end Binder; + + package Ide is + for Vcs_Kind use "Git"; + end Ide; + +end Alire; -end Alire_Index; diff --git a/index/alire-index-hello.ads b/index/alire-index-hello.ads new file mode 100644 index 00000000..b0308fb4 --- /dev/null +++ b/index/alire-index-hello.ads @@ -0,0 +1,11 @@ +package Alire.Index.Hello is + + Hello : constant Project := Git_Project ("hello", + "git@bitbucket.org:aleteolabs/hello.git"); + + V_1_0_0 : constant Milestone := Register (Git_Release ( + Hello, + V ("1.0.0"), + "8cac0afddc505794ae3e5634745ce0830129d241")); + +end Alire.Index.Hello; diff --git a/index/alire-index-libhello.ads b/index/alire-index-libhello.ads new file mode 100644 index 00000000..29fb9c51 --- /dev/null +++ b/index/alire-index-libhello.ads @@ -0,0 +1,11 @@ +package Alire.Index.Libhello is + + Libhello : constant Project := Git_Project ("libhello", + "git@bitbucket.org:aleteolabs/libhello.git"); + + V_1_0_0 : constant Milestone := Register (Git_Release ( + Libhello, + V ("1.0.0"), + "ce78e7706c9d3f97605df48d8befca5407f8d328")); + +end Alire.Index.Libhello; diff --git a/src/alire-index.ads b/src/alire-index.ads new file mode 100644 index 00000000..584700d9 --- /dev/null +++ b/src/alire-index.ads @@ -0,0 +1,38 @@ +with Alire.Repositories.Git; + +with Semantic_Versioning; + +package Alire.Index with Preelaborate is + + type Milestone (<>) is private; + + function Register (Released : Release; + Depends_On : Dependencies := Nothing) return Milestone; + -- General registering function + + + + -- SHORTCUTS TO SIMPLIFY INDEX ENTRIES REGISTRATION -- + + function V (Semantic_Version : String) return Semantic_Versioning.Version renames Semantic_Versioning.New_Version; + + + + function Git_Project (Name : Project_Name; Git_URL : String) return Project; + + function Git_Release (Prj : Project; + Version : Semantic_Versioning.Version; + Commit : Repositories.Git.Commit_ID) return Release; + + function Register_Git_Milestone (Name : Project_Name; + Version : Semantic_Versioning.Version; + Git_URL : String; + Commit : Repositories.Git.Commit_ID; + Depends_On : Dependencies := Nothing) return Milestone; + -- Single git releases + +private + + type Milestone is null record; + +end Alire.Index; diff --git a/src/alire-repositories-git.ads b/src/alire-repositories-git.ads new file mode 100644 index 00000000..700a2b58 --- /dev/null +++ b/src/alire-repositories-git.ads @@ -0,0 +1,15 @@ +package Alire.Repositories.Git with Preelaborate is + + type Repository (<>) is new Repositories.Repository with private; + + subtype Commit_ID is String (1 .. 40); + + function New_Git_Repo (URL : String) return Repository; + +private + + type Repository (URL_Length : Natural) is new Repositories.Repository with record + URL : String (1 .. URL_Length); + end record; + +end Alire.Repositories.Git; diff --git a/src/alire-repositories.ads b/src/alire-repositories.ads new file mode 100644 index 00000000..54ba15f0 --- /dev/null +++ b/src/alire-repositories.ads @@ -0,0 +1,7 @@ +package Alire.Repositories with Preelaborate is + + type Repository is interface; + + type Commit_ID is new String; + +end Alire.Repositories; diff --git a/src/alire.ads b/src/alire.ads new file mode 100644 index 00000000..b641bf18 --- /dev/null +++ b/src/alire.ads @@ -0,0 +1,50 @@ +limited with Alire.Repositories; + +with Semantic_Versioning; + +package Alire with Preelaborate is + + type Project (<>) is private; + -- A name + Storage location + + type Project_Name is new String; + + function New_Project (Name : Project_Name; + Repo : Repositories.Repository'Class) return Project; + + + + type Release (<>) is private; + + function New_Release (Prj : Project; + Version : Semantic_Versioning.Version; + Commit : Repositories.Commit_ID) return Release; + + + + type Dependency (<>) is private; + + type Dependencies (<>) is private; + + Nothing : constant Dependencies; + + function New_Dependency (Name : Project_Name; Versions : Semantic_Versioning.Version_Set) return Dependency; + + function "and" (Dep1, Dep2 : Dependency) return Dependencies; + function "and" (Deps : Dependencies; Dep : Dependency) return Dependencies; + +private + + type Dependency is null record; + + type Dependencies is null record; + + Nothing : constant Dependencies := (null record); + + type Project is null record; + + type Release is null record; + + type Release_Set is null record; + +end Alire;