Skip to content

Commit 5d635f8

Browse files
committed
Drop debug output, add missing files
1 parent dd91119 commit 5d635f8

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed

rustler_mix/lib/rustler.ex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ defmodule Rustler do
8888

8989
{otp_app, path} = @load_from
9090

91-
IO.warn("#{inspect(otp_app)}, #{path}")
92-
9391
load_path = Path.join(:code.priv_dir(otp_app), path) |> to_charlist()
9492

9593
:erlang.load_nif(load_path, @load_data)

rustler_mix/lib/rustler/compiler/config.ex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ defmodule Rustler.Compiler.Config do
3030
otp_app: otp_app
3131
}
3232

33-
IO.inspect(defaults)
34-
3533
opts =
3634
defaults
3735
|> Map.from_struct()
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
defmodule Rustler.Compiler.Server do
2+
use GenServer
3+
4+
defp ensure_running() do
5+
case GenServer.start(__MODULE__, [], name: __MODULE__) do
6+
{:ok, _pid} -> :ok
7+
{:error, {:already_started, _pid}} -> :ok
8+
end
9+
end
10+
11+
def build() do
12+
ensure_running()
13+
GenServer.call(__MODULE__, :compile, :infinity)
14+
end
15+
16+
@impl true
17+
def init([]) do
18+
{:ok, nil}
19+
end
20+
21+
@impl true
22+
def handle_call(:compile, _from, nil) do
23+
shell = Mix.shell()
24+
_otp_app = Mix.Project.config() |> Keyword.get(:app)
25+
is_release = Mix.env() in [:prod, :bench]
26+
27+
cargo_opts = %{
28+
release: is_release
29+
}
30+
31+
cargo = :cargo.init(File.cwd!(), cargo_opts)
32+
artifacts = :cargo.build_and_capture(cargo)
33+
{:reply, artifacts, artifacts}
34+
end
35+
36+
def handle_call(:compile, _from, artifacts) do
37+
{:reply, artifacts, artifacts}
38+
end
39+
end

rustler_tests/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[workspace]
2+
members = ["native/binary_example", "native/deprecated_macros", "native/rustler_test"]

0 commit comments

Comments
 (0)