@@ -135,26 +135,22 @@ defmodule EXLA.MixProject do
135
135
end
136
136
137
137
defp cached_make ( args ) do
138
- force_rebuild_mode =
139
- case System . get_env ( "EXLA_FORCE_REBUILD" , "" ) do
140
- "" ->
141
- :none
138
+ force_rebuild_env_var = System . get_env ( "EXLA_FORCE_REBUILD" , "" )
142
139
143
- "0" ->
140
+ force_rebuild_mode =
141
+ cond do
142
+ force_rebuild_env_var in [ "" , "false" , "0" ] ->
144
143
:none
145
144
146
- "partial" ->
145
+ force_rebuild_env_var == "partial" ->
147
146
:partial
148
147
149
- "true" ->
150
- :full
151
-
152
- "1" ->
148
+ force_rebuild_env_var in [ "true" , "1" ] ->
153
149
:full
154
150
155
- value ->
151
+ true ->
156
152
Mix . raise (
157
- "invalid value for EXLA_FORCE_REBUILD: '#{ value } '. Expected one of: partial, true"
153
+ "invalid value for EXLA_FORCE_REBUILD: '#{ force_rebuild_env_var } '. Expected one of: partial, true, false "
158
154
)
159
155
end
160
156
@@ -183,24 +179,24 @@ defmodule EXLA.MixProject do
183
179
cached? = File . exists? ( cached_so ) and force_rebuild_mode == :none
184
180
185
181
if force_rebuild_mode in [ :partial , :full ] do
186
- Mix . shell ( ) . info ( "Removing cached libexla.so file in cache/#{ @ version } / libexla.so" )
187
- File . rm_rf! ( "cache/#{ @ version } / libexla.so" )
182
+ Mix . shell ( ) . info ( "Removing cached libexla.so file in cache/libexla.so" )
183
+ File . rm_rf! ( "cache/libexla.so" )
188
184
189
185
Mix . shell ( ) . info ( "Removing libexla.so cache at #{ cached_so } " )
190
186
File . rm_rf! ( cached_so )
191
187
end
192
188
193
189
if cached? do
194
190
Mix . shell ( ) . info ( "Using libexla.so from #{ cached_so } " )
195
- File . cp! ( cached_so , "cache/#{ @ version } / libexla.so" )
191
+ File . cp! ( cached_so , "cache/libexla.so" )
196
192
end
197
193
198
194
result = Mix.Tasks.Compile.ElixirMake . run ( args )
199
195
200
196
if not cached? and match? ( { :ok , _ } , result ) do
201
197
Mix . shell ( ) . info ( "Caching libexla.so at #{ cached_so } " )
202
198
File . mkdir_p! ( Path . dirname ( cached_so ) )
203
- File . cp! ( "cache/#{ @ version } / libexla.so" , cached_so )
199
+ File . cp! ( "cache/libexla.so" , cached_so )
204
200
end
205
201
206
202
result
0 commit comments