diff --git a/.gitignore b/.gitignore index 60979492..cd674ece 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Object files +lib obj -*.o # Ada Library Information *.ali diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..5d7b4c90 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "deps/semver"] + path = deps/semver + url = git@bitbucket.org:aleteolabs/semver.git diff --git a/alire-versions.ads b/alire-versions.ads deleted file mode 100644 index 49c9bdbb..00000000 --- a/alire-versions.ads +++ /dev/null @@ -1,5 +0,0 @@ -package Alire.Versions is - - - -end Alire.Versions; \ No newline at end of file diff --git a/alire.gpr b/alire.gpr index 68226eac..2c55676d 100644 --- a/alire.gpr +++ b/alire.gpr @@ -16,11 +16,12 @@ project Alire is end Builder; package Compiler is - for Switches ("ada") use ("-gnatwa", "-gnatVa", "-g", "-O2", "-gnat12", "-gnato", "-fstack-check", "-gnata"); + for Switches ("ada") use ("-gnatwa", "-gnatVa", "-g", "-p", "-O2", "-gnat12", + "-gnato", "-fstack-check", "-gnata"); end Compiler; package Binder is - for Switches ("ada") use ("-E", "-shared"); + for Switches ("ada") use ("-Es", "-shared"); end Binder; package Ide is diff --git a/alire_env.gpr b/alire_env.gpr new file mode 100644 index 00000000..dce70c6b --- /dev/null +++ b/alire_env.gpr @@ -0,0 +1,7 @@ +aggregate project Alire_Env is + + for Project_Path use ("deps/semver"); + + for Project_Files use ("alire.gpr"); + +end Alire_Env; diff --git a/deps/semver b/deps/semver new file mode 160000 index 00000000..3c50e076 --- /dev/null +++ b/deps/semver @@ -0,0 +1 @@ +Subproject commit 3c50e076d45e19aafc7c2484d2cfaee394d3b363 diff --git a/index/alire-index-hello.ads b/index/alire-index-hello.ads index b0308fb4..6cfdc74b 100644 --- a/index/alire-index-hello.ads +++ b/index/alire-index-hello.ads @@ -1,11 +1,16 @@ +with Alire.Index.Libhello; + package Alire.Index.Hello is - Hello : constant Project := Git_Project ("hello", - "git@bitbucket.org:aleteolabs/hello.git"); + Name : constant Project_Name := "hello"; + Repo : constant URL := "git@bitbucket.org:aleteolabs/hello.git"; - V_1_0_0 : constant Milestone := Register (Git_Release ( - Hello, - V ("1.0.0"), - "8cac0afddc505794ae3e5634745ce0830129d241")); + V_1_0_0 : constant Release := + Register_Git (Name, + V ("1.0.0"), + Repo, + "8cac0afddc505794ae3e5634745ce0830129d241", + -- Depends_On ("libhello", At_Least_Within_Major (V ("1.0.0")))); + Depends_On => At_Least_Within_Major (Libhello.V_1_0_0)); end Alire.Index.Hello; diff --git a/index/alire-index-libhello.ads b/index/alire-index-libhello.ads index 29fb9c51..9af875ff 100644 --- a/index/alire-index-libhello.ads +++ b/index/alire-index-libhello.ads @@ -1,11 +1,12 @@ package Alire.Index.Libhello is - Libhello : constant Project := Git_Project ("libhello", - "git@bitbucket.org:aleteolabs/libhello.git"); + Name : constant Project_Name := "libhello"; + Repo : constant URL := "git@bitbucket.org:aleteolabs/libhello.git"; - V_1_0_0 : constant Milestone := Register (Git_Release ( - Libhello, - V ("1.0.0"), - "ce78e7706c9d3f97605df48d8befca5407f8d328")); + V_1_0_0 : constant Release := + Register_Git (Name, + V ("1.0.0"), + Repo, + "ce78e7706c9d3f97605df48d8befca5407f8d328"); end Alire.Index.Libhello; diff --git a/src/alire-index.adb b/src/alire-index.adb new file mode 100644 index 00000000..a520722d --- /dev/null +++ b/src/alire-index.adb @@ -0,0 +1,13 @@ +package body Alire.Index is + + function Register (Project : Project_Name; + Version : Semantic_Versioning.Version; + Hosting : Repositories.Repository'Class; + Id : Repositories.Release_Id; + Depends_On : Dependencies := Nothing; + License : Licenses := Unknown) return Release is + begin + return (null record); + end Register; + +end Alire.Index; diff --git a/src/alire-index.ads b/src/alire-index.ads index 584700d9..7862d7fe 100644 --- a/src/alire-index.ads +++ b/src/alire-index.ads @@ -3,36 +3,74 @@ with Alire.Repositories.Git; with Semantic_Versioning; package Alire.Index with Preelaborate is + + function V (Semantic_Version : String) return Semantic_Versioning.Version + renames Semantic_Versioning.New_Version; + + type Release (<>) is private; + + function Register (Project : Project_Name; + Version : Semantic_Versioning.Version; + Hosting : Repositories.Repository'Class; + Id : Repositories.Release_Id; + Depends_On : Dependencies := Nothing; + License : Licenses := Unknown) return Release; + + function Register_Git (Project : Project_Name; + Version : Semantic_Versioning.Version; + Hosting : URL; + Commit : Repositories.Git.Commit_ID; + Depends_On : Dependencies := Nothing; + License : Licenses := Unknown) return Release; - type Milestone (<>) is private; + -- Shortcuts to give dependencies: - function Register (Released : Release; - Depends_On : Dependencies := Nothing) return Milestone; - -- General registering function + function At_Least_Within_Major (R : Release) return Dependencies; + function At_Least (V : Release) return Dependencies; + function At_Most (V : Release) return Dependencies; + function Less_Than (V : Release) return Dependencies; + function More_Than (V : Release) return Dependencies; + function Exactly (V : Release) return Dependencies; + function Except (V : Release) return Dependencies; - - -- SHORTCUTS TO SIMPLIFY INDEX ENTRIES REGISTRATION -- + subtype Version is Semantic_Versioning.Version; + subtype Version_Set is Semantic_Versioning.Version_Set; - function V (Semantic_Version : String) return Semantic_Versioning.Version renames Semantic_Versioning.New_Version; + function At_Least_Within_Major (V : Version) return Version_Set renames Semantic_Versioning.At_Least_Within_Major; - - - 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 + function At_Least (V : Version) return Version_Set renames Semantic_Versioning.At_Least; + function At_Most (V : Version) return Version_Set renames Semantic_Versioning.At_Most; + function Less_Than (V : Version) return Version_Set renames Semantic_Versioning.Less_Than; + function More_Than (V : Version) return Version_Set renames Semantic_Versioning.More_Than; + function Exactly (V : Version) return Version_Set renames Semantic_Versioning.Exactly; + function Except (V : Version) return Version_Set renames Semantic_Versioning.Except; private - type Milestone is null record; + type Release is null record; + + function Register_Git (Project : Project_Name; + Version : Semantic_Versioning.Version; + Hosting : URL; + Commit : Repositories.Git.Commit_ID; + Depends_On : Dependencies := Nothing; + License : Licenses := Unknown) return Release + is (Register (Project, + Version, + Repositories.Git.New_Repository (String (Hosting)), + Repositories.Release_Id (Commit), + Depends_On, + License)); + + function At_Least_Within_Major (R : Release) return Dependencies is (null record); + + function At_Least (V : Release) return Dependencies is (null record); + function At_Most (V : Release) return Dependencies is (null record); + function Less_Than (V : Release) return Dependencies is (null record); + function More_Than (V : Release) return Dependencies is (null record); + function Exactly (V : Release) return Dependencies is (null record); + function Except (V : Release) return Dependencies is (null record); + end Alire.Index; diff --git a/src/alire-repositories-git.ads b/src/alire-repositories-git.ads index 700a2b58..f5cc2cd8 100644 --- a/src/alire-repositories-git.ads +++ b/src/alire-repositories-git.ads @@ -2,14 +2,18 @@ package Alire.Repositories.Git with Preelaborate is type Repository (<>) is new Repositories.Repository with private; - subtype Commit_ID is String (1 .. 40); + function New_Repository(URL : String) return Repository; - function New_Git_Repo (URL : String) return Repository; + subtype Commit_ID is String (1 .. 40); private type Repository (URL_Length : Natural) is new Repositories.Repository with record URL : String (1 .. URL_Length); end record; + + function New_Repository (URL : String) return Repository + is (URL_Length => Url'Length, + URL => URL); end Alire.Repositories.Git; diff --git a/src/alire-repositories.ads b/src/alire-repositories.ads index 54ba15f0..6aabf38f 100644 --- a/src/alire-repositories.ads +++ b/src/alire-repositories.ads @@ -2,6 +2,6 @@ package Alire.Repositories with Preelaborate is type Repository is interface; - type Commit_ID is new String; + type Release_Id is new String; end Alire.Repositories; diff --git a/src/alire.ads b/src/alire.ads index b641bf18..369b9edc 100644 --- a/src/alire.ads +++ b/src/alire.ads @@ -1,50 +1,39 @@ -limited with Alire.Repositories; - with Semantic_Versioning; package Alire with Preelaborate is - type Project (<>) is private; - -- A name + Storage location + type URL is new String; + + 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 Licenses is (Unknown); + - 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 New_Dependency (Name : Project_Name; + Versions : Semantic_Versioning.Version_Set) return Dependencies; + function Depends_On (Name : Project_Name; + Versions : Semantic_Versioning.Version_Set) return Dependencies renames New_Dependency; - function "and" (Dep1, Dep2 : Dependency) return Dependencies; - function "and" (Deps : Dependencies; Dep : Dependency) return Dependencies; + function "and" (Dep1, Dep2 : Dependencies) 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; + function New_Dependency (Name : Project_Name; + Versions : Semantic_Versioning.Version_Set) return Dependencies + is (null record); + function "and" (Dep1, Dep2 : Dependencies) return Dependencies is (null record); + end Alire;