Skip to content
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

Conform fails to parse schema for umbrella app during release generation #132

Open
asdfzxcx opened this issue Jul 31, 2017 · 3 comments
Open

Comments

@asdfzxcx
Copy link

Hi

I've been migrating my umbrella project to Erlang 20 and Elixir 1.5.0. I upgraded confrom from 2.1.2 to 2.5.0 to get latest fixes for Elixir 1.5.0 but now I have an error from conform plugin during release generation with distillery.

==> Assembling release..
==> Building release conform_umbrella_test:0.1.0 using environment dev
==> Plugin failed: Invalid schema at line 74: syntax error before: [<<"second_app.another_var">>].

I looked at the schema by dumping input argument for Conform.Schema.parse!/1 and got this in transform section:

  transforms: [
    "first_app.my_var": #Function<6.99386804/1 in :erl_eval.expr/5>,
    "second_app.another_var": #Function<6.99386804/1 in :erl_eval.expr/5> # <-- line 74
  ],

Full schema from this step can be seen here.

I also checked non-umbrella app release generation and it works fine with similar case (using transforms). Instead of inspected anonymous functions in transform section (like in example above), there were actual functions text, which I assume is how it should be.

I've made a demo app which reproduces umbrella case https://github.com/tenkai9/conform_umbrella_test

@jerel
Copy link

jerel commented Mar 27, 2018

@bitwalker do you have any ideas what may be going on here? Anonymous functions do not appear to work for transforms (at least in umbrella projects). I've been a ways down the rabbit hole and can't figure out what's going on. When I start a shell and read the file, then call Code.string_to_quoted, and Code.eval_quoted it evals fine but when building a release it thinks there's a syntax error.

@surik
Copy link

surik commented Apr 27, 2018

Hi, I'm experiencing the same issue and trying to understand what the problem is.

For me it looks that Conform.ReleasePlugin does Conform.Schema.load and then writes result to a temporary file. The problem is that Conform.Schema.load is not made that way to use it to writing a file. The load function basically does the following:

iex(8)> Code.string_to_quoted!("fn -> :ok end") |> Code.eval_quoted
{#Function<20.99386804/0 in :erl_eval.expr/5>, []}

See https://github.com/bitwalker/conform/blob/master/lib/conform/schema.ex#L87

I think to solve this issue we need to use another version of load function in Conform.ReleasePlugin which does roughly the same:

iex(10)> Code.string_to_quoted!("fn -> :ok end") |> Macro.to_string
"fn -> :ok end"

@Stratus3D
Copy link

I also experienced this same issue on version 2.5.2. Downgrading to 2.1.2 fixed the issue. I also tried version 2.3.9 and it did not work either.

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

No branches or pull requests

4 participants