-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factorize evaluation function of artifact
in one private library and adds an abstract type to allow to postpone safely the evaluation. Signed-off-by: François Bobot <[email protected]>
- Loading branch information
Showing
13 changed files
with
60 additions
and
61 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ | |
(sites_locations | ||
(data_module sites_locations_data) | ||
)) | ||
(libraries dune-private-libs.artifact-eval) | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
module Private_ = struct | ||
module Helpers = Helpers | ||
module Artifact = Dune_artifact_eval | ||
end |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
(** {2 encoded} *) | ||
|
||
val hardcoded_ocamlpath: string | ||
val hardcoded_ocamlpath: Dune_artifact_eval.t | ||
|
||
val stdlib_dir: string | ||
val stdlib_dir: Dune_artifact_eval.t |
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,4 @@ | ||
(library | ||
(name dune_artifact_eval) | ||
(public_name dune-private-libs.artifact-eval) | ||
(synopsis "[Internal] evaluation of artifact subtitution format")) |
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,20 @@ | ||
type t = string | ||
|
||
(* Parse the replacement format described in [artifact_substitution.ml]. *) | ||
let get s = | ||
let len = String.length s in | ||
if s.[0] = '=' then | ||
let colon_pos = String.index_from s 1 ':' in | ||
let vlen = int_of_string (String.sub s 1 (colon_pos - 1)) in | ||
(* This [min] is because the value might have been truncated | ||
if it was too large *) | ||
let vlen = min vlen (len - colon_pos - 1) in | ||
Some (String.sub s (colon_pos + 1) vlen) | ||
else | ||
None | ||
[@@inline never] | ||
|
||
let encoded x = x | ||
[@@inline never] | ||
|
||
let eval s = get s |
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,5 @@ | ||
type t | ||
|
||
val encoded: string -> t | ||
val get: t -> string option | ||
val eval: string -> string option |
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