-
Notifications
You must be signed in to change notification settings - Fork 410
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
Sort out recursive/non-recursive aliases #268
Conversation
Interpret then while loading the file tree.
Calling 'jbuilder build @path/x' always request the alias `x` in `path` and all its descendant. To implement that, change the build system interface to take an arbitrary request as argument.
(alias_rec XXX) means the same as @xxx on the command line.
src/alias.ml
Outdated
~else_:(Build.arr (fun x -> x))) | ||
>>^ fun is_empty -> | ||
if is_empty && not (is_standard name) then | ||
Loc.fail loc "This recursive alias is empty.\n\ |
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.
"recursive" should be probably be removed from this error message if recursive aliases no longer exist.
e3b2781
to
7232176
Compare
let path = File_tree.Dir.path dir in | ||
let t = of_path (Path.relative path name) in | ||
acc | ||
>>> |
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.
Curious if the sequencing here is actually necessary. Seems like this could be done in parallel?
Whoops, I just forgot to update the test output locally. |
The order of some commands changed. However, the same commands are still being executed.
7fdd163
to
192f668
Compare
all aliases are non recursive
bbdfe03
to
02a4c59
Compare
Useful for debugging
I've added some pretty printers to this PR that helped me understand how the alias stuff works. It's very useful to be able to inspect the alias store. Others might find it useful as well. |
per-directory. However, on the command line, asking for an alias to | ||
be built in a given directory will trigger the construction of the | ||
alias in all children directories recursively. Jbuilder defines the | ||
following standard aliases: | ||
|
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.
Could you also document the non recursive use on the command line. If you write jbuilder build src/x
it means just build the alias x
in directory src
. The API seems to allow it no?
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.
Did you mean @src/x
? I'm not aware that it's possible to ask for an alias to be built without it. I just gave it a try as well and it doesn't seem work.
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.
Oh, so there is no way to call for an alias from the command line in a non-recursive way. Perhaps it would be good to add that in the future.
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.
I personally don't have much of a need for non recursive invocations. But sure, if it's easy, let's add it.
Sorry It seems I forgot to click a second time to submit the review, that I have done some days ago... |
Fixes #253.
ThisPR removes the special recursive aliases
runtest
,install
anddoc
. Now all aliases are non-recursive. However, the interpretation of aliases on the command line is changed so that when the user types:this is interpreted as alias
x
in all descendant ofsrc
where it is defined. This way the interpretation of@runtest
,@install
and@doc
is unchanged and users can define their own global aliases such asexamples
,runtest-js
, ...Inside jbuild files, one can use
(deps (... (alias_rec XXX) ...))
to get the same behavior.In any case, when the alias is defined in none of the descendant of the specified directory, jbuilder reports an error. Except for
runtest
,install
anddoc
as this could break existing invocations of jbuilder.