feat(cli): add --aot option

Allow ahead-of-time native-compilation during CLI operations that
install or update packages. This will not retroactively native-compile
already-installed packages, you'll need to use --rebuild to do so.

(This is a stop-gap solution until the v3.0 release)

Fix: #6811
This commit is contained in:
Henrik Lissner 2024-08-07 13:42:14 -04:00
parent 2c17f71965
commit e3fdfee1c5
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
3 changed files with 19 additions and 3 deletions

View file

@ -19,7 +19,8 @@
;;; Commands
(defcli! ((upgrade up))
((packages? ("-p" "--packages") "Only upgrade packages, not Doom")
((aot? ("--aot") "Natively compile packages ahead-of-time (if available)")
(packages? ("-p" "--packages") "Only upgrade packages, not Doom")
(jobs ("-j" "--jobs" num) "How many CPUs to use for native compilation")
(nobuild? ("-B") "Don't rebuild packages when hostname or Emacs version has changed")
&context context)
@ -33,6 +34,7 @@ libraries. It is the equivalent of the following shell commands:
$ doom sync -u"
(let* ((force? (doom-cli-context-suppress-prompts-p context))
(sync-cmd (append '("sync" "-u")
(if aot? '("--aot"))
(if nobuild? '("-B"))
(if jobs `("-j" ,jobs)))))
(cond
@ -57,6 +59,7 @@ libraries. It is the equivalent of the following shell commands:
(print! (item "Reloading Doom Emacs"))
(doom-cli-context-put context 'upgrading t)
(exit! "doom" "upgrade" "-p"
(if aot? "--aot")
(if nobuild? "-B")
(if force? "--force")
(if jobs (format "--jobs=%d" jobs))))