Use the native version as the build part

This commit is contained in:
Alejandro R Mosteo
2018-03-15 11:41:48 +01:00
parent 2113fadb7b
commit b02a823903
3 changed files with 26 additions and 2 deletions
+3 -1
View File
@@ -4,6 +4,8 @@ package Alire.Hooks with Preelaborate is
-- Hackish way to enable Alire to obtain some platform-specific info that only Alr knows how to get
Version_Getter_Hook : access function (O : Origins.Origin) return String;
-- WARNING: this will be null during elaboration!
Version_Getter : access function (O : Origins.Origin) return String;
end Alire.Hooks;
+23
View File
@@ -1,5 +1,6 @@
with Alire.Conditional_Values;
with Alire.Dependencies.Vectors;
with Alire.Hooks;
with Alire.Platforms;
with Alire.Requisites.Booleans;
@@ -241,6 +242,28 @@ package body Alire.Releases is
return False;
end Property_Contains;
-------------
-- Version --
-------------
function Version (R : Release) return Semantic_Versioning.Version is
use Hooks;
begin
if Hooks.Version_Getter /= null and then R.Origin.Is_Native then
declare
Native_Version : constant String := Hooks.Version_Getter (R.Origin);
begin
if Native_Version /= "" then
return New_Version (Image (R.Version) & "+" & Native_Version);
else
return R.Version;
end if;
end;
else
return R.Version;
end if;
end Version;
--------------
-- Whenever --
--------------
-1
View File
@@ -165,7 +165,6 @@ private
function Project (R : Release) return Name_String is (Projects.Image (R.Name));
function Description (R : Release) return Description_String is (Projects.Description (R.Name));
function Notes (R : Release) return Description_String is (R.Notes);
function Version (R : Release) return Semantic_Versioning.Version is (R.Version);
function Depends (R : Release) return Conditional.Dependencies is (R.Dependencies);