Improve 'doom rebuild' checks & formatting of logs

Corrects stale bytecode a little more aggressively.
This commit is contained in:
Henrik Lissner 2019-07-27 17:20:02 +02:00
parent 3313212f90
commit 8d388ebba9
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -85,30 +85,29 @@ a list of packages that will be installed."
(dolist (package (hash-table-keys straight--recipe-cache)) (dolist (package (hash-table-keys straight--recipe-cache))
(straight-use-package (straight-use-package
(intern package) nil (lambda (_) (cl-incf n) nil) " "))) (intern package) nil (lambda (_) (cl-incf n) nil) " ")))
(let ((straight-check-for-modifications '(find-when-checking))) (dolist (recipe (hash-table-values straight--recipe-cache))
(straight-check-all) (straight--with-plist recipe (package local-repo no-build)
(dolist (recipe (hash-table-values straight--recipe-cache)) (unless (or no-build (null local-repo))
(straight--with-plist recipe (package local-repo no-build) ;; REVIEW We do these modification checks manually because
(unless (or no-build (null local-repo)) ;; Straight's checks seem to miss stale elc files. Need
;; REVIEW We do these modification checks manually because ;; more tests to confirm this.
;; Straight's checks seem to miss stale elc files. Need (when (or (ignore-errors
;; more tests to confirm this. (gethash package straight--packages-to-rebuild))
(when (or (ignore-errors (gethash package straight--cached-package-modifications)
(gethash package straight--packages-to-rebuild)) (not (file-directory-p (straight--build-dir package)))
(gethash package straight--cached-package-modifications) (cl-loop for file
(not (file-directory-p (straight--build-dir package))))
(print! (info "Rebuilding %s") package)
(straight-rebuild-package package 'recursive)
(when (cl-loop for file
in (doom-files-in (straight--build-dir package) in (doom-files-in (straight--build-dir package)
:match "\\.el$" :match "\\.el$"
:full t) :full t)
for elc-file = (byte-compile-dest-file file) for elc-file = (byte-compile-dest-file file)
if (and (file-exists-p elc-file) if (and (file-exists-p elc-file)
(file-newer-than-file-p file elc-file)) (file-newer-than-file-p file elc-file))
return t) return t))
(straight--byte-compile-package recipe)) (let ((straight--packages-to-rebuild :all)
(cl-incf n))))))) (straight--packages-not-to-rebuild (make-hash-table :test #'equal)))
(straight-use-package (intern package) nil nil " "))
(straight--byte-compile-package recipe)
(cl-incf n))))))
(if (= n 0) (if (= n 0)
(ignore (print! (success "No packages need rebuilding"))) (ignore (print! (success "No packages need rebuilding")))
(doom--finalize-straight) (doom--finalize-straight)