Skip to content

Commit

Permalink
Update for Elixir v1.15, Gleam v0.32
Browse files Browse the repository at this point in the history
  • Loading branch information
tynanbe committed Nov 16, 2023
1 parent 096f1e3 commit 48902ca
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: erlef/setup-beam@v1
with:
otp-version: "25.1"
elixir-version: "1.14.2"
otp-version: "26"
elixir-version: "1.15"
gleam-version: nightly

- name: Check formatting
Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Unreleased

- Updated for Elixir v1.15 and Gleam v0.32 compatibility. Make sure to set
`prune_code_paths: false` in your `mix.exs` project config.

## v0.6.1 - 2022-12-04

- Updated for Gleam v0.25 compatibility.
Expand All @@ -10,8 +15,8 @@

- `mix gleam.compile` task is renamed to `mix compile.gleam` for compatibility
with the `:compilers` Mix.Project option.
- `MixGleam.add_aliases` is deprecated in favor of adding `:gleam` to `:compilers`
and specifying an alias for `:"deps.get"`.
- `MixGleam.add_aliases` is deprecated in favor of adding `:gleam` to
`:compilers` and specifying an alias for `:"deps.get"`.

## v0.5.0 - 2022-06-08

Expand Down
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ dependencies!

## Installation

Install the Gleam compiler onto your machine. [Installation instructions can
be found here](https://gleam.run/getting-started/installing-gleam.html).
Install the Gleam compiler onto your machine.
[Installation instructions can be found here](https://gleam.run/getting-started/installing-gleam.html).

Install or update the `MixGleam` archive from Hex:

Expand Down Expand Up @@ -52,6 +52,8 @@ compiler and Gleam dependencies:
"build/dev/erlang/#{@app}/build"
],
erlc_include_path: "build/dev/erlang/#{@app}/include",
# For Elixir >= v1.15.0
prune_code_paths: false,
# ...
]
end
Expand All @@ -74,8 +76,8 @@ If you want to write Gleam code in your project, it's a good idea to add
defp deps do
[
# ...
{:gleam_stdlib, "~> 0.28"},
{:gleeunit, "~> 0.10", only: [:dev, :test], runtime: false},
{:gleam_stdlib, "~> 0.32"},
{:gleeunit, "~> 1.0", only: [:dev, :test], runtime: false},
# ...
]
end
Expand All @@ -99,8 +101,8 @@ $ mix gleam.test

## Example

Check the [test project](test_projects/basic_project/) for an example that contains both Elixir and Gleam code. See the
[Elixir](test_projects/basic_project/test/basic_project_test.exs)
and [Gleam](test_projects/basic_project/test/basic_project_test.gleam)
test files to find examples on calling Gleam code from Elixir,
and vice-versa.
Check the [test project](test_projects/basic_project/) for an example that
contains both Elixir and Gleam code. See the
[Elixir](test_projects/basic_project/test/basic_project_test.exs) and
[Gleam](test_projects/basic_project/test/basic_project_test.gleam) test files to
find examples on calling Gleam code from Elixir, and vice-versa.
6 changes: 4 additions & 2 deletions lib/mix_gleam/config.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
defmodule MixGleam.Config do
@version "0.6.1"
@deps [
{:gleam_stdlib, "~> 0.28"},
{:gleeunit, "~> 0.10", only: [:dev, :test], runtime: false}
{:gleam_stdlib, "~> 0.32"},
{:gleeunit, "~> 1.0", only: [:dev, :test], runtime: false}
]

@moduledoc false
Expand Down Expand Up @@ -42,6 +42,8 @@ defmodule MixGleam.Config do
"build/dev/erlang/\#{@app}/build"
],
erlc_include_path: "build/dev/erlang/\#{@app}/include",
# For Elixir >= v1.15.0
prune_code_paths: false,
start_permanent: Mix.env(\) == :prod,
deps: deps(\)
]
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule MixGleam.MixProject do
def project do
[
app: :mix_gleam,
version: "0.6.1",
version: "0.6.2-dev",
elixir: "~> 1.9",
start_permanent: Mix.env() == :prod,
name: "mix_gleam",
Expand Down
9 changes: 5 additions & 4 deletions test_projects/basic_project/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ defmodule BasicProject.MixProject do

# Gleam compilation config
compilers: [:gleam | Mix.compilers()],
archives: [mix_gleam: "~> 0.6.1"],
archives: [mix_gleam: "~> 0.6.2-dev"],
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"
erlc_include_path: "build/dev/erlang/#{@app}/include",
prune_code_paths: false
]
end

Expand All @@ -35,8 +36,8 @@ defmodule BasicProject.MixProject do
defp deps do
[
# {:mix_gleam, path: "../../"}
{:gleam_stdlib, "~> 0.28"},
{:gleeunit, "~> 0.10", only: [:dev, :test], runtime: false}
{:gleam_stdlib, "~> 0.32"},
{:gleeunit, "~> 1.0", only: [:dev, :test], runtime: false}
]
end
end
4 changes: 2 additions & 2 deletions test_projects/basic_project/mix.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%{
"gleam_stdlib": {:hex, :gleam_stdlib, "0.28.1", "78663a81a9259659ae559be56c4e9d4b0f592a83e46aa189ed1fa14510aad198", [:gleam], [], "hexpm", "73f0a89fade5022cbef6d6c3551f9adce7054afce0cb1dc4c6d5ab4ca62d0111"},
"gleeunit": {:hex, :gleeunit, "0.10.1", "2f3fb55d240a8ded5fcd3ed563598e6d8dadd0d7b385012a98eb4cc9b33753b0", [:gleam], [{:gleam_stdlib, "~> 0.19", [hex: :gleam_stdlib, repo: "hexpm", optional: false]}], "hexpm", "ecea2de4be6528d36afe74f42a21cdf99966ec36d7f25deb34d47dd0f7977baf"},
"gleam_stdlib": {:hex, :gleam_stdlib, "0.32.1", "bdb24fcf4e8c2766d3a65a6cb0f256bff9f13a277e7e280b28963e77153fbb82", [:gleam], [], "hexpm", "abf00cdccb66fabbce351a50060964c4ace798f95a0d78622c8a7dc838792577"},
"gleeunit": {:hex, :gleeunit, "1.0.0", "a695e3ebf47d91cf79feabb5d847c7d41ff925f514b6ad2a56a7fecaa545936b", [:gleam], [{:gleam_stdlib, "~> 0.32", [hex: :gleam_stdlib, repo: "hexpm", optional: false]}], "hexpm", "d3682ed8c5f9cae1c928f2506de91625588cc752495988cbe0f5653a42a6f334"},
}
6 changes: 3 additions & 3 deletions test_projects/basic_project/test/basic_project_test.gleam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import gleeunit
import basic_project.{Thing, World}
import basic_project.{type Thing, World}

pub fn main() {
gleeunit.main()
Expand All @@ -13,5 +13,5 @@ pub fn elixir_code_test() {
let assert World = hello_elixir()
}

external fn hello_elixir() -> Thing =
"Elixir.BasicProject" "hello"
@external(erlang, "Elixir.BasicProject", "hello")
fn hello_elixir() -> Thing

0 comments on commit 48902ca

Please sign in to comment.