Fixed the broken debug-mode of the build
This commit is contained in:
rodzic
93bbfda8d3
commit
5780b87886
2
Makefile
2
Makefile
|
@ -54,7 +54,7 @@ serve: build
|
|||
npx http-server ./build/site-build/
|
||||
|
||||
.PHONY: deploy-docs
|
||||
deploy-docs: docs
|
||||
deploy-docs: clean docs
|
||||
rsync -vlcr --delete-after ./build/site-build/* core.lxsameer.com:/home/www/public/fg42/
|
||||
|
||||
.PHONY: dummy-x
|
||||
|
|
66
build.el
66
build.el
|
@ -29,12 +29,12 @@
|
|||
|
||||
(setq debug-on-error t)
|
||||
|
||||
(setenv "FG42_HOME" (concat (getenv "HOME") "/.fg42/"))
|
||||
(defconst fg42/CORE_DIR (concat (getenv "FG42_HOME") "core"))
|
||||
(setq user-emacs-directory (concat (getenv "FG42_HOME") "emacs.d"))
|
||||
|
||||
(defconst fg42/CORE_DIR (concat (getenv "HOME") "/.fg42/core"))
|
||||
(add-to-list 'load-path fg42/CORE_DIR)
|
||||
|
||||
(setenv "FG42_HOME" (concat (getenv "HOME") "/.fg42/"))
|
||||
(setq user-emacs-directory (concat (getenv "FG42_HOME") "emacs.d"))
|
||||
|
||||
(require 'fg42/build/core)
|
||||
(require 'fg42/build/utils)
|
||||
|
||||
|
@ -68,33 +68,9 @@ PARAMS:
|
|||
docs-actions '(fg42/build-prepare-docs))
|
||||
|
||||
|
||||
(defun main ()
|
||||
"The entry point to the build script."
|
||||
(message (fg42/version))
|
||||
(message "\nFG42 Build tool v%s\n\n" (fg42/version))
|
||||
|
||||
;; UTF-8 as default encoding
|
||||
(prefer-coding-system 'utf-8)
|
||||
(set-default-coding-systems 'utf-8)
|
||||
(set-terminal-coding-system 'utf-8)
|
||||
(set-keyboard-coding-system 'utf-8)
|
||||
|
||||
(let* ((fg42-home (car command-line-args-left))
|
||||
(build-dir (from-root "/build"))
|
||||
(parsed-args (read-args (cdr command-line-args-left)))
|
||||
(eval-string (plist-get (car parsed-args) :e))
|
||||
(command (caadr parsed-args))
|
||||
(args (cdadr parsed-args)))
|
||||
|
||||
;; Evaluate the expression provided by :e
|
||||
(when eval-string
|
||||
(eval (car (read-from-string eval-string))))
|
||||
|
||||
(setq debug-mode (plist-get (car parsed-args) :d))
|
||||
|
||||
(cond
|
||||
((string= command "docs")
|
||||
(do-command
|
||||
(command-> command args
|
||||
((string= command "docs")
|
||||
(do-command
|
||||
(require 'fpkg)
|
||||
(fpkg/use dash)
|
||||
(fpkg/use mustache)
|
||||
|
@ -105,23 +81,23 @@ PARAMS:
|
|||
(require 'fg42/build/docs)
|
||||
(fg42/build-docs build-dir)))
|
||||
|
||||
((string= command "compile")
|
||||
(do-command
|
||||
(native-compile-async fg42/CORE_DIR 'recursively)
|
||||
(native-compile-async "~/.fg42.v3.el")
|
||||
|
||||
(print "Compiling FG42 files ...")
|
||||
(while (or comp-files-queue
|
||||
(> (comp-async-runnings) 0))
|
||||
(print ".")
|
||||
(sleep-for 1))
|
||||
|
||||
(message "Done")))
|
||||
|
||||
;; TODO: create a new command to update the license headers for
|
||||
;; the copyright years. Hint: just run:
|
||||
;; sed 's/2010-2021/2010-2022/' -i ` grep '2010-2021' . -R --color --exclude-dir=emacs.d/|cut -d':' -f1`
|
||||
(t (print-help command)))))
|
||||
|
||||
((string= commad "compile")
|
||||
(do-command
|
||||
(native-compile-async fg42/CORE_DIR 'recursively)
|
||||
(native-compile-async "~/.fg42.v3.el")
|
||||
|
||||
(print "Compiling FG42 files ...")
|
||||
(while (or comp-files-queue
|
||||
(> (comp-async-runnings) 0))
|
||||
(print ".")
|
||||
(sleep-for 1))
|
||||
|
||||
(message "Done"))))
|
||||
|
||||
|
||||
(provide 'build)
|
||||
;;; build.el ends here
|
||||
|
|
|
@ -59,7 +59,8 @@ project root.")
|
|||
(defvar fg42/build-docs-actions nil
|
||||
"Set of actions to run before building the
|
||||
main docs.")
|
||||
|
||||
(defvar fg42/build-output-dir "/build"
|
||||
"The path to the build directory.")
|
||||
|
||||
(defmacro defproject (prject-name &rest details)
|
||||
"Create a project with the given DETAILS.
|
||||
|
@ -79,6 +80,37 @@ The build system will consum these details for various purposes."
|
|||
nil))))
|
||||
|
||||
|
||||
(defmacro command-> (command-var args-var &rest body)
|
||||
(declare (indent defun))
|
||||
`(defun main ()
|
||||
"The entry point to the build script."
|
||||
(message (fg42/version))
|
||||
(message "\nFG42 Build tool v%s\n\n" (fg42/version))
|
||||
|
||||
;; UTF-8 as default encoding
|
||||
(prefer-coding-system 'utf-8)
|
||||
(set-default-coding-systems 'utf-8)
|
||||
(set-terminal-coding-system 'utf-8)
|
||||
(set-keyboard-coding-system 'utf-8)
|
||||
|
||||
(let* ((fg42-home (car command-line-args-left))
|
||||
(build-dir (from-root ,fg42/build-output-dir))
|
||||
(parsed-args (read-args (cdr command-line-args-left)))
|
||||
(eval-string (plist-get (car parsed-args) :e))
|
||||
(,command-var (caadr parsed-args))
|
||||
(,args-var (cdadr parsed-args)))
|
||||
|
||||
;; Evaluate the expression provided by :e
|
||||
(when eval-string
|
||||
(eval (car (read-from-string eval-string))))
|
||||
|
||||
(setq fg42/build-debug-mode (plist-get (car parsed-args) :d))
|
||||
|
||||
(cond
|
||||
,@body
|
||||
(t (print-help ,command-var))))))
|
||||
|
||||
|
||||
(defun from-root (path)
|
||||
"Return the full path of the given PATH in the project root."
|
||||
(concat fg42/build-project-root path))
|
||||
|
|
|
@ -153,7 +153,15 @@ Not pages."
|
|||
(let ((posts (get-all-sorted-posts)))
|
||||
(mapconcat
|
||||
(lambda (post)
|
||||
(format " - [[%s/essays/%s][%s]]" base-url (nth 2 post) (nth 1 post)))
|
||||
(format " - [[%s%s/%s?%s][%s]]"
|
||||
base-url
|
||||
fg42/build-docs-pages-dir
|
||||
;; Path
|
||||
(nth 2 post)
|
||||
;; Hash
|
||||
(car post)
|
||||
;; Title
|
||||
(nth 1 post)))
|
||||
posts
|
||||
"\n")))
|
||||
|
||||
|
@ -337,7 +345,7 @@ Not pages."
|
|||
(setq org-latex-listings t)
|
||||
|
||||
(setq org-publish-project-alist
|
||||
`(("fg42.org"
|
||||
`(("website"
|
||||
:base-directory ,stage1-dir
|
||||
:root-directory ,stage1-dir
|
||||
:recursive t
|
||||
|
@ -377,7 +385,7 @@ Not pages."
|
|||
:publishing-directory ,final-dir
|
||||
:recursive t
|
||||
:publishing-function org-publish-attachment)
|
||||
("build" :components ("fg42.org" "statics"))))
|
||||
("build" :components ("website" "statics"))))
|
||||
|
||||
(org-publish-project "build" t nil)
|
||||
(message "Build complete.")
|
||||
|
|
Ładowanie…
Reference in New Issue