@@ -579,26 +579,9 @@ function warnbanner(msg...; label="[ WARNING ]", prefix="")
579
579
warn (prefix= " " , " =" ^ cols)
580
580
end
581
581
582
- function build! (pkgs:: Vector , buildstream:: IO , seen:: Set )
583
- for pkg in pkgs
584
- pkg == " julia" && continue
585
- pkg in seen ? continue : push! (seen,pkg)
586
- Read. isinstalled (pkg) || throw (PkgError (" $pkg is not an installed package" ))
587
- build! (Read. requires_list (pkg),buildstream,seen)
588
- path = abspath (pkg," deps" ," build.jl" )
589
- isfile (path) || continue
590
- println (buildstream, path) # send to build process for evalfile
591
- flush (buildstream)
592
- end
593
- end
594
-
595
- function build! (pkgs:: Vector , errs:: Dict , seen:: Set = Set ())
596
- # To isolate the build from the running Julia process, we
597
- # execute the build.jl files in a separate process that
598
- # is sitting there waiting for paths to evaluate. Errors
599
- # are serialized to errfile for later retrieval into errs[pkg]
600
- errfile = tempname ()
601
- close (open (errfile, " w" )) # create empty file
582
+ function build (pkg:: AbstractString , build_file:: AbstractString , errfile:: AbstractString )
583
+ # To isolate the build from the running Julia process, we execute each build.jl file in
584
+ # a separate process. Errors are serialized to errfile for later reporting.
602
585
# TODO : serialize the same way the load cache does, not with strings
603
586
LOAD_PATH = filter (x -> x isa AbstractString, Base. LOAD_PATH )
604
587
code = """
@@ -609,42 +592,54 @@ function build!(pkgs::Vector, errs::Dict, seen::Set=Set())
609
592
empty!(Base.DL_LOAD_PATH)
610
593
append!(Base.DL_LOAD_PATH, $(repr (Base. DL_LOAD_PATH)) )
611
594
open("$(escape_string (errfile)) ", "a") do f
612
- for path in eachline(STDIN)
613
- pkg = basename(dirname(dirname(path)))
614
- try
615
- info("Building \$ pkg")
616
- cd(dirname(path)) do
617
- evalfile(path)
618
- end
619
- catch err
620
- Base.Pkg.Entry.warnbanner(err, label="[ ERROR: \$ pkg ]")
621
- serialize(f, pkg)
622
- serialize(f, err)
595
+ pkg, build_file = "$pkg ", "$(escape_string (build_file)) "
596
+ try
597
+ info("Building \$ pkg")
598
+ cd(dirname(build_file)) do
599
+ evalfile(build_file)
623
600
end
601
+ catch err
602
+ Base.Pkg.Entry.warnbanner(err, label="[ ERROR: \$ pkg ]")
603
+ serialize(f, pkg)
604
+ serialize(f, err)
624
605
end
625
606
end
626
607
"""
627
- io, pobj = open (pipeline (detach (` $(Base. julia_cmd ()) -O0
628
- --compilecache=$(Bool (Base. JLOptions (). use_compilecache) ? " yes" : " no" )
629
- --history-file=no
630
- --color=$(Base. have_color ? " yes" : " no" )
631
- --eval $code ` ), stderr = STDERR), " w" , STDOUT)
608
+ cmd = ```
609
+ $(Base. julia_cmd ()) -O0
610
+ --compilecache=$(Bool (Base. JLOptions (). use_compilecache) ? " yes" : " no" )
611
+ --history-file=no
612
+ --color=$(Base. have_color ? " yes" : " no" )
613
+ --eval $code
614
+ ```
615
+
616
+ success (pipeline (cmd, stderr = STDERR))
617
+ end
618
+
619
+ function build! (pkgs:: Vector , seen:: Set , errfile:: AbstractString )
620
+ for pkg in pkgs
621
+ pkg == " julia" && continue
622
+ pkg in seen ? continue : push! (seen,pkg)
623
+ Read. isinstalled (pkg) || throw (PkgError (" $pkg is not an installed package" ))
624
+ build! (Read. requires_list (pkg), seen, errfile)
625
+ path = abspath (pkg," deps" ," build.jl" )
626
+ isfile (path) || continue
627
+ build (pkg, path, errfile) || error (" Build process failed." )
628
+ end
629
+ end
630
+
631
+ function build! (pkgs:: Vector , errs:: Dict , seen:: Set = Set ())
632
+ errfile = tempname ()
633
+ touch (errfile) # create empty file
632
634
try
633
- build! (pkgs, io, seen)
634
- close (io)
635
- wait (pobj)
636
- success (pobj) || error (" Build process failed." )
635
+ build! (pkgs, seen, errfile)
637
636
open (errfile, " r" ) do f
638
637
while ! eof (f)
639
638
pkg = deserialize (f)
640
639
err = deserialize (f)
641
640
errs[pkg] = err
642
641
end
643
642
end
644
- catch err
645
- close (io)
646
- isa (err, PkgError) ? wait (pobj) : kill (pobj)
647
- rethrow (err)
648
643
finally
649
644
isfile (errfile) && Base. rm (errfile)
650
645
end
0 commit comments