File tree Expand file tree Collapse file tree 4 files changed +41
-4
lines changed Expand file tree Collapse file tree 4 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -88,8 +88,6 @@ defmodule Rustler do
88
88
89
89
{ otp_app , path } = @ load_from
90
90
91
- IO . warn ( "#{ inspect ( otp_app ) } , #{ path } " )
92
-
93
91
load_path = Path . join ( :code . priv_dir ( otp_app ) , path ) |> to_charlist ( )
94
92
95
93
:erlang . load_nif ( load_path , @ load_data )
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ defmodule Rustler.Compiler.Config do
30
30
otp_app: otp_app
31
31
}
32
32
33
- IO . inspect ( defaults )
34
-
35
33
opts =
36
34
defaults
37
35
|> Map . from_struct ( )
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
1
+ [workspace ]
2
+ members = [" native/binary_example" , " native/deprecated_macros" , " native/rustler_test" ]
You can’t perform that action at this time.
0 commit comments