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:
parent
2c17f71965
commit
e3fdfee1c5
3 changed files with 19 additions and 3 deletions
|
@ -15,7 +15,8 @@
|
||||||
;;; Commands
|
;;; Commands
|
||||||
|
|
||||||
(defcli! ((install i))
|
(defcli! ((install i))
|
||||||
(&flags
|
((aot? ("--aot") "Enable ahead-of-time native-compilation (if available)")
|
||||||
|
&flags
|
||||||
(config? ("--config" :yes) "Create `$DOOMDIR' or dummy files therein?")
|
(config? ("--config" :yes) "Create `$DOOMDIR' or dummy files therein?")
|
||||||
(envfile? ("--env" :yes) "(Re)generate an envvars file? (see `$ doom help env`)")
|
(envfile? ("--env" :yes) "(Re)generate an envvars file? (see `$ doom help env`)")
|
||||||
(install? ("--install" :yes) "Auto-install packages?")
|
(install? ("--install" :yes) "Auto-install packages?")
|
||||||
|
@ -91,6 +92,10 @@ Change `$DOOMDIR' with the `--doomdir' option, e.g.
|
||||||
(when (or yes? (y-or-n-p "Generate an envvar file? (see `doom help env` for details)"))
|
(when (or yes? (y-or-n-p "Generate an envvar file? (see `doom help env` for details)"))
|
||||||
(call! '(env)))))
|
(call! '(env)))))
|
||||||
|
|
||||||
|
(when aot?
|
||||||
|
(after! straight
|
||||||
|
(setq straight--native-comp-available t)))
|
||||||
|
|
||||||
;; Install Doom packages
|
;; Install Doom packages
|
||||||
(if (eq install? :no)
|
(if (eq install? :no)
|
||||||
(print! (warn "Not installing plugins, as requested"))
|
(print! (warn "Not installing plugins, as requested"))
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
(jobs ("-j" "--jobs" num) "How many threads to use for native compilation")
|
(jobs ("-j" "--jobs" num) "How many threads to use for native compilation")
|
||||||
(rebuild? ("-b" "--rebuild") "Rebuild all installed packages, unconditionally")
|
(rebuild? ("-b" "--rebuild") "Rebuild all installed packages, unconditionally")
|
||||||
(nobuild? ("-B") "Don't rebuild packages when hostname or Emacs version has changed")
|
(nobuild? ("-B") "Don't rebuild packages when hostname or Emacs version has changed")
|
||||||
|
(aot? ("--aot") "Natively compile packages ahead-of-time (if available)")
|
||||||
&context context)
|
&context context)
|
||||||
"Synchronize your config with Doom Emacs.
|
"Synchronize your config with Doom Emacs.
|
||||||
|
|
||||||
|
@ -48,10 +49,17 @@ stale.
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-j, --jobs
|
-j, --jobs
|
||||||
Defaults to the maximum number of threads (or 1, if your CPU's threadcount
|
Defaults to the maximum number of threads (or 1, if your CPU's threadcount
|
||||||
can't be determined)."
|
can't be determined).
|
||||||
|
--aot
|
||||||
|
Will only perform AOT native-compilation for packages updated/installed
|
||||||
|
during the execution of this command. Use --rebuild as well to do so for all
|
||||||
|
packages."
|
||||||
:benchmark t
|
:benchmark t
|
||||||
(when (doom-profiles-bootloadable-p)
|
(when (doom-profiles-bootloadable-p)
|
||||||
(call! '(profiles sync "--reload")))
|
(call! '(profiles sync "--reload")))
|
||||||
|
(when aot?
|
||||||
|
(after! straight
|
||||||
|
(setq straight--native-comp-available t)))
|
||||||
(when jobs
|
(when jobs
|
||||||
(setq native-comp-async-jobs-number (truncate jobs)))
|
(setq native-comp-async-jobs-number (truncate jobs)))
|
||||||
(run-hooks 'doom-before-sync-hook)
|
(run-hooks 'doom-before-sync-hook)
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
;;; Commands
|
;;; Commands
|
||||||
|
|
||||||
(defcli! ((upgrade up))
|
(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")
|
(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")
|
(nobuild? ("-B") "Don't rebuild packages when hostname or Emacs version has changed")
|
||||||
&context context)
|
&context context)
|
||||||
|
@ -33,6 +34,7 @@ libraries. It is the equivalent of the following shell commands:
|
||||||
$ doom sync -u"
|
$ doom sync -u"
|
||||||
(let* ((force? (doom-cli-context-suppress-prompts-p context))
|
(let* ((force? (doom-cli-context-suppress-prompts-p context))
|
||||||
(sync-cmd (append '("sync" "-u")
|
(sync-cmd (append '("sync" "-u")
|
||||||
|
(if aot? '("--aot"))
|
||||||
(if nobuild? '("-B"))
|
(if nobuild? '("-B"))
|
||||||
(if jobs `("-j" ,jobs)))))
|
(if jobs `("-j" ,jobs)))))
|
||||||
(cond
|
(cond
|
||||||
|
@ -57,6 +59,7 @@ libraries. It is the equivalent of the following shell commands:
|
||||||
(print! (item "Reloading Doom Emacs"))
|
(print! (item "Reloading Doom Emacs"))
|
||||||
(doom-cli-context-put context 'upgrading t)
|
(doom-cli-context-put context 'upgrading t)
|
||||||
(exit! "doom" "upgrade" "-p"
|
(exit! "doom" "upgrade" "-p"
|
||||||
|
(if aot? "--aot")
|
||||||
(if nobuild? "-B")
|
(if nobuild? "-B")
|
||||||
(if force? "--force")
|
(if force? "--force")
|
||||||
(if jobs (format "--jobs=%d" jobs))))
|
(if jobs (format "--jobs=%d" jobs))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue