Add defproject to the build system to start creating a generic build system

Bu işleme şunda yer alıyor:
Sameer Rahmani 2022-07-03 22:50:32 +01:00
ebeveyn 6ef2cd853a
işleme 95f7fea814
4 değiştirilmiş dosya ile 45 ekleme ve 16 silme

Dosyayı Görüntüle

@ -55,6 +55,11 @@ PARAMS:
(defproject FG42
project-root (nth 2 command-line-args-left)
fg42/build-docs-actions '(fg42/build-prepare-docs))
(defun print-help (command)
"Print out a usage instructions and print out the invalid msg for COMMAND."
(when command
@ -81,8 +86,6 @@ PARAMS:
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(setq project-root (car command-line-args-left))
(let* ((fg42-home (car command-line-args-left))
(build-dir (from-root "/build"))
(parsed-args (read-args (cdr command-line-args-left)))

Dosyayı Görüntüle

@ -29,20 +29,48 @@
(require 'seq)
(defvar project-root nil
(defvar fg42/build-project-name "FG42"
"The name to be uesd with in the output as as the project name")
(defvar fg42/build-project-root nil
"Root directory of the website source code.")
(defvar debug-mode nil)
(defvar fg42/build-debug-mode nil)
(defvar fg42/build-author-name "Sameer Rahmani")
(defvar fg42/build-author-email "lxsameer@gnu.org")
(defvar fg42/build-docs-actions nil
"Set of actions to run before building the
main docs.")
(defmacro defproject (prject-name &rest details)
"Create a project with the given DETAILS.
The build system will consum these details for various purposes."
(declare (indent defun))
(cons 'progn
(cons `(setq fg42/bulid-project-name
,(symbol-name prject-name))
(seq-reduce
(lambda (forms pair)
(let* ((varname (intern (format "fg42/build-%s" (car pair))))
(val (cadr pair))
(form `(setq ,varname ,val)))
(cons form forms)))
(seq-partition details 2)
nil))))
(defun from-root (path)
"Return the full path of the given PATH in the project root."
(concat project-root path))
(concat fg42/build-project-root path))
(defun prod-p ()
"Return non-nil if debug mode is turned off"
(not debug-mode))
(not fg42/build-debug-mode))
(defun read-args (args)

Dosyayı Görüntüle

@ -32,12 +32,8 @@
(require 'fg42/build/utils)
(require 'fg42/build/ox-template)
(defconst cube-template (from-root "/docs/site/templates/cube.org"))
(defconst cubes-index-template (from-root "/docs/site/templates/cubes.org"))
(defconst author-name "Sameer Rahmani")
(defconst author-email "lxsameer@gnu.org")
(defvar cube-template (from-root "/docs/site/templates/cube.org"))
(defvar cubes-index-template (from-root "/docs/site/templates/cubes.org"))
(defun fg42/build-docs-for-cube (build-dir cube)
@ -280,6 +276,8 @@ Not pages."
(stage1-dir (expand-file-name "site" build-dir))
(final-dir (expand-file-name "site-build" build-dir)))
(mapc (lambda (f) (apply f build-dir base-url)) fg42/build-docs-actions)
;; Create org files for the cubes
(fg42/build-prepare-docs build-dir base-url)
@ -294,8 +292,8 @@ Not pages."
;;; Discover all the org files
(setq org-agenda-files (all-org-files))
(setf user-full-name author-name)
(setf user-mail-address author-email)
(setf user-full-name fg42/build-author-name)
(setf user-mail-address fg42/build-author-email)
;; Disable default header links (top, next)
(setf org-html-home/up-format "")

Dosyayı Görüntüle

@ -75,13 +75,13 @@
(defun fg42/git-branch ()
(cd project-root)
(cd fg42/build-project-root)
(shell-command-to-string "git branch --show-current"))
(defun fg42/version ()
"Returns the current version of FG42."
(cd project-root)
(cd fg42/build-project-root)
(shell-command-to-string (format "git describe %s" (fg42/git-branch))))