@@ -207,8 +207,9 @@ defmodule Mix.Tasks.Deps.Compile do
207
207
{ "TERM" , "dumb" }
208
208
]
209
209
210
- cmd = "#{ rebar_cmd ( dep ) } bare compile --paths #{ escape_path ( lib_path ) } "
211
- do_command ( dep , config , cmd , false , env )
210
+ cmd = rebar_cmd ( dep )
211
+ args = [ "bare" , "compile" , "--paths" , lib_path ]
212
+ do_command ( dep , config , cmd , args , env )
212
213
213
214
# Check if we have any new symlinks after compilation
214
215
for dir <- ~w( include priv src) ,
@@ -220,11 +221,6 @@ defmodule Mix.Tasks.Deps.Compile do
220
221
true
221
222
end
222
223
223
- defp escape_path ( path ) do
224
- escape = if match? ( { :win32 , _ } , :os . type ( ) ) , do: "^ " , else: "\\ "
225
- String . replace ( path , " " , escape )
226
- end
227
-
228
224
defp rebar_config ( dep ) do
229
225
dep . extra
230
226
|> Mix.Rebar . dependency_config ( )
@@ -260,7 +256,7 @@ defmodule Mix.Tasks.Deps.Compile do
260
256
261
257
defp do_make ( dep , config ) do
262
258
command = make_command ( dep )
263
- do_command ( dep , config , command , true , [ { "IS_DEP" , "1" } ] )
259
+ do_shell_command ( dep , config , command , true , [ { "IS_DEP" , "1" } ] )
264
260
build_structure ( dep , config )
265
261
true
266
262
end
@@ -289,15 +285,30 @@ defmodule Mix.Tasks.Deps.Compile do
289
285
290
286
defp do_compile ( % Mix.Dep { opts: opts } = dep , config ) do
291
287
if command = opts [ :compile ] do
292
- do_command ( dep , config , command , true )
288
+ do_shell_command ( dep , config , command , true )
293
289
build_structure ( dep , config )
294
290
true
295
291
else
296
292
false
297
293
end
298
294
end
299
295
300
- defp do_command ( dep , config , command , print_app? , env \\ [ ] ) do
296
+ defp do_command ( dep , config , command , args , env \\ [ ] ) do
297
+ % Mix.Dep { app: app , system_env: system_env , opts: opts } = dep
298
+
299
+ env = [ { "ERL_LIBS" , Path . join ( config [ :deps_build_path ] , "lib" ) } | system_env ] ++ env
300
+
301
+ if elem ( System . cmd ( command , args , env: env , cd: opts [ :dest ] ) , 1 ) != 0 do
302
+ Mix . raise (
303
+ "Could not compile dependency #{ inspect ( app ) } , \" #{ command } \" command failed. " <>
304
+ deps_compile_feedback ( app )
305
+ )
306
+ end
307
+
308
+ true
309
+ end
310
+
311
+ defp do_shell_command ( dep , config , command , print_app? , env \\ [ ] ) do
301
312
% Mix.Dep { app: app , system_env: system_env , opts: opts } = dep
302
313
303
314
env = [ { "ERL_LIBS" , Path . join ( config [ :deps_build_path ] , "lib" ) } | system_env ] ++ env
0 commit comments