Enforced platform paths

This commit is contained in:
Alejandro R. Mosteo
2018-03-05 20:59:53 +01:00
parent 6b1629d0a4
commit 0b32fdfc20
8 changed files with 148 additions and 54 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ package Alire.Index.APQ is
Git (Repo, "3b5b4b99f528f853e02abf239da7db3d8c9962b4"),
Properties =>
GPR_File ("apq.gpr") and
GPR_File ("samples" / "apq-samples.gpr") and
GPR_File ("samples/apq-samples.gpr") and
GPR_Scenario ("OS", "Windows_NT" or "GNU/Linux" or "Darwin") and
GPR_Scenario ("DEBUG", "true" or "false") and
+43
View File
@@ -0,0 +1,43 @@
package Alire.Index.AUnit is
Prj_Name : constant Project_Name := "aunit";
Prj_Desc : constant Project_Description := "Ada unit test framework";
Prj_Repo : constant URL := "https://github.com/alire-project/libaunit.git";
Prj_Maintainer : constant String := "AdaCore";
Prj_Website : constant URL := "https://www.adacore.com/download/more";
V_2017 : constant Release :=
Register (Prj_Name,
V ("2017"),
Prj_Desc,
Git (Prj_Repo, "9cc524fe3c3cb3d857e6d1a38defbf58af88f7f9"),
Properties =>
GPR_File ("lib/gnat/aunit.gpr") and
GPR_File ("test/aunit_tests.gpr") and
GPR_File ("examples/calculator/harness.gpr") and
GPR_File ("examples/calculator/tested_lib/testlib.gpr") and
GPR_File ("examples/failures/harness.gpr") and
GPR_File ("examples/failures/tested_lib/testlib.gpr") and
GPR_File ("examples/liskov/harness.gpr") and
GPR_File ("examples/liskov/tested_lib/testlib.gpr") and
GPR_File ("examples/simple_test/harness.gpr") and
GPR_File ("examples/simple_test/tested_lib/testlib.gpr") and
GPR_File ("examples/test_caller/harness/harness.gpr") and
GPR_File ("examples/test_caller/tested_lib/testlib.gpr") and
GPR_File ("examples/test_fixture/harness.gpr") and
GPR_File ("examples/test_fixture/tested_lib/testlib.gpr") and
Executable ("aunit_harness") and
Executable ("run-ppc-elf") and
Executable ("test_liskov") and
Executable ("test_calculator") and
Executable ("test_math") and
Maintainer (Prj_Maintainer) and
Website (Prj_Website) and
License (GPL_3_0)
);
end Alire.Index.AUnit;
+19 -19
View File
@@ -27,7 +27,7 @@ package Alire.Index.DAK is
Properties =>
GPR_File ("strings_edit.gpr") and
GPR_File ("test_strings_edit" / "strings_edit-test.gpr") and
GPR_File ("test_strings_edit/strings_edit-test.gpr") and
GPR_Scenario ("Legacy", "Ada95" or "Ada2005" or "Ada2012") and
GPR_Scenario ("Development", "Debug" or "Release") and
@@ -49,7 +49,7 @@ package Alire.Index.DAK is
Properties =>
GPR_File ("tables.gpr") and
GPR_File ("test_tables" / "tables-test.gpr") and
GPR_File ("test_tables/tables-test.gpr") and
GPR_Scenario ("Legacy", "Ada95" or "Ada2005" or "Ada2012") and
GPR_Scenario ("Development", "Debug" or "Release") and
@@ -72,7 +72,7 @@ package Alire.Index.DAK is
Properties =>
GPR_File ("components.gpr") and
GPR_File ("test_components" / "components-tests.gpr") and
GPR_File ("test_components/components-tests.gpr") and
GPR_Scenario ("Atomic_Access", "Pragma-atomic" or "GCC-built-ins" or "GCC-long-offsets") and
GPR_Scenario ("Tasking", "Multiple" or "Single") and
@@ -124,7 +124,7 @@ package Alire.Index.DAK is
Properties =>
GPR_File ("components-ntp.gpr") and
GPR_File ("test_components" / "components-ntp-test_ntp.gpr") and
GPR_File ("test_components/components-ntp-test_ntp.gpr") and
Executable ("test_ntp") and
@@ -143,8 +143,8 @@ package Alire.Index.DAK is
Properties =>
GPR_File ("components-sqlite.gpr") and
GPR_File ("test_components" / "components-sqlite-benchmark_tests.gpr") and
GPR_File ("test_components" / "components-sqlite-sqlite_persistence_tests.gpr") and
GPR_File ("test_components/components-sqlite-benchmark_tests.gpr") and
GPR_File ("test_components/components-sqlite-sqlite_persistence_tests.gpr") and
Executable ("test_sqlite_benchmark") and
Executable ("test_sqlite_persistence") and
@@ -173,16 +173,16 @@ package Alire.Index.DAK is
GPR_File ("components-connections_server-mqtt.gpr") and
GPR_File ("components-connections_server-smtp.gpr") and
-- Test projects
GPR_File ("test_components" / "components-connections_server-elv_max_cube-test_elv_max_cube_client.gpr") and
GPR_File ("test_components" / "components-connections_server-http_server-test_http_server.gpr") and
GPR_File ("test_components" / "components-connections_server-modbus-test_modbus_client.gpr") and
GPR_File ("test_components" / "components-connections_server-mqtt-test_mqtt.gpr") and
GPR_File ("test_components" / "components-connections_server-test_data_server.gpr") and
GPR_File ("test_components" / "components-connections_server-test_echo_client_async.gpr") and
GPR_File ("test_components" / "components-connections_server-test_echo_client.gpr") and
GPR_File ("test_components" / "components-connections_server-test_echo_server.gpr") and
GPR_File ("test_components" / "components-connections_server-test_websockets_mqtt.gpr") and
GPR_File ("test_components" / "components-test_sqlite_browser.gpr") and
GPR_File ("test_components/components-connections_server-elv_max_cube-test_elv_max_cube_client.gpr") and
GPR_File ("test_components/components-connections_server-http_server-test_http_server.gpr") and
GPR_File ("test_components/components-connections_server-modbus-test_modbus_client.gpr") and
GPR_File ("test_components/components-connections_server-mqtt-test_mqtt.gpr") and
GPR_File ("test_components/components-connections_server-test_data_server.gpr") and
GPR_File ("test_components/components-connections_server-test_echo_client_async.gpr") and
GPR_File ("test_components/components-connections_server-test_echo_client.gpr") and
GPR_File ("test_components/components-connections_server-test_echo_server.gpr") and
GPR_File ("test_components/components-connections_server-test_websockets_mqtt.gpr") and
GPR_File ("test_components/components-test_sqlite_browser.gpr") and
Executable ("test_data_server") and
Executable ("test_echo_client") and
@@ -218,8 +218,8 @@ package Alire.Index.DAK is
Properties =>
GPR_File ("components-connections_server-secure.gpr") and
GPR_File ("components-gnutls.gpr") and
GPR_File ("test_components" / "components-connections_server-http_server-test_https_server.gpr") and
GPR_File ("test_components" / "components-connections_server-smtp-test_smtp.gpr") and
GPR_File ("test_components/components-connections_server-http_server-test_https_server.gpr") and
GPR_File ("test_components/components-connections_server-smtp-test_smtp.gpr") and
Executable ("test_https_client") and
Executable ("test_https_server") and
@@ -241,7 +241,7 @@ package Alire.Index.DAK is
Properties =>
GPR_File ("components-odbc.gpr") and
GPR_File ("test_components" / "components-odbc-odbc_bindings_tests.gpr") and
GPR_File ("test_components/components-odbc-odbc_bindings_tests.gpr") and
On_Condition
(System_Is (GNU_Linux),
+27 -4
View File
@@ -1,8 +1,10 @@
with Alire.Index.AUnit;
package Alire.Index.Libadacrypt is
Prj_Name : constant Project_Name := "libadacrypt";
Prj_Desc : constant Project_Description := "A crypto library for Ada with a nice API";
Prj_Repo : constant URL := "https://github.com/cforler/Ada-Crypto-Library.git";
Prj_Repo : constant URL := "https://github.com/alire-project/Ada-Crypto-Library.git";
Prj_Author : constant String := "Christian Forler";
@@ -10,11 +12,32 @@ package Alire.Index.Libadacrypt is
Register (Prj_Name,
V ("0.8.7"),
Prj_Desc,
Git (Prj_Repo, "06b4907c6ae6dcdce62339ff8fd2913d7bbbc0d9"),
Git (Prj_Repo, "33d15283abbc6d8a51d717de2bd822e026710c0d"),
Dependencies =>
Within_Major (AUnit.V_2017),
Properties =>
GPR_File ("libadacrypt.gpr") and
GPR_File ("acltest.gpr") and
On_Condition
(System_Is (GNU_Linux),
GPR_Extra_Config ("-Xsystem=unix")) and
On_Condition
(System_Is (Windows),
GPR_Extra_Config ("-Xsystem=windows")) and
GPR_Scenario ("system", "unix" or "windows") and
GPR_Scenario ("mode", "debug" or "release") and
Executable ("test-asymmetric_ciphers") and
Executable ("test-big_number") and
Executable ("test-kdf") and
Executable ("test-symmetric_ciphers") and
Executable ("test-tests") and
Properties =>
Author (Prj_Author) and
License (GMGPL_2_0) and
License (GMGPL_3_0)
);
+23
View File
@@ -1,3 +1,6 @@
with Ada.Directories;
with Ada.Strings.Maps;
package body Alire.Index is
use all type Version;
@@ -68,4 +71,24 @@ package body Alire.Index is
end return;
end Register;
---------------
-- To_Native --
---------------
Dir_Seps : constant Ada.Strings.Maps.Character_Set := Ada.Strings.Maps.To_Set ("/\");
function To_Native (Path : Platform_Independent_Path) return String is
use Ada.Strings.Maps;
begin
for I in Path'Range loop
if Is_In (Path (I), Dir_Seps) then
return Ada.Directories.Compose
(Path (Path'First .. I - 1),
To_Native (Path (I + 1 .. Path'Last)));
end if;
end loop;
return Path;
end To_Native;
end Alire.Index;
+16 -12
View File
@@ -1,7 +1,5 @@
private with Alire_Early_Elaboration; pragma Unreferenced (Alire_Early_Elaboration);
with Ada.Directories;
with Alire.Conditional;
with Alire.Containers;
with Alire.Dependencies.Vectors;
@@ -48,6 +46,13 @@ package Alire.Index is
-- Requisites are properties that dependencies have to fulfill, not used yet.
-- Available_On are properties the platform has to fulfill.
subtype Platform_Independent_Path is String with Dynamic_Predicate =>
(for all C of Platform_Independent_Path => C /= '\');
-- This type is used to ensure that folder separators are externally always '/',
-- and internally properly converted to the platform one
function To_Native (Path : Platform_Independent_Path) return String;
---------------------
-- BASIC QUERIES --
---------------------
@@ -179,8 +184,8 @@ package Alire.Index is
function Author is new PL.Cond_New_Label (Properties.Labeled.Author);
function Comment is new PL.Cond_New_Label (Properties.Labeled.Comment);
function Executable is new PL.Cond_New_Label (Properties.Labeled.Executable);
function GPR_Extra_Config is new PL.Cond_New_Label (Properties.Labeled.GPR_Extra_Config);
function GPR_File is new PL.Cond_New_Label (Properties.Labeled.GPR_File);
function GPR_Extra_Config is new PL.Cond_New_Label (Properties.Labeled.GPR_Extra_Config);
function GPR_File (File : Platform_Independent_Path) return Release_Properties;
function Maintainer is new PL.Cond_New_Label (Properties.Labeled.Maintainer);
function Website is new PL.Cond_New_Label (Properties.Labeled.Website);
@@ -227,14 +232,6 @@ package Alire.Index is
function Word_Size_Is (V : Platforms.Word_Sizes) return Requisites.Tree
renames Requisites.Platform.Word_Size_Is;
-- function Version_Is (V : Platforms.Versions) return
-- Other useful functions
function "/" (L, R : String) return String is (Ada.Directories.Compose (L, R));
-- Path composition.
-- FIXME: hardcoded path separators shouldn't reach the index, not sure how to force-prevent this...
----------------------
-- Set_Root_Project --
@@ -247,5 +244,12 @@ package Alire.Index is
-- This function must be called in the working project alire file.
-- Otherwise alr does not know what's the current project, and its version and dependencies
-- The returned Release is the same; this is just a trick to be able to use it in an spec file.
private
function GPR_File_Unsafe is new PL.Cond_New_Label (Properties.Labeled.GPR_File);
function GPR_File (File : Platform_Independent_Path) return Release_Properties
renames GPR_File_Unsafe;
end Alire.Index;
+15 -15
View File
@@ -16,13 +16,13 @@ package Alire.Releases with Preelaborate is
type Release (<>) is tagged private;
function New_Release (Name : Project_Name;
Description : Project_Description;
Version : Semantic_Versioning.Version;
Origin : Origins.Origin;
function New_Release (Name : Project_Name;
Description : Project_Description;
Version : Semantic_Versioning.Version;
Origin : Origins.Origin;
Dependencies : Conditional.Dependencies;
Properties : Conditional.Properties;
Available : Alire.Requisites.Tree) return Release;
Properties : Conditional.Properties;
Available : Alire.Requisites.Tree) return Release;
function "<" (L, R : Release) return Boolean;
@@ -56,9 +56,9 @@ package Alire.Releases with Preelaborate is
-- Explicitly declared ones, or if default one if none declared
-- Under some conditions (usually current platform)
function Image (R : Release) return Path_String;
function Image (R : Release) return Folder_String;
-- Unique string built as name_version_id
function Unique_Folder (R : Release) return Path_String renames Image;
function Unique_Folder (R : Release) return Folder_String renames Image;
function Labeled_Properties (R : Release; P : Properties.Vector; Label : Properties.Labeled.Labels)
return Utils.String_Vector;
@@ -113,13 +113,13 @@ private
use all type Conditional.Properties;
function New_Release (Name : Project_Name;
Description : Project_Description;
Version : Semantic_Versioning.Version;
Origin : Origins.Origin;
function New_Release (Name : Project_Name;
Description : Project_Description;
Version : Semantic_Versioning.Version;
Origin : Origins.Origin;
Dependencies : Conditional.Dependencies;
Properties : Conditional.Properties;
Available : Alire.Requisites.Tree) return Release is
Properties : Conditional.Properties;
Available : Alire.Requisites.Tree) return Release is
(Name'Length, Description'Length,
Name,
Description,
@@ -157,7 +157,7 @@ private
(R.Name & OS_Lib.Exe_Suffix);
use all type Origins.Kinds;
function Image (R : Release) return Path_String is
function Image (R : Release) return Folder_String is
(R.Name & "_" &
Image (R.Version) & "_" &
(case R.Origin.Kind is
+4 -3
View File
@@ -22,9 +22,10 @@ package Alire with Preelaborate is
subtype Project_Description is String with Dynamic_Predicate =>
Project_Description'Length <= Max_Description_Length;
subtype Path_String is String with Dynamic_Predicate =>
Path_String'Length > 0 and then
(for all C of Path_String => C in 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '.');
subtype Folder_String is String with Dynamic_Predicate =>
Folder_String'Length > 0 and then
(for all C of Folder_String => C in 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '.');
-- Used for cross-platform folder names
---------------
-- LOGGING --