Skip to content

Commit

Permalink
0.13.0 (#481)
Browse files Browse the repository at this point in the history
* Update to Zig 0.13 (#480)

* Fix Elixir 1.17 compilation warnings

* Update to Zig 0.13

* sets documentation correct and correct dependency

---------

Co-authored-by: Riccardo Binetti <rbino@gmx.com>
  • Loading branch information
ityonemo and rbino authored Aug 12, 2024
1 parent 781b45a commit 642217f
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ by adding `zigler` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:zigler, "~> 0.12.1", runtime: false}
{:zigler, "~> 0.13.0", runtime: false}
]
end
```
Expand All @@ -43,7 +43,7 @@ have difficulty.
```erlang
{plugins, [rebar_mix]}.

{deps, [{zigler, "0.12"}]}.
{deps, [{zigler, "0.13"}]}.

```

Expand Down
5 changes: 4 additions & 1 deletion VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ Thanks to Dave Cottlehuber @dch for testing.
- smarter `beam.send`
- attributes imported as compile-time values

## 0.13.0
- updated to zig 0.13.0

## Upcoming
- `precompiled` mode that will let you obtain packages with precompiled assets.
- Breaking changes:
Expand All @@ -143,4 +146,4 @@ Thanks to Dave Cottlehuber @dch for testing.

## Possible
- `beam.call` which lets you call back a beam function.
- `struct` which lets you declare a struct inside your zig code as the module's struct
- `struct` which lets you declare a struct inside your zig code as the module's struct
2 changes: 1 addition & 1 deletion installer/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ end
defmodule Zig.Get.MixProject do
use Mix.Project

@version "0.12.2"
@version "0.13.0"
@scm_url "https://github.com/e-xyza/zigler"

@elixir_requirement "~> 1.14"
Expand Down
2 changes: 1 addition & 1 deletion installer/mix.tasks/zig.get.ex
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ defmodule Mix.Tasks.Zig.Get do
end
end

@default_version "0.12.1"
@default_version "0.13.0"

defp defaults do
{os, arch} = Zig.Get.os_info()
Expand Down
19 changes: 10 additions & 9 deletions lib/zig.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ defmodule Zig do
Please consult the following guides for detailed topics:
- [Using Nifs](1-nifs.html)
- [Collection datatypes](2-collections.html)
- [Allocator strategies](3-allocators.html)
- [Nif options](4-nif_options.html)
- [Resources](5-nif_options.html)
- [C integration](6-c_integration.html)
- [Concurrency strategies](7-concurrency.html)
- [Global module options](8-module_options.html)
- [Raw calling](9-raw_nifs.html)
- [Using Nifs](01-nifs.html)
- [Collection datatypes](02-collections.html)
- [Allocator strategies](03-allocators.html)
- [Nif options](04-nif_options.html)
- [Resources](05-resources.html)
- [C integration](06-c_integration.html)
- [Concurrency strategies](07-concurrency.html)
- [Global module options](08-module_options.html)
- [Raw calling](09-raw_nifs.html)
- [Module callbacks](10-callbacks.html)
> ### Zig version support {: .warning }
>
Expand Down
2 changes: 1 addition & 1 deletion lib/zig/templates/build.zig.eex
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub fn build(b: *std.Build) void {

const lib = b.addSharedLibrary(.{
.name = "<%= @module %>",
.root_source_file = .{.path = "module.zig"},
.root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "module.zig"} },
.version = .{.major = <%= @version.major %>,
.minor = <%= @version.minor %>,
.patch = <%= @version.patch %>},
Expand Down
4 changes: 2 additions & 2 deletions lib/zig/type/enum.ex
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ defmodule Zig.Type.Enum do

defp accumulate(number, []), do: [number]
defp accumulate(number, [succ | rest]) when succ == number + 1, do: [number..succ | rest]
defp accumulate(number, [succ..last | rest]) when succ == number + 1, do: [number..last | rest]
defp accumulate(number, [succ..last//1 | rest]) when succ == number + 1, do: [number..last | rest]
defp accumulate(number, noncontiguous), do: [number | noncontiguous]

defp unionize(content) do
Expand All @@ -95,7 +95,7 @@ defmodule Zig.Type.Enum do
end)
end

defp rerender(a..b) do
defp rerender(a..b//1) do
quote do
unquote(a)..unquote(b)
end
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Zigler.MixProject do
use Mix.Project

def zig_version, do: "0.12.1"
def zig_version, do: "0.13.0"

def project do
env = Mix.env()
Expand Down Expand Up @@ -72,7 +72,7 @@ defmodule Zigler.MixProject do
{:zig_parser, "~> 0.4.0"},
# utility to help manage type protocols
{:protoss, "~> 0.2"},
{:zig_get, "~> 0.12.1"},
{:zig_get, "== 0.13.0"},
# documentation
{:markdown_formatter, "~> 0.6", only: :dev, runtime: false},
{:zig_doc, "~> 0.4.0", only: :dev, runtime: false}
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"pegasus": {:hex, :pegasus, "0.2.5", "38123461fe41add54f715ce41f89137a31cd217d353005b057f88b9b67c39b6f", [:mix], [{:nimble_parsec, "~> 1.2", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "ee80708608807f4447f1da1e6e0ebd9604f5bda4fbe2d4bdd9aa6dd67afde020"},
"protoss": {:hex, :protoss, "0.2.1", "fcf437ed65178d6cbf9a600886e3da9f7173697223972f062ee593941c2588b1", [:mix], [], "hexpm", "2261dbdc4d5913ce1e88d1410108d97f21140a118f45f6acc3edc4ecdb952052"},
"zig_doc": {:hex, :zig_doc, "0.4.0", "fdaee133165fa3c3a17e8ff7d62ab60be4ad011ff128d567151dbca2026f44d0", [:mix], [{:ex_doc, "~> 0.34.2", [hex: :ex_doc, repo: "hexpm", optional: false]}, {:zig_parser, "~> 0.4.0", [hex: :zig_parser, repo: "hexpm", optional: false]}], "hexpm", "d07c69a210d7ae3732493bf7e55628e30c4a68fec47c244e3f40f6c7323b819d"},
"zig_get": {:hex, :zig_get, "0.12.2", "713de7f73c508386e7ac93c8479b1e196a24834c95fd03f1dd3dc8133857c063", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "81a5c562fdef8b4affd28a94a41a725c355b26021f5a8ddb550f19d319aa3010"},
"zig_get": {:hex, :zig_get, "0.13.0", "527df0ca1c6a745c9173ce76f4ac7451d5cf251673bbcfda67bdffdb355def16", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "adbba1bef93d8a5103ca2c51da9086e50cd0c95c6b2283fb5b57b1a102dea0c4"},
"zig_parser": {:hex, :zig_parser, "0.4.0", "5230576fcea30c061f08f6053448ad3dc5194a45485065564a7f8047bb351ce9", [:mix], [{:pegasus, "~> 0.2.4", [hex: :pegasus, repo: "hexpm", optional: false]}], "hexpm", "ec54cf14e80a1485e29a80b42756d0421426db81eb9e2630721fd46ab5c21bcb"},
}
7 changes: 6 additions & 1 deletion test/_support/compiler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ defmodule ZiglerTest.Compiler do
end

def compile_erlang(file) do
{:ok, mod} = :compile.file(file, [:return_errors, outdir: :code.lib_dir(:zigler, :ebin)])
{:ok, mod} =
:compile.file(file, [
:return_errors,
outdir: :filename.join(:code.lib_dir(:zigler), ~c"ebin")
])

Code.ensure_loaded(mod)
end
end
2 changes: 1 addition & 1 deletion test/_support/spec_template.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defmodule ZiglerTest.SpecTemplate do
end
end

defp convert(a..b, context) do
defp convert(a..b//1, context) do
quote do
{:type, _, :range, [unquote(convert(a, context)), unquote(convert(b, context))]}
end
Expand Down

0 comments on commit 642217f

Please sign in to comment.