-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempt at implementing aliases #7
Conversation
src/gen_rules.ml
Outdated
let source = | ||
match alias_conf.action with | ||
| None -> "" | ||
| Some a -> Sexp.to_string (User_action.Unexpanded.sexp_of_t a) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have:
| None -> "none"
| Some a -> "some" ^ ...
otherwise no action and ""
would produce the same digest. ""
would fail anyway since it is not a valid bash command, but you could get an error about multiple rules generated for a weird target, which is not great. Thinking about it, we should probably include the dependencies in the digest, otherwise we would get a clash in this case:
(alias
((name runtest)
(deps (prog.exe file1)
(action "./${*}")))
(alias
((name runtest)
(deps (prog.exe file2)
(action "./${*}")))
src/gen_rules.ml
Outdated
| None -> "" | ||
| Some a -> Sexp.to_string (User_action.Unexpanded.sexp_of_t a) in | ||
Digest.to_hex (Digest.string source) in | ||
let digest_path = Path.of_string (alias_conf.name ^ digest) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be Path.relative ~dir (alias_conf.name ^ digest)
.
For the basename we should use the same file prefix as Alias.make
, so we could have: Path.basename (Alias.file alias) ^ "-" ^ digest
Thanks, except for the two comments I left, it seems to me that this should work |
src/jbuild_types.ml
Outdated
| File t -> | ||
List [Atom "file" ; String_with_vars.sexp_of_t t] | ||
| Alias t -> | ||
List [Atom "file" ; String_with_vars.sexp_of_t t] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this supposed to be "alias"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed
src/jbuild_types.ml
Outdated
| File t -> | ||
List [Atom "file" ; String_with_vars.sexp_of_t t] | ||
| Alias t -> | ||
List [Atom "file" ; String_with_vars.sexp_of_t t] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed
* Properly include option * Add dependencies to the digest
Fixed that typo. |
thanks. Now we just need a |
I didn't attempt at tackle any of the usability questions. Because my current
implementation is looking very shake.
Looking forward to a lot of feedback.