Refactor autoload generator

- Halves LOC
- Adopts functional paradigm where possible.
- Reduces the filesize of autoloads files by ~10-20%
- Speeds up autoloads generation by ~20%
This commit is contained in:
Henrik Lissner 2019-12-29 21:25:40 -05:00
parent 4808d40736
commit f8ff50565e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 264 additions and 396 deletions

View file

@ -10,9 +10,9 @@ between HEAD and FETCH_HEAD. This can take a while.
This excludes packages whose `package!' declaration contains a non-nil :freeze
or :ignore property."
(straight-check-all)
(doom-cli-reload-core-autoloads)
(doom-cli-reload-autoloads 'core)
(when (doom-cli-packages-update)
(doom-cli-reload-package-autoloads 'force-p))
(doom-cli-reload-autoloads 'package 'force))
t)
(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
Emacs (as byte-code is generally not forward-compatible)."
(when (doom-cli-packages-build (not rebuild-p))
(doom-cli-reload-package-autoloads 'force-p))
(doom-cli-reload-autoloads 'package 'force))
t)
(defcli! (purge p)
@ -46,7 +46,7 @@ list remains lean."
(not norepos-p)
(not nobuilds-p)
regraft-p)
(doom-cli-reload-package-autoloads 'force-p))
(doom-cli-reload-autoloads 'package 'force))
t)
;; (defcli! rollback () ; TODO doom rollback
@ -310,7 +310,7 @@ a `package!' declaration) or isn't depended on by another primary package.
If BUILDS-P, include straight package builds.
If REPOS-P, include straight repos.
If ELPA-P, include packages installed with package.el (M-x package-install)."
(print! (start "Searching for orphaned packages to purge (for the emperor)..."))
(print! (start "Purging orphaned packages (for the emperor)..."))
(cl-destructuring-bind (&optional builds-to-purge repos-to-purge repos-to-regraft)
(let ((rdirs (straight--directory-files (straight--repos-dir) nil nil 'sort))
(bdirs (straight--directory-files (straight--build-dir) nil nil 'sort)))