Cannot compile gleam dependencies (but gleam compilation works)
scullionw opened this issue · 2 comments
following the readme, i can successfully use my gleam code from elixir!
however i cannot use any dependency. for example i tried using import gleam/int
by adding {:gleam_stdlib, "~> 0.28"}
to my mix.exs
defmodule LiveViewStudio.MixProject do
use Mix.Project
@app :live_view_studio
def project do
[
app: @app,
version: "0.1.0",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
archives: [mix_gleam: "~> 0.6.1"],
compilers: [:gleam | Mix.compilers()],
aliases: ["deps.get": ["deps.get", "gleam.deps.get"]],
erlc_paths: [
"build/dev/erlang/#{@app}/_gleam_artefacts",
"build/dev/erlang/#{@app}/build"
],
erlc_include_path: "build/dev/erlang/#{@app}/include"
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {LiveViewStudio.Application, []},
extra_applications: [:logger, :runtime_tools]
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.7.9"},
{:phoenix_ecto, "~> 4.4"},
{:ecto_sql, "~> 3.10"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 3.3"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 0.20.1"},
{:heroicons, "~> 0.5"},
{:floki, ">= 0.30.0", only: :test},
{:phoenix_live_dashboard, "~> 0.8.2"},
{:esbuild, "~> 0.7", runtime: Mix.env() == :dev},
{:tailwind, "~> 0.2.0", runtime: Mix.env() == :dev},
{:swoosh, "~> 1.3"},
{:finch, "~> 0.13"},
{:telemetry_metrics, "~> 0.6"},
{:telemetry_poller, "~> 1.0"},
{:gettext, "~> 0.21.0"},
{:jason, "~> 1.2"},
{:plug_cowboy, "~> 2.5"},
{:bcrypt_elixir, "~> 3.0"},
{:faker, "~> 0.17.0"},
{:number, "~> 1.0"},
{:timex, "~> 3.7"},
{:mix_gleam, "~> 0.6.1"},
{:gleam_stdlib, "~> 0.28", app: false} # <------- Adding this does not work without app: false, which just skips compilation
]
end
# Aliases are shortcuts or tasks specific to the current project.
# For example, to install project dependencies and perform other setup tasks, run:
#
# $ mix setup
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
[
setup: ["deps.get", "ecto.setup", "assets.setup", "assets.build"],
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
"assets.setup": [
"tailwind.install --if-missing",
"esbuild.install --if-missing"
],
"assets.build": [
"tailwind default",
"esbuild default"
],
"assets.deploy": [
"tailwind default --minify",
"esbuild default --minify",
"phx.digest"
]
]
end
end
i get
Could not compile :gleam_stdlib, no "mix.exs", "rebar.config" or "Makefile" (pass :compile as an option to customize compilation, set it to "false" to do nothing)
Unchecked dependencies for environment dev:
* gleam_stdlib (Hex package)
could not find an app file at "_build/dev/lib/gleam_stdlib/ebin/gleam_stdlib.app". This may happen if the dependency was not yet compiled or the dependency indeed has no app file (then you can pass app: false as option)
** (Mix) Can't continue due to errors on dependencies
Manually compiling gives the same error:
$ mix deps.compile gleam_stdlib
Could not compile :gleam_stdlib, no "mix.exs", "rebar.config" or "Makefile" (pass :compile as an option to customize compilation, set it to "false" to do nothing)
The only difference i can find with the mix_gleam
readme is that i added it as a dep in addition to the archive version (as recommended in #34, otherwise i could not even get my gleam code to compile)
gleam 0.31.0
Elixir 1.15.6 (compiled with Erlang/OTP 26)
@scullionw, please see try adding prune_code_paths: false
to your mix.exs
and doing a clean build. You should also be able to remove mix_gleam
from your deps.
Closing this issue as resolved. Please feel free to open a new one if you experience any further trouble.