-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'alire/master' into debug/rmtree
- Loading branch information
Showing
33 changed files
with
766 additions
and
402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule aaa
updated
6 files
+3 −3 | alire.toml | |
+1 −1 | src/aaa-ansi.adb | |
+13 −3 | src/aaa-caches-files.adb | |
+9 −0 | src/aaa-caches-files.ads | |
+45 −24 | src/aaa-table_io.adb | |
+1 −0 | src/aaa-table_io.ads |
Submodule umwi
updated
6 files
+2 −0 | README.md | |
+1 −1 | alire.toml | |
+2 −2 | demo/src/demo.adb | |
+3 −3 | info/src/umwi-info.adb | |
+18 −15 | src/umwi.adb | |
+10 −4 | src/umwi.ads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
with Alire.Directories; | ||
with Alire.Hashes.SHA256_Impl; | ||
with Alire.Paths; | ||
with Alire.Roots; | ||
with Alire.Utils.Text_Files; | ||
|
||
package body Alire.Builds.Hashes is | ||
|
||
use Directories.Operators; | ||
|
||
package SHA renames Alire.Hashes.SHA256_Impl; | ||
|
||
subtype Variables is AAA.Strings.Set; | ||
-- We'll store all variables that affect a Release in a deterministic order | ||
|
||
----------- | ||
-- Clear -- | ||
----------- | ||
|
||
procedure Clear (This : in out Hasher) is | ||
begin | ||
This.Hashes.Clear; | ||
end Clear; | ||
|
||
-------------- | ||
-- Is_Empty -- | ||
-------------- | ||
|
||
function Is_Empty (This : Hasher) return Boolean | ||
is (This.Hashes.Is_Empty); | ||
|
||
------------- | ||
-- Compute -- | ||
------------- | ||
|
||
procedure Compute (This : in out Hasher; | ||
Root : in out Roots.Root) | ||
is | ||
|
||
------------- | ||
-- Compute -- | ||
------------- | ||
|
||
procedure Compute (Rel : Releases.Release) is | ||
Vars : Variables; | ||
|
||
--------- | ||
-- Add -- | ||
--------- | ||
|
||
procedure Add (Kind, Key, Value : String) is | ||
use AAA.Strings; | ||
Datum : constant String := | ||
Trim (Kind) & ":" | ||
& Trim (Key) & "=" | ||
& Trim (Value); | ||
begin | ||
Trace.Debug (" build hashing " & Datum); | ||
Vars.Insert (Datum); | ||
end Add; | ||
|
||
------------------ | ||
-- Compute_Hash -- | ||
------------------ | ||
|
||
procedure Compute_Hash is | ||
C : SHA.Hashing_Context; | ||
begin | ||
for Var of Vars loop | ||
SHA.Update (C, Var, Append_Nul => True); | ||
-- The nul character as separator ensures no ambiguity because | ||
-- of consecutive entries. | ||
end loop; | ||
|
||
This.Hashes.Insert (Rel.Name, SHA.Get_Digest (C)); | ||
end Compute_Hash; | ||
|
||
------------------ | ||
-- Write_Inputs -- | ||
------------------ | ||
|
||
procedure Write_Inputs is | ||
File : constant Absolute_Path := | ||
Builds.Path | ||
/ Rel.Base_Folder & "_" & This.Hashes (Rel.Name) | ||
/ Paths.Working_Folder_Inside_Root | ||
/ "build_hash_inputs"; | ||
use Directories; | ||
use Utils.Text_Files; | ||
|
||
Lines : AAA.Strings.Vector; | ||
begin | ||
-- First ensure we have a pristine file to work with | ||
Delete_Tree (File); | ||
Create_Tree (Parent (File)); | ||
Touch (File); | ||
|
||
-- Now add the hashed contents for the record | ||
|
||
for Var of Vars loop | ||
Lines.Append (Var); | ||
end loop; | ||
|
||
Append_Lines (File, | ||
Lines, | ||
Backup => False); | ||
end Write_Inputs; | ||
|
||
begin | ||
Trace.Debug (" build hashing: " & Rel.Milestone.TTY_Image); | ||
|
||
-- Build profile | ||
Add ("profile", | ||
Rel.Name.As_String, | ||
Root.Configuration.Build_Profile (Rel.Name)'Image); | ||
|
||
-- GPR externals | ||
-- TBD | ||
|
||
-- Environment variables | ||
-- TBD | ||
|
||
-- Configuration variables | ||
-- TBD | ||
|
||
-- Final computation | ||
Compute_Hash; | ||
|
||
-- Write the hash input for the record | ||
Write_Inputs; | ||
|
||
Trace.Debug (" build hashing release complete"); | ||
end Compute; | ||
|
||
begin | ||
Trace.Debug ("build hashing root " & Root.Path); | ||
This.Hashes.Clear; | ||
|
||
for Rel of Root.Solution.Releases loop | ||
if Root.Requires_Build_Sync (Rel) then | ||
Compute (Rel); | ||
end if; | ||
end loop; | ||
end Compute; | ||
|
||
---------- | ||
-- Hash -- | ||
---------- | ||
|
||
function Hash (This : in out Hasher; | ||
Name : Crate_Name) | ||
return String | ||
is (This.Hashes (Name)); | ||
|
||
end Alire.Builds.Hashes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
private with Ada.Containers.Indefinite_Ordered_Maps; | ||
|
||
limited with Alire.Roots; | ||
|
||
package Alire.Builds.Hashes is | ||
|
||
type Hasher is tagged private; | ||
-- Used to compute all build hashes for releases in a build | ||
|
||
procedure Clear (This : in out Hasher); | ||
-- Remove any cached hashes | ||
|
||
function Is_Empty (This : Hasher) return Boolean; | ||
-- Says if the Hasher has been used or not | ||
|
||
procedure Compute (This : in out Hasher; | ||
Root : in out Roots.Root); | ||
-- Compute all hashes needed for a release | ||
|
||
function Hash (This : in out Hasher; | ||
Name : Crate_Name) | ||
return String | ||
with Pre => not This.Is_Empty; | ||
-- Retrieve the hash of a crate in Root's solution | ||
|
||
private | ||
|
||
package Crate_Hash_Maps is new Ada.Containers.Indefinite_Ordered_Maps | ||
(Crate_Name, String); | ||
|
||
type Hasher is tagged record | ||
Hashes : Crate_Hash_Maps.Map; | ||
end record; | ||
|
||
end Alire.Builds.Hashes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.