-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
byte compile in child process #657
byte compile in child process #657
Conversation
Making byte-compilation asynchronous sketches me out a fair amount. I think we might want to keep it synchronous at least by default. Otherwise, it'll be happening in parallel with the rest of Emacs startup, which could involve loading the very package being byte-compiled. I can't point to a specific race condition that would happen with this kind of scenario, but it feels very scary. Converting fully general asynchronous process invocations into synchronous calls is pretty hard (see my struggles in #334), but doing it for ones that don't need to read from stdin should be easy. |
Sounds good. Top priority is fixing #624. We can always expand on the idea later. I'll rework this so it's synchronous. |
4409c4d
to
2f2ebbc
Compare
2118623
to
0219a4f
Compare
Separates byte-compilation from state of running Emacs. See: radian-software#76, radian-software#624
0219a4f
to
27839e2
Compare
The following test case seems to work properly. Test Case(straight-bug-report
:user-dir "byte-compile-child-process.straight"
:pre-bootstrap
(setq straight-repository-user "progfolio" straight-repository-branch "feat/byte-compilation-76")
:post-bootstrap
(eval-after-load "org"
'(message "FAILURE: Org loaded"))
(straight-use-package
`(org :type git :repo "https://code.orgmode.org/bzg/org-mode.git" :no-autoloads t :local-repo "org" :files
(:defaults "contrib/lisp/*.elc" "lisp/*.elc")
:build ,(let
((make
(if
(eq system-type 'berkeley-unix)
"gmake" "make"))
(emacs
(concat "EMACS=" invocation-directory invocation-name)))
`((,make "autoloads" ,emacs)))))
(straight-use-package 'org-journal)
(with-current-buffer
(get-buffer-create straight-byte-compilation-buffer)
(message "%s"
(buffer-string))))
OutputBootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done
Test run with version: prerelease (HEAD -> feat/byte-compilation-76, origin/feat/byte-compilation-76) 27839e2 2020-12-23
Cloning org...
Cloning org...done
Building org...
Building org...done
Cloning org-journal...
Cloning org-journal...done
Building org-journal...
Building org-journal...done
Checking /tmp/byte-compile-child-process.straight/straight/build/straight/...
Compiling /tmp/byte-compile-child-process.straight/straight/build/straight/straight-autoloads.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/straight/straight-x.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/straight/straight.el...
Done (Total of 2 files compiled, 1 skipped)
Checking /tmp/byte-compile-child-process.straight/straight/build/org/...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-C.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-J.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-R.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-abc.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-asymptote.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-awk.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-calc.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-clojure.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-comint.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-coq.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-core.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-css.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-ditaa.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-dot.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-ebnf.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-emacs-lisp.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-eshell.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-eval.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-exp.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-forth.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-fortran.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-gnuplot.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-groovy.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-haskell.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-hledger.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-io.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-java.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-js.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-latex.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-ledger.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-lilypond.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-lisp.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-lob.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-lua.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-makefile.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-matlab.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-maxima.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-mscgen.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-ocaml.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-octave.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-org.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-perl.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-picolisp.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-plantuml.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-processing.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-python.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-ref.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-ruby.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-sass.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-scheme.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-screen.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-sed.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-shell.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-shen.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-sql.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-sqlite.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-stan.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-table.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-tangle.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob-vala.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ob.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol-bbdb.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol-bibtex.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol-docview.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol-eshell.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol-eww.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol-gnus.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol-info.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol-irc.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol-mhe.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol-rmail.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol-w3m.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ol.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-agenda.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-archive.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-attach-git.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-attach.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-capture.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-clock.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-colview.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-compat.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-crypt.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-ctags.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-datetree.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-duration.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-element.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-entities.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-faces.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-feed.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-footnote.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-goto.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-habit.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-id.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-indent.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-inlinetask.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-install.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-keys.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-lint.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-list.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-loaddefs.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-macro.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-macs.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-mobile.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-mouse.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-num.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-pcomplete.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-plot.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-protocol.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-refile.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-src.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-table.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-tempo.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-timer.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org-version.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/org.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox-ascii.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox-beamer.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox-html.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox-icalendar.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox-latex.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox-man.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox-md.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox-odt.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox-org.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox-publish.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox-texinfo.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org/ox.el...
Done (Total of 124 files compiled, 3 skipped)
Checking /tmp/byte-compile-child-process.straight/straight/build/org-journal/...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org-journal/org-journal-autoloads.el...
Compiling /tmp/byte-compile-child-process.straight/straight/build/org-journal/org-journal.el...
Done (Total of 1 file compiled, 1 skipped)
|
LGTM! |
Co-authored-by: Radon Rosborough <[email protected]>
Work in progress using
make-process
to byte-compile packages in a child process.Haven't dealt with the fact that we've made byte-compilation asynchronous.
For example, the :post-build commands should probably be executed in a callback after compilation.