Remove FORCE-P argument for doom-cli-reload-autoloads

We weren't using them anyway.
This commit is contained in:
Henrik Lissner 2019-12-30 06:44:16 -05:00
parent bb425a2e65
commit 908bd4b945
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
6 changed files with 45 additions and 73 deletions

View file

@ -105,7 +105,7 @@ line."
(require 'core-cli) (require 'core-cli)
(require 'core-packages) (require 'core-packages)
(doom-initialize-packages) (doom-initialize-packages)
(doom-cli-reload-autoloads nil 'force)) (doom-cli-reload-autoloads))
;;;###autoload ;;;###autoload
(defun doom/reload-env (&optional arg) (defun doom/reload-env (&optional arg)

View file

@ -18,70 +18,44 @@ one wants that.")
(defvar autoload-timestamps) (defvar autoload-timestamps)
(defvar generated-autoload-load-name) (defvar generated-autoload-load-name)
(defun doom-cli-reload-autoloads (&optional type force-p) (defun doom-cli-reload-autoloads (&optional type)
"Reloads FILE (an autoload file), if it needs reloading. "Reloads FILE (an autoload file), if it needs reloading.
FILE should be one of `doom-autoload-file' or `doom-package-autoload-file'. If FILE should be one of `doom-autoload-file' or `doom-package-autoload-file'. If
it is nil, it will try to reload both. If FORCE-P (universal argument) do it it is nil, it will try to reload both."
even if it doesn't need reloading!"
(if type (if type
(cond ((eq type 'core) (cond ((eq type 'core)
(doom-cli-reload-core-autoloads (doom-cli-reload-core-autoloads doom-autoload-file))
doom-autoload-file force-p))
((eq type 'package) ((eq type 'package)
(doom-cli-reload-package-autoloads (doom-cli-reload-package-autoloads doom-package-autoload-file))
doom-package-autoload-file force-p))
((error "Invalid autoloads file: %s" type))) ((error "Invalid autoloads file: %s" type)))
(doom-cli-reload-autoloads 'core force-p) (doom-cli-reload-autoloads 'core)
(doom-cli-reload-autoloads 'package force-p))) (doom-cli-reload-autoloads 'package)))
(defun doom-cli-reload-core-autoloads (file &optional force-p) (defun doom-cli-reload-core-autoloads (file)
(cl-check-type file string) (cl-check-type file string)
(print! (start "(Re)generating core autoloads...")) (print! (start "(Re)generating core autoloads..."))
(print-group! (print-group!
(let ((autoload-files (and (print! (start "Generating core autoloads..."))
(doom-cli--write-autoloads
file (doom-cli--generate-autoloads
(cl-loop for dir in (append (list doom-core-dir) (cl-loop for dir in (append (list doom-core-dir)
(cdr (doom-module-load-path 'all-p)) (cdr (doom-module-load-path 'all-p))
(list doom-private-dir)) (list doom-private-dir))
if (doom-glob dir "autoload.el") collect it if (doom-glob dir "autoload.el") collect it
if (doom-glob dir "autoload/*.el") append it))) if (doom-glob dir "autoload/*.el") append it)
(if (or force-p 'scan))
(not (file-exists-p file))
(file-newer-than-file-p doom-emacs-dir file)
(cl-loop for dir
in (append (doom-glob doom-private-dir "init.el*")
autoload-files)
if (file-newer-than-file-p dir doom-autoload-file)
return t))
(and (print! (start "Generating core autoloads..."))
(doom-cli--write-autoloads
file (doom-cli--generate-autoloads autoload-files 'scan))
(print! (start "Byte-compiling core autoloads file...")) (print! (start "Byte-compiling core autoloads file..."))
(doom-cli--byte-compile-file file) (doom-cli--byte-compile-file file)
(print! (success "Generated %s") (print! (success "Generated %s")
(relpath (byte-compile-dest-file file) (relpath (byte-compile-dest-file file)
doom-emacs-dir))) doom-emacs-dir)))))
(print! (success "Core autoloads are up-to-date"))
nil))))
(defun doom-cli-reload-package-autoloads (file &optional force-p) (defun doom-cli-reload-package-autoloads (file)
(cl-check-type file string) (cl-check-type file string)
(print! (start "(Re)generating package autoloads...")) (print! (start "(Re)generating package autoloads..."))
(print-group! (print-group!
(doom-initialize-packages) (doom-initialize-packages)
(if (or force-p
(not (file-exists-p file))
(file-newer-than-file-p package-user-dir file)
(cl-loop for dir in (straight--directory-files (straight--build-dir))
if (cl-find-if
(doom-rpartial #'file-newer-than-file-p doom-package-autoload-file)
(doom-glob (straight--build-dir dir) "*.el"))
return t)
(not (cl-loop with doom-modules = (doom-modules)
for key being the hash-keys of doom-modules
for path = (doom-module-path (car key) (cdr key) "packages.el")
if (file-newer-than-file-p path doom-package-autoload-file)
return t)))
(and (print! (start "Generating package autoloads...")) (and (print! (start "Generating package autoloads..."))
(doom-cli--write-autoloads (doom-cli--write-autoloads
file file
@ -95,9 +69,7 @@ even if it doesn't need reloading!"
(doom-cli--byte-compile-file file) (doom-cli--byte-compile-file file)
(print! (success "Generated %s") (print! (success "Generated %s")
(relpath (byte-compile-dest-file file) (relpath (byte-compile-dest-file file)
doom-emacs-dir))) doom-emacs-dir)))))
(print! (success "Package autoloads are up-to-date"))
nil)))
;; ;;

View file

@ -78,7 +78,7 @@ DOOMDIR environment variable. e.g.
(doom-cli-packages-install)) (doom-cli-packages-install))
(print! "Regenerating autoloads files") (print! "Regenerating autoloads files")
(doom-cli-reload-autoloads nil 'force-p) (doom-cli-reload-autoloads)
(if nofonts-p (if nofonts-p
(print! (warn "Not installing fonts, as requested")) (print! (warn "Not installing fonts, as requested"))

View file

@ -12,7 +12,7 @@ or :ignore property."
(straight-check-all) (straight-check-all)
(doom-cli-reload-autoloads 'core) (doom-cli-reload-autoloads 'core)
(when (doom-cli-packages-update) (when (doom-cli-packages-update)
(doom-cli-reload-autoloads 'package 'force)) (doom-cli-reload-autoloads 'package))
t) t)
(defcli! (build b) (defcli! (build b)
@ -23,7 +23,7 @@ This ensures that all needed files are symlinked from their package repo and
their elisp files are byte-compiled. This is especially necessary if you upgrade their elisp files are byte-compiled. This is especially necessary if you upgrade
Emacs (as byte-code is generally not forward-compatible)." Emacs (as byte-code is generally not forward-compatible)."
(when (doom-cli-packages-build (not rebuild-p)) (when (doom-cli-packages-build (not rebuild-p))
(doom-cli-reload-autoloads 'package 'force)) (doom-cli-reload-autoloads 'package))
t) t)
(defcli! (purge p) (defcli! (purge p)
@ -46,7 +46,7 @@ list remains lean."
(not norepos-p) (not norepos-p)
(not nobuilds-p) (not nobuilds-p)
regraft-p) regraft-p)
(doom-cli-reload-autoloads 'package 'force)) (doom-cli-reload-autoloads 'package))
t) t)
;; (defcli! rollback () ; TODO doom rollback ;; (defcli! rollback () ; TODO doom rollback

View file

@ -50,9 +50,9 @@
(require 'core-cli) (require 'core-cli)
(doom-initialize 'force 'noerror) (doom-initialize 'force 'noerror)
(doom-initialize-modules) (doom-initialize-modules)
(doom-cli-reload-core-autoloads 'force) (doom-cli-reload-autoloads 'core)
(when (doom-cli-packages-install) (when (doom-cli-packages-install)
(doom-cli-reload-package-autoloads 'force))))) (doom-cli-reload-autoloads 'package)))))
(unless (zerop status) (unless (zerop status)
(error "Failed to bootstrap unit tests")))) (error "Failed to bootstrap unit tests"))))
(with-temp-buffer (with-temp-buffer

View file

@ -255,7 +255,7 @@ stale."
(doom-initialize 'force 'noerror) (doom-initialize 'force 'noerror)
(doom-initialize-modules) (doom-initialize-modules)
(doom-cli-reload-autoloads 'core (not if-necessary-p)) (doom-cli-reload-autoloads 'core)
(unwind-protect (unwind-protect
(progn (progn
(and (doom-cli-packages-install) (and (doom-cli-packages-install)
@ -264,7 +264,7 @@ stale."
(setq success t)) (setq success t))
(and (doom-cli-packages-purge prune-p 'builds-p prune-p prune-p) (and (doom-cli-packages-purge prune-p 'builds-p prune-p prune-p)
(setq success t))) (setq success t)))
(doom-cli-reload-autoloads 'package (or success (not if-necessary-p))) (doom-cli-reload-autoloads 'package)
(doom-cli-byte-compile nil 'recompile)) (doom-cli-byte-compile nil 'recompile))
t))) t)))