Skip to content

[WIP] Expand variables in install stanzas - #962

Closed
Isweet wants to merge 1 commit into
ocaml:masterfrom
Isweet:iss690
Closed

Isweet wants to merge 1 commit into
ocaml:masterfrom
Isweet:iss690

Conversation

@Isweet

@Isweet Isweet commented Jul 7, 2018 •

Copy link
Copy Markdown

Overview

This PR reflects my work towards fixing issue #690.

NOTE: I will file another PR (or perhaps repurpose this one), with a squashed + signed-off commit when the work is done. This is just for documentation + discussion on progress.

Progress

  • Switch Install_conf.file to use String_with_vars.t
  • Fix parser(s) for Install_conf.file
  • Eliminate instances of String_with_vars.t into OCaml strings using String_with_vars.expand

Questions

  1. Which variables can / cannot be supported in install stanzas?
  2. Where should variables be expanded? Eagerly? Lazily?
  3. When generating a literal String_with_vars.t from a string, is String_with_vars.virt_text the correct way? Is using a dummy position appropriate? Since we know this is a literal, we don't expect to ever use the position (e.g. in an error message).

@rgrinberg

Copy link
Copy Markdown
Member

Thanks for the PR. So I would suggest #956 to be merged before addressing the questions you've passed. It should make addressing these issues much more straight forward.

To answer your question briefly however (these questions assume the contents of #956):

  1. Any variable in the vars field of the super context that expands to a Kind.Values or Kind.Project_root should be valid. Basically anything that the to_value_no_deps_or_targets function will return Some for. At a high level, we should be able to expand value that we know prior to running any of the rules. This will include most forms (%{foo:bar} like things) and the special dependency and target variables.

  2. The variables will have to be expanded as we generate the rules for the install alias. Should be around here: https://github.com/rgrinberg/jbuilder/blob/lowercase-builtin-vars/src/install_rules.ml#L312-L315

  3. virt_text sounds right. If the position is really never guaranteed to leak to the user, I'd suggest to use the __LOC__ special variable. In any case, we'll hint you at the correct position once you have that code up.

@rgrinberg

Copy link
Copy Markdown
Member

The PR in question has been merged. Things should be a lot more obvious (see pform.ml)

@rgrinberg rgrinberg added this to the 1.1.0 milestone Jul 11, 2018
@rgrinberg rgrinberg removed this from the 1.1.0 milestone Aug 6, 2018
@mseri

mseri commented Sep 25, 2018

Copy link
Copy Markdown
Member

I am happy to pick this up, if @lsweet does not have time for it

@Isweet

Isweet commented Sep 25, 2018 via email

Copy link
Copy Markdown
Author

@mseri

mseri commented Sep 27, 2018

Copy link
Copy Markdown
Member

@rgrinberg

Copy link
Copy Markdown
Member

@mseri would you mind putting up a PR as a WIP? It will be easier for us to leave comments on the code.

@mseri

mseri commented Sep 28, 2018

Copy link
Copy Markdown
Member

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants