diff --git a/index/alire-index-alire.ads b/index/alire-index-alire.ads index b0df4a37..49a26978 100644 --- a/index/alire-index-alire.ads +++ b/index/alire-index-alire.ads @@ -25,6 +25,12 @@ package Alire.Index.Alire is "Release with all index syntax features", Origins.New_Filesystem ("/fake"), Properties => + GPR_Scenario ("Build", "Debug" or "Release") and + GPR_Free_Scenario ("Path_To_Something") and + If_Platform (System_Is (Windows), + GPR_File ("project_win.gpr")) and + If_Platform (System_Is (GNU_Linux), + GPR_File ("project_linux.gpr")) and If_Platform (System_Is (GNU_Linux), Comment ("Long life the penguin")) and @@ -35,7 +41,8 @@ package Alire.Index.Alire is (Distribution_Is (Ubuntu_Artful), When_True => Comment ("Living on the edge"), When_False => Comment ("I am a rock")) and - Comment ("Tell me about your mother"), + Comment ("Tell me about your mother") and + Website ("http://www.www.www"), Available_When => -- Impossible mix (System_Is (Windows) and System_Is (GNU_Linux)) or (Compiler_Is_At_Least (GNAT_Unknown) and not Compiler_Is_At_Least (GNAT_Unknown))); diff --git a/index/alire-index-dak.ads b/index/alire-index-dak.ads new file mode 100644 index 00000000..17b4cbb2 --- /dev/null +++ b/index/alire-index-dak.ads @@ -0,0 +1,232 @@ +with Alire.Index.LibGNUTLS; + +package Alire.Index.DAK is + + -- Simple Components by Dmitry A. Kazakov + -- This library is a good challenge since it has many subprojects + -- It prompted the introduction of the GPR_File property + + -- Since most project names are common words, I've taken the liberty to prefix them with dak_ + -- but the original sources are unchanged. + + Base : constant Project_Name := "dak_"; + Repo : constant URL := "https://github.com/alire-project/dak_simple_components.git"; + + DAK_Author : constant String := "Dmitry A. Kazakov"; + DAK_Website : constant String := "http://www.dmitry-kazakov.de/ada/components.htm"; + + Desc_Pre : constant String := "Simple Components "; + Desc_Post : constant String := " by Dmitry A. Kazakov"; + + Strings_Edit_V_4_27 : constant Release := + Register (Base & "strings_edit", + V ("4.27"), + Desc_Pre & "(strings)" & Desc_Post, + Git (Repo, "44ac8e0c817558b8641f746ce225b3d2fa90b7a1"), + Properties => + + GPR_File ("strings_edit.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 + + Executable ("test_base64") and + Executable ("test_strings_edit") and + Executable ("test_string_streams") and + + License (GMGPL_2_0) and + Author (DAK_Author) and + Website (DAK_Website) + ); + + Tables_V_4_27 : constant Release := + Register (Base & "tables", + V ("4.27"), + Desc_Pre & "(tables)" & Desc_Post, + Git (Repo, "19205e4981d72242daf72da7d59c5faf2b4c91fd"), + Properties => + + GPR_File ("tables.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 + + Executable ("test_tables") and + + License (GMGPL_2_0) and + Author (DAK_Author) and + Website (DAK_Website) + ); + + Components_V_4_27 : constant Release := + Register (Base & "components", + V ("4.27"), + Desc_Pre & "(base components)" & Desc_Post, + Git (Repo, "542f02c9be86693f759fcb784a8462bc4b25f1f2"), + Depends_On => + Within_Major (Strings_Edit_V_4_27) and + Within_Major (Tables_V_4_27), + + Properties => + GPR_File ("components.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 + GPR_Scenario ("Traced_objects", "Off" or "On") and + + Executable ("test_approximations") and + Executable ("test_association") and + Executable ("test_blackboard") and + Executable ("test_blackboard_performance") and + Executable ("test_blocking_files") and + Executable ("test_block_streams") and + Executable ("test_b_trees") and + Executable ("test_cubic_spline") and + Executable ("test_dining_philosophers") and + Executable ("test_fifo") and + Executable ("test_generic_indefinite_sets") and + Executable ("test_generic_maps") and + Executable ("test_generic_sets") and + Executable ("test_graphs") and + Executable ("test_handles") and + Executable ("test_ieee_754") and + Executable ("test_linked_lists") and + Executable ("test_linked_lists_scheduler_test") and + Executable ("test_parser_stream_io") and + Executable ("test_persistent_memory_pool") and + Executable ("test_persistent_storage") and + Executable ("test_sequencer") and + Executable ("test_single_file_persistence") and + Executable ("test_stack") and + Executable ("test_storage_streams") and + Executable ("test_string_streams") and + Executable ("test_synchronization_events") and + Executable ("test_transactional_blocking_files") and + Executable ("test_utf8_tables") and + + License (GMGPL_2_0) and + Author (DAK_Author) and + Website (DAK_Website) and + Comment ("Tasking=Single seems to be broken at persistent-single_file-text_io.adb") + ); + + Components_NTP_V_4_27 : constant Release := + Register (Base & "components_ntp", + V ("4.27"), + Desc_Pre & "(ntp)" & Desc_Post, + Git (Repo, "34fb305d6ef360cde5e272b51409097a5de72017"), + Depends_On => + Within_Major (Components_V_4_27), + + Properties => + GPR_File ("components-ntp.gpr") and + GPR_File ("test_components" / "components-ntp-test_ntp.gpr") and + + Executable ("test_ntp") and + + License (GMGPL_2_0) and + Author (DAK_Author) and + Website (DAK_Website) + ); + + Components_Sqlite_V_4_27 : constant Release := + Register (Base & "components_sqlite", + V ("4.27"), + Desc_Pre & "(sqlite)" & Desc_Post, + Git (Repo, "6fda0f3f7494815c87b329f7411b9a49ff97b9ba"), + Depends_On => + Within_Major (Components_V_4_27), + + 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 + + Executable ("test_sqlite_benchmark") and + Executable ("test_sqlite_persistence") and + + License (GMGPL_2_0) and + Author (DAK_Author) and + Website (DAK_Website) + ); + + Components_Connections_V_4_27 : constant Release := + Register (Base & "components_connections", + V ("4.27"), + Desc_Pre & "(clients/servers)" & Desc_Post, + Git (Repo, "008935d5a89396cc0c39afb39f04bf6a89a92058"), + Depends_On => + Within_Major (Components_V_4_27) and + Within_Major (Components_Sqlite_V_4_27), + + Properties => + -- Main projects + GPR_File ("components-connections_server.gpr") and + GPR_File ("components-connections_server-elv_max_cube.gpr") and + GPR_File ("components-connections_server-http_server.gpr") and + GPR_File ("components-connections_server-http_server-sqlite_browser.gpr") and + GPR_File ("components-connections_server-modbus.gpr") and + 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 + + Executable ("test_data_server") and + Executable ("test_echo_client") and + Executable ("test_echo_client_async") and + Executable ("test_echo_server") and + Executable ("test_elv_max_cube_client") and + Executable ("test_http_client") and + Executable ("test_http_continuous_server") and + Executable ("test_http_server") and + Executable ("test_http_sqlite_browser") and + Executable ("test_infinity_server") and + Executable ("test_modbus_client") and + Executable ("test_mqtt_client") and + Executable ("test_mqtt_server") and + Executable ("test_mqtt_webserver") and + Executable ("test_websocket_duplex_server") and + Executable ("test_websocket_server") and + + License (GMGPL_2_0) and + Author (DAK_Author) and + Website (DAK_Website) + ); + + Components_Connections_Secure_V_4_27 : constant Release := + Register (Base & "components_connections_secure", + V ("4.27"), + Desc_Pre & "(client/servers over TLS)" & Desc_Post, + Git (Repo, "ca72cf4150ae14ba6d40c3d2dd92c7846cb4cb5d"), + Depends_On => + Within_Major (Components_Connections_V_4_27) and + Within_Major (LibGNUTLS.V_3_5_8), + + 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 + + Executable ("test_https_client") and + Executable ("test_https_server") and + Executable ("test_smtp_client") and + + License (GMGPL_2_0) and + Author (DAK_Author) and + Website (DAK_Website) + ); + +end Alire.Index.DAK; diff --git a/index/alire-index-libgnutls.ads b/index/alire-index-libgnutls.ads index d28553fe..54ea1dc2 100644 --- a/index/alire-index-libgnutls.ads +++ b/index/alire-index-libgnutls.ads @@ -10,6 +10,7 @@ package Alire.Index.LibGNUTLS is Native ("libgnutls28-dev"), Available_When => Distribution_Is (Debian_Buster) or + Distribution_Is (Ubuntu_Xenial) or Distribution_Is (Ubuntu_Artful)); end Alire.Index.LibGNUTLS; diff --git a/index/alire-index-pragmarc.ads b/index/alire-index-pragmarc.ads new file mode 100644 index 00000000..e10fbfb6 --- /dev/null +++ b/index/alire-index-pragmarc.ads @@ -0,0 +1,40 @@ +package Alire.Index.PragmARC is + + Name : constant Project_Name := "pragmarc"; + Repo : constant URL := "https://github.com/alire-project/PragmARC.git"; + + Desc : constant Project_Description := + "PragmAda Reusable Components (PragmARCs), "; + + Auth : constant String := "Jeffrey R. Carter"; + + Web1 : constant String := "https://github.com/jrcarter/PragmARC"; + Web2 : constant String := "https://pragmada.x10hosting.com/"; + + V_2017 : constant Release := -- Experimental '07 version + Register (Name, + V ("2017.2007.0"), + Desc & "ISO/IEC 8652:2007 version", + Git (Repo, "db6c1730fe825f8303c60b48f82db08bd408588d"), + Properties => + Executable ("compile_all") and + License (GMGPL_2_0) and + Author (Auth) and + Website (Web1) and + Website (Web2) + ); + + V_2011 : constant Release := -- Pure Ada95 version + Register (Name, + V ("2011.1995.0"), + Desc & "Ada 95 version", + Git (Repo, "34b0e12b5f9aea63408c94cc48ba7a16687c8d76"), + Properties => + Executable ("compile_all") and + License (GMGPL_2_0) and + Author (Auth) and + Website (Web1) and + Website (Web2) + ); + +end Alire.Index.PragmARC; diff --git a/index/alire-index-rxada.ads b/index/alire-index-rxada.ads new file mode 100644 index 00000000..817d0977 --- /dev/null +++ b/index/alire-index-rxada.ads @@ -0,0 +1,23 @@ +package Alire.Index.RxAda is + + Name : constant Project_Name := "rxada"; + Repo : constant URL := "https://bitbucket.org/amosteo/rxada"; + + Desc : constant Project_Description := "RxAda port of the Rx framework"; + + V_0_1_0 : constant Release := + Register (Name, + V ("0.1.0"), + Desc, + Hg (Repo, "361d4e2ab20a7dcca007e31bf7094d57b13fee6b"), + Properties => + + Executable ("rx-examples-basic") and + Executable ("rx-examples-minimal") and + Executable ("rx-examples-tests") and + Executable ("rx-examples-threading") and + + License (LGPL_3_0) and + Maintainer ("alejandro@mosteo.com")); + +end Alire.Index.RxAda; diff --git a/src/alire-conditional-vectors.adb b/src/alire-conditional-vectors.adb index 25a85082..549bebda 100644 --- a/src/alire-conditional-vectors.adb +++ b/src/alire-conditional-vectors.adb @@ -34,7 +34,7 @@ package body Alire.Conditional.Vectors is begin return Result : Vector do for Cond of V loop - Result.Append (Conditional_Value'(New_Inconditional (Values'(Cond.Evaluate (On))))); + Result.Append (Conditional_Value'(New_Unconditional (Values'(Cond.Evaluate (On))))); end loop; end return; end Evaluate; diff --git a/src/alire-conditional-vectors.ads b/src/alire-conditional-vectors.ads index 5e8d0b09..be3d6934 100644 --- a/src/alire-conditional-vectors.ads +++ b/src/alire-conditional-vectors.ads @@ -20,7 +20,7 @@ package Alire.Conditional.Vectors with Preelaborate is Else_X : Values) return Vector is (To_Vector (New_Conditional (If_X, Then_X, Else_X), 1)); - function New_Inconditional (V : Values) return Vector is (To_Vector (New_Inconditional (V), 1)); + function New_Unconditional (V : Values) return Vector is (To_Vector (New_Unconditional (V), 1)); function "+" (V : Conditional_Value) return Vector is (To_Vector (V, 1)); function "and" (L, R : Vector) return Vector is (L & R); diff --git a/src/alire-conditional.ads b/src/alire-conditional.ads index dd69f2de..dd0ef238 100644 --- a/src/alire-conditional.ads +++ b/src/alire-conditional.ads @@ -13,13 +13,13 @@ package Alire.Conditional with Preelaborate is Then_X : Values; Else_X : Values) return Conditional_Value; - function New_Inconditional (V : Values) return Conditional_Value; + function New_Unconditional (V : Values) return Conditional_Value; function Evaluate (This : Conditional_Value; Against : Properties.Vector) return Values; function Condition (This : Conditional_Value) return Requisites.Tree; - function Is_Inconditional (This : Conditional_Value) return Boolean; + function Is_Unconditional (This : Conditional_Value) return Boolean; function True_Value (This : Conditional_Value) return Values; @@ -45,14 +45,14 @@ private Then_Value => Then_X, Else_Value => Else_X); - function New_Inconditional (V : Values) return Conditional_Value is + function New_Unconditional (V : Values) return Conditional_Value is (Condition => Requisites.No_Requisites, Then_Value => V, Else_Value => <>); function Condition (This : Conditional_Value) return Requisites.Tree is (This.Condition); - function Is_Inconditional (This : Conditional_Value) return Boolean is (This.Condition.Is_Empty); + function Is_Unconditional (This : Conditional_Value) return Boolean is (This.Condition.Is_Empty); function True_Value (This : Conditional_Value) return Values is (This.Then_Value); diff --git a/src/alire-conditions.ads b/src/alire-conditions.ads index fc8206b1..008169d0 100644 --- a/src/alire-conditions.ads +++ b/src/alire-conditions.ads @@ -1,12 +1,19 @@ with Alire.Conditional; with Alire.Conditional.Vectors; +with Alire.Dependencies.Vectors; with Alire.Properties; with Alire.Requisites; package Alire.Conditions with Preelaborate is + package For_Dependencies is new Conditional (Dependencies.Vectors.Vector, + Dependencies.Vectors."and"); + package Dependencies is new For_Dependencies.Vectors; + -- Conditional dependencies + package For_Properties is new Conditional (Properties.Vector, Properties."and"); - package Properties is new For_Properties.Vectors; -- Conditional properties declared therein + package Properties is new For_Properties.Vectors; + -- Conditional properties declared therein end Alire.Conditions; diff --git a/src/alire-dependencies.ads b/src/alire-dependencies.ads index 859e848d..3cbafda8 100644 --- a/src/alire-dependencies.ads +++ b/src/alire-dependencies.ads @@ -1,5 +1,7 @@ private with Ada.Containers.Indefinite_Holders; +limited with Alire.Dependencies.Vectors; + with Semantic_Versioning; package Alire.Dependencies with Preelaborate is @@ -17,6 +19,9 @@ package Alire.Dependencies with Preelaborate is function Image (Dep : Dependency) return String; + subtype Vector is Dependencies.Vectors.Vector; + -- Thanks to limited with -- amazing + private use all type Semantic_Versioning.Version; diff --git a/src/alire-index.adb b/src/alire-index.adb index a7f6abf2..5834d0b4 100644 --- a/src/alire-index.adb +++ b/src/alire-index.adb @@ -37,13 +37,16 @@ package body Alire.Index is -- Register -- -------------- - function Register (Project : Project_Name; + function Register (-- Mandatory + Project : Project_Name; Version : Semantic_Versioning.Version; Description : Project_Description; Origin : Origins.Origin; - Depends_On : Dependencies := No_Dependencies; - Properties : Release_Properties := No_Properties; - Available_When : Alire.Requisites.Tree := No_Requisites) return Release + -- Optional + Depends_On : Release_Dependencies := No_Dependencies; + Properties : Release_Properties := No_Properties; + Available_When : Alire.Requisites.Tree := No_Requisites) + return Release is begin return Rel : constant Alire.Releases.Release := diff --git a/src/alire-index.ads b/src/alire-index.ads index f260438b..06f520ea 100644 --- a/src/alire-index.ads +++ b/src/alire-index.ads @@ -23,26 +23,26 @@ with Semantic_Versioning; package Alire.Index is Releases : Containers.Release_Set; - + + subtype Release_Dependencies is Conditions.Dependencies.Vector; subtype Release_Properties is Conditions.Properties.Vector; - subtype Dependencies is Alire.Dependencies.Vectors.Vector; - - No_Dependencies : constant Dependencies := Alire.Dependencies.Vectors.No_Dependencies; - No_Properties : constant Release_Properties := Conditions.Properties.Empty_Vector; - No_Requisites : constant Requisites.Tree := Requisites.Trees.Empty_Tree; + No_Dependencies : constant Release_Dependencies := Conditions.Dependencies.Empty_Vector; + No_Properties : constant Release_Properties := Conditions.Properties.Empty_Vector; + No_Requisites : constant Requisites.Tree := Requisites.Trees.Empty_Tree; subtype Release is Alire.Releases.Release; function Register (-- Mandatory Project : Project_Name; - Version : Semantic_Versioning.Version; + Version : Semantic_Versioning.Version; Description : Project_Description; Origin : Origins.Origin; -- Optional - Depends_On : Dependencies := No_Dependencies; - Properties : Release_Properties := No_Properties; - Available_When : Alire.Requisites.Tree := No_Requisites) return Release; + Depends_On : Release_Dependencies := No_Dependencies; + Properties : Release_Properties := No_Properties; + Available_When : Alire.Requisites.Tree := No_Requisites) + return Release; -- Properties are of the Release -- Requisites are properties that dependencies have to fulfill, not used yet. -- Available_On are properties the platform has to fulfill. @@ -50,37 +50,65 @@ package Alire.Index is --------------------- -- BASIC QUERIES -- --------------------- - - + + function Exists (Project : Project_Name; Version : Semantic_Versioning.Version) return Boolean; function Find (Project : Project_Name; Version : Semantic_Versioning.Version) return Release; - + ------------------------ -- INDEXING SUPPORT -- ------------------------ - + -- Shortcuts for common origins: - + function Native (Pack : String ) return Origins.Origin renames Origins.New_Native; function Git (URL : Alire.URL; Commit : Origins.Git_Commit) return Origins.Origin renames Origins.New_Git; function Hg (URL : Alire.URL; Commit : Origins.Hg_Commit) return Origins.Origin renames Origins.New_Hg; -- Shortcuts to give dependencies: - function V (Semantic_Version : String) return Semantic_Versioning.Version - renames Semantic_Versioning.New_Version; + package Semver renames Semantic_Versioning; - function Current (R : Release) return Dependencies; + function V (Semantic_Version : String) return Semver.Version + renames Semver.New_Version; + + function On (Name : Project_Name; Versions : Semver.Version_Set) + return Conditions.Dependencies.Vector is + (Conditions.Dependencies.New_Unconditional + (Dependencies.Vectors.New_Dependency (Name, Versions))); + -- This shortcut is mostly for use here, since version sets will usually be + -- constructed directly with a project, using one of the following + + -- We provide two easy shortcut forms: + -- One, using another release, from which we'll take name and version + -- The advantage is that strong typing is used + -- Two, using a name plus a textual version + -- Simpler if there's no exact release matching the versions we want to say + -- Also needed for the generated _alr files which don't know package names + + function Current (R : Release) return Release_Dependencies is + (On (R.Project, + Semver.Within_Major (Semver.New_Version (Semver.Major (R.Version))))); -- Within the major of R, -- it will accept the newest/oldest version according to the resolution policy (by default, newest) -- Note: it might be older than R itself - - function Within_Major (R : Release) return Dependencies; - function Within_Minor (R : Release) return Dependencies; + + generic + with function Condition (V : Semver.Version) return Semver.Version_Set; + function From_Release (R : Release) return Release_Dependencies; + -- Just another shortcut for the following declarations + + function Within_Major is new From_Release (Semver.Within_Major); + function Within_Minor is new From_Release (Semver.Within_Minor); + + function Within_Major (R : Release) return Release_Dependencies is + (On (R.Project, Semver.Within_Major (R.Version))); + function Within_Minor (R : Release) return Release_Dependencies is + (On (R.Project, Semver.Within_Minor (R.Version))); function At_Least (R : Release) return Dependencies; function At_Most (R : Release) return Dependencies; @@ -92,9 +120,9 @@ package Alire.Index is subtype Version is Semantic_Versioning.Version; subtype Version_Set is Semantic_Versioning.Version_Set; - function Current (P : Project_Name) return Dependencies; + function Current (P : Project_Name) return Dependencies; -- Will accept the newest/oldest version according to the resolution policy (by default, newest) - + function Within_Major (P : Project_Name; V : Version) return Dependencies; function Within_Minor (P : Project_Name; V : Version) return Dependencies; @@ -105,64 +133,81 @@ package Alire.Index is function Exactly (P : Project_Name; V : Version) return Dependencies; function Except (P : Project_Name; V : Version) return Dependencies; - -- Shortcuts for properties/requisites: - + -- Shortcuts for properties/requisites: + use all type Alire.Dependencies.Vectors.Vector; use all type GPR.Value; use all type GPR.Value_Vector; use all type Licensing.Licenses; - use all type Platforms.Compilers; + use all type Platforms.Compilers; use all type Platforms.Distributions; use all type Platforms.Operating_Systems; - use all type Properties.Property'Class; + use all type Properties.Property'Class; use all type Release_Properties; - use all type Requisites.Requisite'Class; - use all type Requisites.Tree; - -- These "use all" are useful for alire-index-* packages, but not for project_alr metadata files - + use all type Requisites.Tree; + -- Function for introducing conditional properties function If_Platform (Condition : Requisites.Tree; When_True : Properties.Vector; When_False : Properties.Vector := Properties.No_Properties) return Release_Properties; - - -- "Typed" attributes (named pairs of label-value) - function Author is new Properties.Labeled.Generic_New_Label (Properties.Labeled.Author); - function Comment is new Properties.Labeled.Generic_New_Label (Properties.Labeled.Comment); - function Comment is new Properties.Labeled.Inconditional_New_Label (Properties.Labeled.Comment); - function Executable is new Properties.Labeled.Generic_New_Label (Properties.Labeled.Executable); - function GPR_File is new Properties.Labeled.Generic_New_Label (Properties.Labeled.GPR_File); - function GPR_Free_Scenario (Name : String) return Properties.Vector; - function GPR_Scenario (Name : String; Values : GPR.Value_Vector) return Properties.Vector; - function Maintainer is new Properties.Labeled.Generic_New_Label (Properties.Labeled.Maintainer); - function Website is new Properties.Labeled.Generic_New_Label (Properties.Labeled.Website); - - function License (L : Licensing.Licenses) return Properties.Vector is - (+Properties.Licenses.Values.New_Property (L)); - - function "and" (Dep1, Dep2 : Dependencies) return Dependencies renames Alire.Dependencies.Vectors."and"; + + -- Attributes (named pairs of label-value) + -- We need them as Properties.Vector (inside conditionals) but also as + -- Conditional vectors (although with unconditional value inside) + package PL renames Properties.Labeled; + + function Author is new PL.Generic_New_Label (Properties.Labeled.Author); + function Author is new PL.Unconditional_New_Label (Properties.Labeled.Comment); + + function Comment is new PL.Generic_New_Label (Properties.Labeled.Comment); + function Comment is new PL.Unconditional_New_Label (Properties.Labeled.Comment); + + function Executable is new PL.Generic_New_Label (Properties.Labeled.Executable); + function Executable is new PL.Unconditional_New_Label (Properties.Labeled.Executable); + + function GPR_File is new PL.Generic_New_Label (Properties.Labeled.GPR_File); + function GPR_File is new PL.Unconditional_New_Label (Properties.Labeled.Executable); + + function Maintainer is new PL.Generic_New_Label (Properties.Labeled.Maintainer); + function Maintainer is new PL.Unconditional_New_Label (Properties.Labeled.Maintainer); + + function Website is new PL.Generic_New_Label (Properties.Labeled.Website); + function Website is new PL.Unconditional_New_Label (Properties.Labeled.Website); + + -- Non-label attributes require a custom builder function + function GPR_Free_Scenario (Name : String) return Properties.Vector is (+Properties.Scenarios.New_Variable (GPR.Free_Variable (Name))); + function GPR_Free_Scenario (Name : String) return Conditions.Properties.Vector is (Conditions.Properties.New_Unconditional (GPR_Free_Scenario (Name))); + + function GPR_Scenario (Name : String; Values : GPR.Value_Vector) return Properties.Vector is (+Properties.Scenarios.New_Variable (GPR.Enum_Variable (Name, Values))); + function GPR_Scenario (Name : String; Values : GPR.Value_Vector) return Conditions.Properties.Vector is (Conditions.Properties.New_Unconditional (GPR_Scenario (Name, Values))); + + function License (L : Licensing.Licenses) return Properties.Vector is (+Properties.Licenses.Values.New_Property (L)); + function License (L : Licensing.Licenses) return Conditions.Properties.Vector is (Conditions.Properties.New_Unconditional (License (L))); + + function "and" (D1, D2 : Dependencies.Vector) return Dependencies.Vector renames Alire.Dependencies.Vectors."and"; function "and" (P1, P2 : Properties.Vector) return Properties.Vector renames Alire.Properties."and"; - function Verifies (P : Properties.Property'Class) return Properties.Vector; - function "+" (P : Properties.Property'Class) return Properties.Vector renames Verifies; - - function Requires (R : Requisites.Requisite'Class) return Requisites.Tree; - function "+" (R : Requisites.Requisite'Class) return Requisites.Tree renames Requires; +-- function Verifies (P : Properties.Property'Class) return Properties.Vector; +-- function "+" (P : Properties.Property'Class) return Properties.Vector renames Verifies; +-- +-- function Requires (R : Requisites.Requisite'Class) return Requisites.Tree; +-- function "+" (R : Requisites.Requisite'Class) return Requisites.Tree renames Requires; -- Specific shortcuts: function Compiler_Is_At_Least (V : Platforms.Compilers) return Requisites.Tree - renames Requisites.Platform.Compiler_Is_At_Least; + renames Requisites.Platform.Compiler_Is_At_Least; - function Distribution_Is (V : Platforms.Distributions) return Requisites.Tree + function Distribution_Is (V : Platforms.Distributions) return Requisites.Tree renames Requisites.Platform.Distribution_Is; - + function System_is (V : Platforms.Operating_Systems) return Requisites.Tree renames Requisites.Platform.System_Is; - + -- Other useful functions - + function "/" (L, R : String) return String is (Ada.Directories.Compose (L, R)); - -- Path composition. + -- Path composition. -- FIXME: hardcoded path separators shouldn't reach the index, not sure how to force-prevent this... ---------------------- @@ -171,23 +216,28 @@ package Alire.Index is function Set_Root_Project (Project : Alire.Project_Name; Version : Semantic_Versioning.Version; - Depends_On : Alire.Index.Dependencies := Alire.Index.No_Dependencies) + Depends_On : Conditions.Dependencies.Vector := + Conditions.Dependencies.Empty_Vector) return Release renames Root_Project.Set; -- 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 - - use Semantic_Versioning; + +private + + function From_Release (R : Release) return Release_Dependencies is + (On (R.Project, Condition (R.Version))); + -- Body for the generic above + + use Semantic_Versioning; function Current (R : Release) return Dependencies is (New_Dependency (R.Project, Within_Major (New_Version (Major (R.Version))))); - + function Within_Major (R : Release) return Dependencies is (New_Dependency (R.Project, Within_Major (R.Version))); - - function Within_Minor (R : Release) return Dependencies is + + function Within_Minor (R : Release) return Dependencies is (New_Dependency (R.Project, Within_Minor (R.Version))); function At_Least (R : Release) return Dependencies is @@ -211,10 +261,10 @@ private function Current (P : Project_Name) return Dependencies is (New_Dependency (P, At_Least (V ("0.0.0")))); - + function Within_Major (P : Project_Name; V : Version) return Dependencies is (New_Dependency (P, Within_Major (V))); - + function Within_Minor (P : Project_Name; V : Version) return Dependencies is (New_Dependency (P, Within_Minor (V))); @@ -242,14 +292,7 @@ private function Requires (R : Requisites.Requisite'Class) return Requisites.Tree is (Requisites.Trees.Leaf (R)); - - -- Property builders - function GPR_Free_Scenario (Name : String) return Properties.Vector is - (+Properties.Scenarios.New_Variable (GPR.Free_Variable (Name))); - - function GPR_Scenario (Name : String; Values : GPR.Value_Vector) return Properties.Vector is - (+Properties.Scenarios.New_Variable (GPR.Enum_Variable (Name, Values))); - + function If_Platform (Condition : Requisites.Tree; When_True : Properties.Vector; When_False : Properties.Vector := Properties.No_Properties) return Release_Properties is diff --git a/src/alire-platforms.ads b/src/alire-platforms.ads index cedabaab..45533729 100644 --- a/src/alire-platforms.ads +++ b/src/alire-platforms.ads @@ -11,11 +11,14 @@ package Alire.Platforms with Preelaborate is Unsupported); type Distributions is (Debian_Buster, + Ubuntu_Xenial, + Ubuntu_Yakkety, + Ubunty_Zesty, Ubuntu_Artful, Unsupported); -- Known flavors of OSs -- It turns out that Debian uses no numbers for its non-stable releases, so we'll prefer the codename - -- These are important mostly to tie platform package names to releases + -- Not really used very much for now type Package_Managers is (Apt, Unsupported); diff --git a/src/alire-properties-labeled.ads b/src/alire-properties-labeled.ads index 2d623d0e..2078316b 100644 --- a/src/alire-properties-labeled.ads +++ b/src/alire-properties-labeled.ads @@ -31,7 +31,7 @@ package Alire.Properties.Labeled with Preelaborate is generic Name : Labels; - function Inconditional_New_Label (Value : String) return Conditions.Properties.Vector; + function Unconditional_New_Label (Value : String) return Conditions.Properties.Vector; private @@ -50,8 +50,9 @@ private function Generic_New_Label (Value : String) return Properties.Vector is (To_Vector (New_Label (Name, Value), 1)); - function Inconditional_New_Label (Value : String) return Conditions.Properties.Vector is - (Conditions.Properties.New_Inconditional (+New_Label (Name, Value))); + function Unconditional_New_Label (Value : String) return Conditions.Properties.Vector is + (Conditions.Properties.New_Unconditional + (+New_Label (Name, Value))); overriding function Image (L : Label) return String is (Utils.To_Mixed_Case (L.Name'Img) & ": " & L.Value); diff --git a/src/alire-releases.adb b/src/alire-releases.adb index 1a061bb7..22358d6f 100644 --- a/src/alire-releases.adb +++ b/src/alire-releases.adb @@ -61,7 +61,7 @@ package body Alire.Releases is procedure Print_Conditional_Property (Cond : Conditions.For_Properties.Conditional_Value) is use GNAT.IO; begin - if Cond.Is_Inconditional then + if Cond.Is_Unconditional then Cond.True_Value.Print (Prefix => " "); else if Cond.True_Value.Is_Empty then @@ -151,7 +151,7 @@ package body Alire.Releases is R.Description, R.Version, R.Origin, - R.Depends_On, + R.Dependencies.Evaluate (P), R.Properties.Evaluate (P), R.Available) do diff --git a/src/alire-releases.ads b/src/alire-releases.ads index 3657ac0e..af7ef476 100644 --- a/src/alire-releases.ads +++ b/src/alire-releases.ads @@ -1,5 +1,5 @@ with Alire.Conditions; -with Alire.Dependencies.Vectors; +with Alire.Dependencies; with Alire.Milestones; with Alire.Origins; with Alire.Properties; @@ -13,114 +13,117 @@ private with Alire.Properties.Labeled; package Alire.Releases with Preelaborate is - subtype Dependencies is Alire.Dependencies.Vectors.Vector; - type Release (<>) is tagged private; function New_Release (Name : Project_Name; Description : Project_Description; Version : Semantic_Versioning.Version; Origin : Origins.Origin; - Depends_On : Dependencies; + Depends_On : Conditions.Dependencies.Vector; Properties : Conditions.Properties.Vector; Available : Alire.Requisites.Tree) return Release; - function "<" (L, R : Release) return Boolean; - + function "<" (L, R : Release) return Boolean; + function Whenever (R : Release; P : Properties.Vector) return Release; - -- Materialize conditions in a Release once the system/whatever properties are known + -- Materialize conditions in a Release once the whatever properties are known + -- At present only platform properties 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 Depends (R : Release; + P : Properties.Vector := Properties.No_Properties) + return Dependencies.Vector; function Origin (R : Release) return Origins.Origin; function Available (R : Release) return Requisites.Tree; function Default_Executable (R : Release) return String; -- We encapsulate here the fixing of platform extension - + function Executables (R : Release) return Utils.String_Vector; -- Only explicity declared ones - + function GPR_Files (R : Release) return Utils.String_Vector; -- Explicitly declared ones, or if default one if none declared - + function Image (R : Release) return Path_String; -- Unique string built as name_version_id function Unique_Folder (R : Release) return Path_String renames Image; function Milestone (R : Release) return Milestones.Milestone; - + procedure Print (R : Release); -- Dump info to console - + -- Search helpers - + function Property_Contains (R : Release; Str : String) return Boolean; -- True if some property contains the given string private - + use Properties; - function Describe is new Properties.Labeled.Generic_New_Label (Properties.Labeled.Description); + function Describe is new Properties.Labeled.Generic_New_Label (Properties.Labeled.Description); type Release (Name_Len, Descr_Len : Natural) is tagged record - Name : Project_Name (1 .. Name_Len); - Description : Project_Description (1 .. Descr_Len); - Version : Semantic_Versioning.Version; - Origin : Origins.Origin; - Depends_On : Dependencies; - Properties : Conditions.Properties.Vector; --- Reqs : Requisites.Tree; - Available : Requisites.Tree; + Name : Project_Name (1 .. Name_Len); + Description : Project_Description (1 .. Descr_Len); + Version : Semantic_Versioning.Version; + Origin : Origins.Origin; + Dependencies : Conditions.Dependencies.Vector; + Properties : Conditions.Properties.Vector; + Available : Requisites.Tree; end record; use Conditions.Properties; - + function New_Release (Name : Project_Name; Description : Project_Description; Version : Semantic_Versioning.Version; Origin : Origins.Origin; - Depends_On : Dependencies; + Depends_On : Conditions.Dependencies.Vector; Properties : Conditions.Properties.Vector; Available : Alire.Requisites.Tree) return Release is (Name'Length, Description'Length, Name, - Description, + Description, Version, Origin, Depends_On, - +Conditions.For_Properties.New_Inconditional (Describe (Description)) and Properties, + +Conditions.For_Properties.New_Unconditional (Describe (Description)) and Properties, Available); - + use Semantic_Versioning; function "<" (L, R : Release) return Boolean is (L.Name < R.Name or else - (L.Name = R.Name and then + (L.Name = R.Name and then L.Version < R.Version) or else - (L.Name = R.Name and then - L.Version = R.Version and then + (L.Name = R.Name and then + L.Version = R.Version and then Build (L.Version) < Build (R.Version))); 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); + function Depends (R : Release; + P : Properties.Vector := Properties.No_Properties) + return Dependencies.Vector is + (R.Dependencies.Evaluate (P)); function Origin (R : Release) return Origins.Origin is (R.Origin); function Available (R : Release) return Requisites.Tree is (R.Available); - - function Milestone (R : Release) return Milestones.Milestone is + + function Milestone (R : Release) return Milestones.Milestone is (Milestones.New_Milestone (R.Name, R.Version)); - + function Default_Executable (R : Release) return String is (R.Name & OS_Lib.Exe_Suffix); - + function Image (R : Release) return Path_String is (R.Name & "_" & Image (R.Version) & "_" & - (if R.Origin.Id'Length <= 8 then R.Origin.Id + (if R.Origin.Id'Length <= 8 then R.Origin.Id else R.Origin.Id (R.Origin.Id'First .. R.Origin.Id'First + 7))); end Alire.Releases; diff --git a/src/alire-root_project.adb b/src/alire-root_project.adb index 2f20c3e8..11571b7d 100644 --- a/src/alire-root_project.adb +++ b/src/alire-root_project.adb @@ -1,7 +1,6 @@ with Ada.Directories; -with Alire.Conditions; with Alire.Containers; with Alire.Index; with Alire.Origins; @@ -33,7 +32,8 @@ package body Alire.Root_Project is function Set (Project : Alire.Project_Name; Version : Semantic_Versioning.Version; - Depends_On : Alire.Dependencies.Vectors.Vector := Alire.Dependencies.Vectors.No_Dependencies) + Depends_On : Conditions.Dependencies.Vector := + Conditions.Dependencies.Empty_Vector) return Releases.Release is use Origins; diff --git a/src/alire-root_project.ads b/src/alire-root_project.ads index fd8d8191..ed9f462a 100644 --- a/src/alire-root_project.ads +++ b/src/alire-root_project.ads @@ -1,4 +1,4 @@ -with Alire.Dependencies.Vectors; +with Alire.Conditions; with Alire.Releases; with Semantic_Versioning; @@ -9,9 +9,10 @@ package Alire.Root_Project is -- Besides the important Set_Root_Project, unfortunately it renames most of Alire.Index to -- make it directly visible in project_alr.ads - function Set (Project : Alire.Project_Name; + function Set (Project : Project_Name; Version : Semantic_Versioning.Version; - Depends_On : Alire.Dependencies.Vectors.Vector := Alire.Dependencies.Vectors.No_Dependencies) + Depends_On : Conditions.Dependencies.Vector := + Conditions.Dependencies.Empty_Vector) return Releases.Release; -- 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