escript installation and support in mix

356 views
Skip to first unread message

Eric Meadows-Jönsson

unread,
Jun 25, 2014, 4:47:02 PM6/25/14
to elixir-l...@googlegroups.com

We want to add support for installing escripts on your system. For a time I was thinking about how to do this with Hex, but José came with the idea to do it with just Mix. We can use Mix’s existing functionality for fetching and building dependencies. For example:

mix escript.install git git://github.com/phoenixframework/phoenix.git
mix escript.install git git://github.com/phoenixframework/phoenix.git --branch develop

Since we use the existing dependency functionality we can also fetch Hex packages:

mix escript.install phoenix
mix escript.install phoenix 0.1.2

escript.install will download and build the project and then run the escriptize task to generate an escript and finally copy it to ~/.mix/escripts.

These are the tasks I would like to add or rename:

escript             # lists installed escripts
escript.build       # renamed escriptize task
escript.install     # self explanatory
escript.uninstall   # self explanatory

We are leaving archives as is for now but are renaming some tasks [1]. In the future we can add the same sort of functionality for fetching and building archives if we see the need.

archive             # lists installed archives
archive.install     # renamed local.install task
archive.uninstall   # renamed local.uninstall task
local               # keep as is, lists locally installed tasks
local.hex           # keep as is
local.rebar         # keep as is

[1] https://github.com/elixir-lang/elixir/issues/2454

--
Eric Meadows-Jönsson

Paulo Almeida

unread,
Jun 26, 2014, 5:23:05 AM6/26/14
to elixir-l...@googlegroups.com
Eric,

Since you mentioned this, I've come across a case where fetching archives as deps would be useful. The RabbitMQ client for erlang is distributed in the .ez format (http://www.rabbitmq.com/erlang-client.html). There are unofficially maintained git repos with the sources massaged to be rebar friendly, but they're not always in sync with the latest release.

While trying to build a more idiomatic API in Elixir on top of the Erlang client I've found it would be useful to just point to the official .ez packages as deps.

José Valim

unread,
Jun 26, 2014, 5:35:47 AM6/26/14
to elixir-l...@googlegroups.com
Paulo,

With this proposal we wouldn't support .ez as dependencies in your project. It would be something we could (should?) consider as a separate feature. If there is really an interest in this feature, we should open up an issue and discuss how it should be tackled. For example, should archives be downloaded automatically? Or can we simply use them like path dependencies where the archive is available inside the project?

Unfortunately it is not super straightforward as it also impacts releases and what not.



José Valim
Skype: jv.ptec
Founder and Lead Developer


--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric Meadows-Jönsson

unread,
Jun 26, 2014, 8:31:23 AM6/26/14
to elixir-l...@googlegroups.com
Alexei raised a good point on IRC last night which I forgot to address in the mail: Elixir version compatibility. What will happen with installed escripts when you upgrade your Elixir version? One solution could be to always include Elixir in the escript, so when Elixir is upgraded on your system the escript will keep on using the older Elixir bundled inside the escript. The obvious downside of this is that all escripts will get bigger, the binary size will increase with about 2MB.

We already have this issue today with archives, but we cannot bundle Elixir in archives since they are meant to integrate with existing Elixir installation. A solution for archives would be for tools Elixir version management tools like exenv [1] and kiex [2] to swap the installed archives directory when you change Elixir version. If we chose to not bundle Elixir with escripts we can also swap out the escripts directory. See this issue for more discussion: https://github.com/elixir-lang/elixir/issues/2452.

--
Eric Meadows-Jönsson

Paul Schoenfelder

unread,
Jun 26, 2014, 12:28:08 PM6/26/14
to elixir-l...@googlegroups.com
I like the idea of bundling Elixir with escripts personally. Just because I upgrade my local version of Elixir doesn't mean I want to have to reinstall my installed escripts, and there really is no direct correlation between what version of Elixir you are currently running and usage of the installed escripts. Yes the size gets bigger, but personally I think it's worth the tradeoff for increased stability: no unintended breakages when you upgrade Elixir, and you don't have to wait on a maintainer to upgrade their package for the latest version of Elixir in order for you to get the escript working again.

Paul

Eduardo Gurgel

unread,
Jun 26, 2014, 4:12:57 PM6/26/14
to elixir-l...@googlegroups.com
On Fri, Jun 27, 2014 at 4:28 AM, Paul Schoenfelder <paulscho...@gmail.com> wrote:
I like the idea of bundling Elixir with escripts personally. Just because I upgrade my local version of Elixir doesn't mean I want to have to reinstall my installed escripts, and there really is no direct correlation between what version of Elixir you are currently running and usage of the installed escripts. Yes the size gets bigger, but personally I think it's worth the tradeoff for increased stability: no unintended breakages when you upgrade Elixir, and you don't have to wait on a maintainer to upgrade their package for the latest version of Elixir in order for you to get the escript working again.


I agree with Paul. Even if it's just an option "include_elixir" or something like this.

Eduardo

Alexei Sholik

unread,
Jun 27, 2014, 9:36:16 AM6/27/14
to elixir-lang-core
What are the kind of things that will be used as escripts? Is "phoenix.new" eligible to be converted to an escript?

Also, if I intend my project to be used only as an escript and host on hex, what will happen when someone adds it as a dep? If I got it right, hex is not going to distinguish escripts from normal deps.


--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Best regards
Alexei Sholik

José Valim

unread,
Jun 27, 2014, 11:42:04 AM6/27/14
to elixir-l...@googlegroups.com
escripts won't be loaded inside your project. They will be just scripts you can install in your machine, they won't affect your project at all.



José Valim
Skype: jv.ptec
Founder and Lead Developer


Alexei Sholik

unread,
Jul 10, 2014, 11:21:55 PM7/10/14
to elixir-lang-core
What about updating? Does 'mix escript.install <url> <version>' override any other version that is already installed?


--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

José Valim

unread,
Jul 11, 2014, 5:46:44 AM7/11/14
to elixir-l...@googlegroups.com
iirc that is the plan, yes!



José Valim
Skype: jv.ptec
Founder and Lead Developer


Reply all
Reply to author
Forward
0 new messages