asdf-elixir icon indicating copy to clipboard operation
asdf-elixir copied to clipboard

Read Elixir version from mix.exs file

Open Stratus3D opened this issue 6 years ago • 1 comments

In addition to the .exenv-version file, asdf-elixir should also be able to read the Elixir version out of a mix.exs file in the current directory.

See this related issue for kiex: https://github.com/taylor/kiex/pull/54

Stratus3D avatar May 12 '18 16:05 Stratus3D

I like this!

Couple questions:

  • I'm not sure how this will account for different OTP versions that Elixir could be compiled with. Do you see something that could help find this? I don't see anything in mix.exs that specifies the OTP version, unless folks just add it. For example:

    def project() do
      [
        app: :my_app,
        version: File.read!("VERSION") |> String.trim(),
        elixir: "~> 1.5",
        otp: "21"
      ]
    end
    
  • Let's say that 1.5.2 is the latest Elixir version, and mix.exs specifies elixir: "~> 1.5". At the time asdf install is ran, does it fetch the latest 1.5.x version or earliest? If latest, and then later 1.5.3 releases, should asdf install require 1.5.3? Would asdf say the "specified" version is not yet installed, or would it be satisfied? I figure if folks want a specific version of Elixir for their app, they could specify elixir: "1.5.2" instead. Should there be a .tool-versions.lock generated until explicitly told to upgrade? (I figure this is a bigger question for asdf).

dbernheisel avatar Oct 11 '18 01:10 dbernheisel