Giter Club home page Giter Club logo

mix_gleam's People

Contributors

andridus avatar lpil avatar michallepicki avatar miguel-s avatar modellurgist avatar phaleth avatar silicium14 avatar tynanbe avatar xhh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mix_gleam's Issues

ElixirLS goes into a compile loop

Hi! Thank you for Gleam!

Environment:

VSCode: 1.47.3
ElixirLS extension: 0.5.0 ()
mix_gleam: 0.1.0
Elixir: 1.10.4
Erlang/OTP: 23

Steps to reproduce:

Open the basic_project in this repo in VSCode.

ElixirLS goes into a compile loop. If I remove :gleam from Project compilers in mix.exs then it completes.

The ElixirLS output loop looks like this:

[Info  - 6:26:06 PM] Compile took 1667 milliseconds
MIX_ENV: test
MIX_TARGET: 
[Info  - 6:26:06 PM] [ElixirLS WorkspaceSymbols] 0 modules need reindexing
[Info  - 6:26:06 PM] [ElixirLS WorkspaceSymbols] 0 modules added to index
[Info  - 6:26:06 PM] [ElixirLS WorkspaceSymbols] 0 functions added to index
[Info  - 6:26:06 PM] [ElixirLS WorkspaceSymbols] 0 types added to index
[Info  - 6:26:06 PM] [ElixirLS WorkspaceSymbols] 0 callbacks added to index
Compiling basic_project
Done!
Compiling 1 file (.erl)
Compiling 1 file (.ex)
[Info  - 6:26:06 PM] [ElixirLS Dialyzer] Done writing manifest in 2374 milliseconds.
[Info  - 6:26:06 PM] Compile took 772 milliseconds
[Info  - 6:26:06 PM] [ElixirLS WorkspaceSymbols] Updating index...
[Info  - 6:26:06 PM] [ElixirLS Dialyzer] Checking for stale beam files
[Info  - 6:26:07 PM] [ElixirLS Dialyzer] Found 2 changed files in 37 milliseconds
[Info  - 6:26:07 PM] [ElixirLS Dialyzer] Analyzing 0 modules: []
[Info  - 6:26:07 PM] [ElixirLS Dialyzer] Analysis finished in 42 milliseconds
MIX_ENV: test
MIX_TARGET: 
[Info  - 6:26:08 PM] [ElixirLS Dialyzer] Writing manifest...
Compiling basic_project
Done!
Compiling 1 file (.erl)
Compiling 1 file (.ex)
[Info  - 6:26:08 PM] [ElixirLS WorkspaceSymbols] 0 modules need reindexing
[Info  - 6:26:08 PM] [ElixirLS WorkspaceSymbols] 0 modules added to index
[Info  - 6:26:08 PM] [ElixirLS WorkspaceSymbols] 0 functions added to index
[Info  - 6:26:08 PM] [ElixirLS WorkspaceSymbols] 0 types added to index
[Info  - 6:26:08 PM] [ElixirLS WorkspaceSymbols] 0 callbacks added to index
[Info  - 6:26:08 PM] Compile took 1176 milliseconds

Disabling Dialyzer makes no difference.

With verbose ElixirLS logging I'm seeing examples of the below right after compilation:

[Trace - 9:14:12 PM] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "file:///Users/rala/Projects/elixir/mix_gleam/test_projects/basic_project/gen/src/basic_project.erl",
            "type": 2
        }
    ]
}

This leads me to believe that something is touching the gleam compilation output file afterwards, which triggers a new round of compilation.

I'm unsure whether this is an issue with the gleam compiler, mix_gleam, VSCode-ElixirLS or ElixirLS. With some guidance I may be able to help out more (but my spare time is limited due to my current family situation).

Cannot compile gleam dependencies (but gleam compilation works)

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)

Compiling fails with "mix deps.compile"

Honestly, I've no idea if this is a priority or perhaps a mistake on my part or anything. I continue to tell myself that I can choose to not learn rebar3 and just use gleam through mix but that might not be the case.

$ gleam --version                       
gleam 0.11.2                                                                                                                               
$ mix new gleam                        
* creating README.md                                                                                                                       
* creating .formatter.exs                                            
* creating .gitignore                                                
* creating mix.exs                                                   
* creating lib                                                       
* creating lib/gleam.ex                                              
* creating test                                                      
* creating test/test_helper.exs                                      
* creating test/gleam_test.exs                                       
                                                                     
Your Mix project was created successfully.                         
You can use "mix" to compile it, test it, and more:                
                                                                                                                                           
    cd gleam                                                                                                                               
    mix test                                                                                                                               
                                                                                                                                           
Run "mix help" for more commands.  
$ vim mix.exs   # Add {:gleam_otp, "~> 0.0.1"} to deps
$ mix deps.get                                                                                            
Resolving Hex dependencies...                                                                                                              
Dependency resolution completed:                                                                                                           
New:                                                                                                                                       
  gleam_otp 0.0.1                                                                                                                          
  gleam_stdlib 0.11.0                                                                                                                      
* Getting gleam_otp (Hex package)                                                                                                          
* Getting gleam_stdlib (Hex package)

$ mix deps.compile
===> Compiling gleam_stdlib
===> Compiling gleam_otp
===> Compiling src/gleam_otp_process_external.erl failed
src/gleam_otp_process_external.erl:16: can't find include file "gen/src/gleam@otp@process_Channel.hrl"
src/gleam_otp_process_external.erl:17: can't find include file "gen/src/gleam@otp@process_Exit.hrl"
src/gleam_otp_process_external.erl:18: can't find include file "gen/src/gleam@otp@process_PortDown.hrl"
src/gleam_otp_process_external.erl:19: can't find include file "gen/src/gleam@otp@process_PortMonitor.hrl"
src/gleam_otp_process_external.erl:20: can't find include file "gen/src/gleam@otp@process_ProcessDown.hrl"
src/gleam_otp_process_external.erl:21: can't find include file "gen/src/gleam@otp@process_ProcessMonitor.hrl"
src/gleam_otp_process_external.erl:22: can't find include file "gen/src/gleam@otp@process_StatusInfo.hrl"

src/gleam_otp_process_external.erl:79: record channel undefined
src/gleam_otp_process_external.erl:82: record process_monitor undefined
src/gleam_otp_process_external.erl:85: record port_monitor undefined
src/gleam_otp_process_external.erl:109: record process_down undefined
src/gleam_otp_process_external.erl:112: record port_down undefined
src/gleam_otp_process_external.erl:115: record exit undefined
src/gleam_otp_process_external.erl:189: record channel undefined
src/gleam_otp_process_external.erl:200: record status_info undefined
src/gleam_otp_process_external.erl:203: variable 'Debug' is unbound
src/gleam_otp_process_external.erl:203: variable 'Mode' is unbound
src/gleam_otp_process_external.erl:203: variable 'Parent' is unbound
src/gleam_otp_process_external.erl:205: variable 'Mode' is unbound
src/gleam_otp_process_external.erl:205: variable 'Parent' is unbound
src/gleam_otp_process_external.erl:205: variable 'State' is unbound
src/gleam_otp_process_external.erl:207: variable 'Mod' is unbound

src/gleam_otp_process_external.erl:108: Warning: variable 'Pid' is unused
src/gleam_otp_process_external.erl:108: Warning: variable 'Reason' is unused
src/gleam_otp_process_external.erl:111: Warning: variable 'Port' is unused
src/gleam_otp_process_external.erl:111: Warning: variable 'Reason' is unused
src/gleam_otp_process_external.erl:114: Warning: variable 'Reason' is unused
src/gleam_otp_process_external.erl:187: Warning: variable 'Pid' is unused
src/gleam_otp_process_external.erl:187: Warning: variable 'Ref' is unused
src/gleam_otp_process_external.erl:188: Warning: variable 'Send' is unused

** (Mix) Could not compile dependency :gleam_otp, "/home/michael/.mix/rebar3 bare compile --paths /tmp/gleam/_build/dev/lib/*/ebin" command failed. You can recompile this dependency with "mix deps.compile gleam_otp", update it with "mix deps.update gleam_otp" or clean it with "mix deps.clean gleam_otp"                                                                                                        

I'm very happy for this to be closed but I thought I'd share it in case it is useful to fix for some reason. I realise these libraries are a bit in flux at the moment and the mix is not a primarily supported build tool.

Doing the same with gleam new and rebar3.config doesn't seem to have a problem.

$ elixir --version
Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Elixir 1.11.1 (compiled with Erlang/OTP 23)
$ erl --version
Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Eshell V11.1  (abort with ^G)
1> 

`mix compile` fails at the root of an umbrella app if a sub-app requires gleam dependencies

Freshly clone this project and then run, from the root:

mix deps.get

Now, run

mix compile

You'll notice the following error:

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)
Could not compile :gleeunit, no "mix.exs", "rebar.config" or "Makefile" (pass :compile as an option to customize compilation, set it to "false" to do nothing)
Could not compile :gleam_erlang, 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)
* gleeunit (Hex package)
  could not find an app file at "_build/dev/lib/gleeunit/ebin/gleeunit.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)
* gleam_erlang (Hex package)
  could not find an app file at "_build/dev/lib/gleam_erlang/ebin/gleam_erlang.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

This can be resolved by re-fetching deps and compiling directly within the sub-project:

$ cd apps/hello
$ mix deps.get
$ mix compile

`mix compile` fails to compile if importing a gleam package using a local path or a git url

When the gleam dependency is imported using a git url, rather that with a version number(and thus downloaded from hex.pm), the mix compile command fails with the following error

==> some_package
Compiling 10 files (.gleam)
error: Unknown module
  ┌─ ./test/some_package_test.gleam:1:8
  │
1 │ import gleeunit
  │        ^^^^^^^^

No module has been found with the name `gleeunit`.
could not compile dependency :some_package, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile some_package", update it with "mix deps.update some_package" or clean it with "mix deps.clean some_package"
** (MixGleam) Compilation failed

gleeunit is a dev dependency of the package I'm trying to use.

The same error happens if I import the package locally using a file path instead of a git server url.

If I delete the test folder locally, then there is no error and mix compile succeeds.

Inform about gleam.toml

Should gleam.toml contain the same deps as mix.exs in regards to gleam so that gleam test, lsp and so on work while mix compile also works? Should the docs inform about this?

warning: Transitive dependency imported

Hi

After gleam v0.33 there this kind of warning being generated for mix_gleam based projects.
Is there are a way to disable these warnings. Lot of warnings are being generated.
Event though those dependencies are present in the mix.exs.

┌─ ./test/gleam_tests/utils/timeslots_test.gleam:1:1

1 │ import gleam/option
│ ^^^^^^^^^^^^^^^^^^^

The module gleam/option is being imported, but gleam_stdlib, the
package it belongs to, is not a direct dependency of your package.
In a future version of Gleam this may become a compile error.

Run this command to add it to your dependencies:

gleam add gleam_stdlib`

`

Please advise.

Gleam modules are not compiled to beam when using gleam v0.25.0

When using gleam v0.25.0 the erlang code generated by gleam is not compiled later in the compilation stages when using mix tasks. As a result gleam modules are not available at runtime. I suspect it is caused by the change of output directory for the erlang code produced by gleam gleam-lang/gleam@b35ecd3#diff-bab1783d97666c826f55924d7d1dc3f73c005ddd445b14c77ce2e52880fcdb64R5.

Changing :erlc_paths in mix.exs to ["build/dev/erlang/#{@app}/_gleam_artefacts"] works as a fix for modules of current application but the dependencies are still not available.

mix gleam.test warning about dependencies

Currently, with a minimal project using the exact same setup as the example in this repo, I get the following warning when running mix gleam.test

The module gleeunit is being imported, but gleeunit, the package it
belongs to, is not a direct dependency of your package.
In a future version of Gleam this may become a compile error.

Run this command to add it to your dependencies:

gleam add gleeunit

The tests run normally since gleeunit is present on my mix dependencies.
Is this to be ignored for now? Or am I missing any setup step?

Elixir-ls infinite compile loop

After integrating Gleam in an Elixir codebase, I found that elixir-ls never stops to compile the project. It can be easily reproduced with https://github.com/midas-framework/elixir_with_gleam.

Setup:

elixir 1.11.3-otp-23
erlang 23.1.1
gleam 0.9.0

But I also tested it with different permutations of Gleam 0.13.2, Erlang 22 and Elixir 1.10 with the same result.

  1. Clone the repository
  2. Open an editor with elixir-ls running (like VSCode)
  3. See in the output that the project is compiled immediately after it finish to compile

It may be a side effect that every Gleam file is recompiled when starting a mix project (the stdlib included). Executing mix compile 2 times in a row without modification triggers a full compile of the Elixir project.

Kapture.2021-04-12.at.16.38.46.mp4

Error when generating Ecto migration with Gleam compiler added

Hey there,

I'm encountering an issue when trying to generate an ecto migration.

When I add the Gleam compiler to the compilers list in mix.exs file and try to run mix ecto.gen.migration <migration_name>, I receive this error:

** (Mix) Unknown dependency <migration_name> for environment <my_mix_env_value>

Steps to Reproduce:

  1. In a Mix project that uses Ecto, add the :gleam compiler to the compilers list in the mix.exs file.
  2. Attempt to run mix ecto.gen.migration.

Expected Behavior:
The migration should be generated normally without any errors.

Environment:

  • Library Version: mix_gleam 0.6.2
  • Operating System: Linux Ubuntu 22.04
  • Gleam 1.0.0
  • Elixir 1.16.1
  • Erlang 26.1

Mix file

defmodule PayCosern.MixProject do
  use Mix.Project

  @app_name :pay_cosern

  def project do
    [
      app: :pay_cosern,
      version: "0.1.0",
      elixir: "~> 1.16.1",
      name: "#{@app_name}",
      archives: [mix_gleam: "~> 0.6.2"],
      compilers: [:gleam] ++ Mix.compilers(),
      releases: [
        pay_cosern: [
          applications: [ex_unit: :permanent]
        ]
      ],
      erlc_paths: [
        "build/dev/erlang/#{@app_name}/_gleam_artefacts"
      ],
      erlc_include_path: "build/dev/erlang/#{@app_name}/include",
      prune_code_paths: false,
      deps: deps(),
      aliases: aliases()
    ]
  end

  defp aliases() do
    [
      "ecto.setup": ["ecto.create", "ecto.migrate"],
      "ecto.reset": ["ecto.drop", "ecto.setup"],
      "deps.get": ["deps.get", "gleam.deps.get"]
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger, :ecto, :cowboy, :plug],
      mod: {PayCosern.Application, []}
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:ecto_sql, "~>  3.6"},
      {:postgrex, ">=  0.0.0"},
      {:floki, "~> 0.35.0"},
      {:plug, "~>  1.12"},
      {:cowboy, "~>  2.9"},
      {:plug_cowboy, "~> 2.0"},
      {:jason, "~> 1.2.2"},
      {:wallaby, "~> 0.30", runtime: true},
      {:oban, "~> 2.16"},
      {:poolboy, "~> 1.5.2"},
      {:ecto_sqlite3, "~> 0.13"},
      {:timex, "~> 3.0"},
      {:argon2_elixir, "~> 4.0"},
      {:guardian, "~> 2.3.2"},
      {:gleam_stdlib, "~> 0.34 or ~> 1.0"},
      {:gleeunit, "~> 1.0", only: [:dev, :test], runtime: false}
    ]
  end
end

Screen gif

In this gif I first tried using the 'compilers' key. Then, I tried again with compilers commented and worked.

Screen recording (7)

module MixGleam is not available

Is there any way to install MixGleam in an unattended mode? I keep getting a prompt when deploying with docker.

...
Step 7/29 : RUN git clone https://github.com/gleam-lang/mix_gleam.git --branch v0.4.0 &&     cd mix_gleam &&     MIX_ENV=prod mix do archive.build, archive.install &&     cd ..
 ---> Running in 54e3b72a4ea0
Cloning into 'mix_gleam'...
Note: switching to '419c5812e44bf63a41a9d2115bbf6e8e7f7a4019'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

Compiling 9 files (.ex)
Generated mix_gleam app
Generated archive "mix_gleam-0.4.0.ez" with MIX_ENV=prod
Are you sure you want to install "mix_gleam-0.4.0.ez"? [Yn] 
...
...
...
Step 17/29 : RUN mix deps.get --only prod
 ---> Running in 3415cd3a2c5b
warning: function aliases/0 is unused
  mix.exs:68

** (UndefinedFunctionError) function MixGleam.add_aliases/0 is undefined (module MixGleam is not available)
    MixGleam.add_aliases()
    mix.exs:13: TpPhx.MixProject.project/0
    (mix 1.13.2) lib/mix/project.ex:827: Mix.Project.get_project_config/1
    (mix 1.13.2) lib/mix/project.ex:141: Mix.Project.push/3
    (stdlib 3.17) lists.erl:1267: :lists.foldl/3
ERROR: Service 'phoenix' failed to build : The command '/bin/sh -c mix deps.get --only prod' returned a non-zero code: 1

Elixir 1.15 support

Prerequisite: I have installed the latest version (0.6.1) of mix_gleam.

My .tool-versions:

erlang 26.0.2
elixir 1.15.4-otp-26

Run mix test:

** (Mix) The task "compile.gleam" could not be found. Did you mean "compile.erlang"?

When I change the Elixir version to 1.14.5-otp-26, everything works fine, including the function calling gleam_stdlib in IEx.

when gleam version is higher than v0.19.0, `File.CopyError` raised

mix compile.gleam error message

** (File.CopyError) could not copy recursively from "build/dev/erlang/shiroko_web" to "d:/shiroko/shiroko_umbrella/_build/dev/lib/shiroko_web". build/dev/erlang/shiroko_web/priv: file already exists
    (elixir 1.13.4) lib/file.ex:902: File.cp_r!/3
    (mix_gleam 0.6.0) lib/mix/tasks/compile/gleam.ex:167: Mix.Tasks.Compile.Gleam.compile_package/2
    (mix_gleam 0.6.0) lib/mix/tasks/compile/gleam.ex:72: Mix.Tasks.Compile.Gleam.run/1
    (mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.13.4) lib/mix/tasks/compile.all.ex:92: Mix.Tasks.Compile.All.run_compiler/2
    (mix 1.13.4) lib/mix/tasks/compile.all.ex:72: Mix.Tasks.Compile.All.compile/4
    (mix 1.13.4) lib/mix/tasks/compile.all.ex:59: Mix.Tasks.Compile.All.with_logger_app/2
    (mix 1.13.4) lib/mix/tasks/compile.all.ex:36: Mix.Tasks.Compile.All.run/1	
  • gleam v0.20.0-rc1: error raised.
  • gleam v0.19.0: mix_gleam works well.

reason

gleam v0.20.0-rc1 release note

The priv directory is linked into the build directory for Gleam projects managed by the build tool.

  1. mix compile.gleam
  2. gleam make symbolic link, build/dev/erlang/<app>/priv if priv exists
  3. File.cp_r! invoked https://github.com/gleam-lang/mix_gleam/blob/v0.6.0/lib/mix/tasks/compile/gleam.ex
  4. File.CopyError raised. build/dev/erlang//priv: file already exists

Moving .gleam doesn't remove old .erl files

$ ls build/dev/erlang/hello/build/
hello.erl  hello.gleam_module
$ mkdir src/hey && mv src/hello.gleam src/hey
$ mix compile
Compiling 1 file (.gleam)
Compiling 1 file (.erl)
Generated hello app
$ ls build/dev/erlang/hello/build/
hello.erl  hello.gleam_module  [email protected]  [email protected]_module

The hello.erl and hello.gleam_module files should no longer be there

gleam_stdlib v0.18.1 fails to compile with mix_gleam v0.2

Hi

gleam_stdlib v0.18.1 fails to compile with mix_gleam v0.2, but the following combination works
gleam_stdlib v0.17.1 fails to compile with mix_gleam v0.2

the compilation error which is thrown is

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.