1.1--- a/lisp/lib/skel/comp/asd.lisp Thu Jul 25 21:08:26 2024 -0400
1.2+++ b/lisp/lib/skel/comp/asd.lisp Fri Jul 26 19:28:10 2024 -0400
1.3@@ -43,9 +43,9 @@
1.4 (defmethod sk-load ((self sk-lisp-system) &key force force-not verbose version)
1.5 (asdf:load-system self :force force :force-not force-not :verbose verbose :version version))
1.6
1.7-(defmethod sk-load-component ((kind (eql :lisp-system)) (path pathname))
1.8+(defmethod sk-load-component ((kind (eql :lisp-system)) (form pathname) &optional (path *default-pathname-defaults*))
1.9 (declare (ignore kind))
1.10- (parse-sk-lisp-system (pathname-name path) path))
1.11+ (parse-sk-lisp-system (pathname-name form) (merge-pathnames form path)))
1.12
1.13 (defmethod sk-compile ((self sk-lisp-system) &key force force-not verbose version &allow-other-keys)
1.14 (asdf:compile-system self :force force :force-not force-not :verbose verbose :version version))
2.1--- a/lisp/lib/skel/comp/cargo.lisp Thu Jul 25 21:08:26 2024 -0400
2.2+++ b/lisp/lib/skel/comp/cargo.lisp Fri Jul 26 19:28:10 2024 -0400
2.3@@ -25,9 +25,9 @@
2.4 (defun parse-sk-rust-system (path)
2.5 path)
2.6
2.7-(defmethod sk-load-component ((kind (eql :rust-system)) (path pathname))
2.8+(defmethod sk-load-component ((kind (eql :rust-system)) (form pathname) &optional (path *default-pathname-defaults*))
2.9 (declare (ignore kind))
2.10- (parse-sk-rust-system path))
2.11+ (parse-sk-rust-system (merge-pathnames form path)))
2.12
2.13 (defmethod sk-compile ((self sk-rust-system) &key &allow-other-keys))
2.14
3.1--- a/lisp/lib/skel/comp/container.lisp Thu Jul 25 21:08:26 2024 -0400
3.2+++ b/lisp/lib/skel/comp/container.lisp Fri Jul 26 19:28:10 2024 -0400
3.3@@ -23,10 +23,13 @@
3.4 (update-id self)
3.5 self))
3.6
3.7-(defmethod sk-load-component ((kind (eql :containerfile)) (name pathname))
3.8+(defmethod sk-load-component ((kind (eql :containerfile))
3.9+ (name pathname)
3.10+ &optional (path *default-pathname-defaults*))
3.11 (declare (ignore kind))
3.12 (sk-convert (deserialize
3.13- (make-pathname :name *default-containerfile* :type (namestring name))
3.14+ (make-pathname :name *default-containerfile* :type (namestring name)
3.15+ :directory path)
3.16 :containerfile)))
3.17
3.18 (defmethod sk-write-file ((self sk-containerfile) &key path)
4.1--- a/lisp/lib/skel/comp/dir-locals.lisp Thu Jul 25 21:08:26 2024 -0400
4.2+++ b/lisp/lib/skel/comp/dir-locals.lisp Fri Jul 26 19:28:10 2024 -0400
4.3@@ -13,6 +13,7 @@
4.4 (defmethod sk-new ((self (eql :dir-locals)) &rest args)
4.5 (apply #'make-instance 'sk-dir-locals args))
4.6
4.7-(defmethod sk-load-component ((kind (eql :dir-locals)) (name pathname))
4.8+(defmethod sk-load-component ((kind (eql :dir-locals)) (form pathname) &optional (path *default-pathname-defaults*))
4.9 (declare (ignore kind))
4.10- (sk-new :dir-locals :ast (read-sxp-file (make-pathname :name (namestring name) :type "el"))))
4.11+ (sk-new :dir-locals :ast (read-sxp-file (make-pathname :name (namestring form) :type "el"
4.12+ :directory path))))
5.1--- a/lisp/lib/skel/comp/org.lisp Thu Jul 25 21:08:26 2024 -0400
5.2+++ b/lisp/lib/skel/comp/org.lisp Fri Jul 26 19:28:10 2024 -0400
5.3@@ -15,13 +15,13 @@
5.4 (update-id self)
5.5 self))
5.6
5.7-(defmethod sk-load-component ((kind (eql :org)) (name pathname))
5.8+(defmethod sk-load-component ((kind (eql :org)) (form pathname) &optional (path *default-pathname-defaults*))
5.9 (declare (ignore kind))
5.10- (let* ((name (namestring name))
5.11- (path (make-pathname :name name :type "org"))
5.12- (comp (sk-convert (org-parse :document path))))
5.13+ (let* ((name (namestring form))
5.14+ (p (make-pathname :name name :type "org" :directory path))
5.15+ (comp (sk-convert (org-parse :document p))))
5.16 (setf (sk-name comp) name)
5.17- (setf (sk-path comp) path)
5.18+ (setf (sk-path comp) p)
5.19 comp))
5.20
5.21 ;; (describe (sk-load-component :org #p"readme"))
6.1--- a/lisp/lib/skel/core/obj.lisp Thu Jul 25 21:08:26 2024 -0400
6.2+++ b/lisp/lib/skel/core/obj.lisp Fri Jul 26 19:28:10 2024 -0400
6.3@@ -146,7 +146,10 @@
6.4
6.5 (declaim (inline bound-string-p sk-dir))
6.6 (defun bound-string-p (o s) (and (slot-boundp o s) (stringp (slot-value o s))))
6.7-(defun sk-dir (o) (directory-namestring (sk-path o)))
6.8+(defun sk-dir (o)
6.9+ (let ((str (directory-namestring (sk-path o))))
6.10+ (unless (sb-sequence:emptyp str)
6.11+ str)))
6.12
6.13 (defmethod load-ast ((self sk-config))
6.14 ;; internal ast is never tagged
6.15@@ -405,70 +408,69 @@
6.16 ;;; SRC
6.17 (if (bound-string-p self 'src)
6.18 (setf (sk-src self) (probe-file (sk-src self)))
6.19- (setf (sk-src self) (pathname (sk-dir self))))
6.20- (let ((*default-pathname-defaults* (sk-src self)))
6.21- (setq *skel-path* *default-pathname-defaults*)
6.22- (when (bound-string-p self 'stash) (setf (sk-stash self) (pathname (the simple-string (sk-stash self)))))
6.23- (when (bound-string-p self 'store) (setf (sk-store self) (pathname (the simple-string (sk-store self)))))
6.24- ;; INCLUDE
6.25- (when-let ((include (sk-include self)))
6.26- (setf (sk-include self) (map 'vector
6.27- ;; recursively load included projects
6.28- (lambda (i) (load-ast
6.29- (sk-read-file
6.30- (make-instance 'sk-project)
6.31- i)))
6.32- include)))
6.33- ;; COMPONENTS
6.34- (when (slot-boundp self 'components)
6.35- (setf (sk-components self) (map 'vector
6.36- (lambda (c)
6.37- (sk-load-component (car c) (merge-pathnames (cadr c) *skel-path*)))
6.38- (sk-components self))))
6.39- ;; SCRIPTS
6.40- (if (bound-string-p self 'scripts)
6.41- (if-let* ((path (probe-file (pathname (the simple-string (sk-scripts self))))))
6.42- (setf (sk-scripts self)
6.43- (if (directory-path-p path)
6.44- (find-files path)
6.45- (list path)))
6.46- (warn! (format nil "ignoring missing scripts directory: ~A" (sk-scripts self)))))
6.47- (when-let ((scripts (sk-scripts self)))
6.48- (setf (sk-scripts self) (map 'vector #'make-sk-script scripts)))
6.49- ;; ENV
6.50- ;; TODO
6.51- (when-let ((env (sk-env self)))
6.52- (setf (sk-env self) (mapcar
6.53- (lambda (e)
6.54- (etypecase e
6.55- (symbol (cons
6.56- (sb-int:keywordicate e)
6.57- (sb-posix:getenv (format nil "~a" (symbol-name e)))))
6.58- (string (cons
6.59- (sb-int:keywordicate e)
6.60- (sb-posix:getenv (string-upcase e))))
6.61- (list
6.62- (cons (sb-int:keywordicate (car e)) (cadr e)))))
6.63- env)))
6.64- ;; RULES
6.65- (when-let ((rules (sk-rules self)))
6.66- (setf (sk-rules self) (map 'vector
6.67- (lambda (x)
6.68- (destructuring-bind (target source &rest recipe) x
6.69- (make-sk-rule target source recipe)))
6.70- rules)))
6.71- ;; VC
6.72- (when-let ((vc (sk-vc self)))
6.73- (etypecase vc
6.74- ((or sk-vc-meta null) nil)
6.75- (vc-designator (setf (sk-vc self) (make-sk-vc-meta vc)))
6.76- (list (setf (sk-vc self) (apply #'make-sk-vc-meta vc)))))
6.77-
6.78- (unless *keep-ast* (setf (ast self) nil))
6.79- (setf (id self) (sxhash (cons (sk-name self) (sk-version self))))
6.80- self))
6.81- ;; invalid ast, signal error
6.82- (invalid-skel-ast ast))))
6.83+ (setf (sk-src self) (or (sk-dir self) *default-pathname-defaults*)))
6.84+ (setq *skel-path* (sk-src self))
6.85+ (when (bound-string-p self 'stash) (setf (sk-stash self) (pathname (the simple-string (sk-stash self)))))
6.86+ (when (bound-string-p self 'store) (setf (sk-store self) (pathname (the simple-string (sk-store self)))))
6.87+ ;; INCLUDE
6.88+ (when-let ((include (sk-include self)))
6.89+ (setf (sk-include self) (map 'vector
6.90+ ;; recursively load included projects
6.91+ (lambda (i) (load-ast
6.92+ (sk-read-file
6.93+ (make-instance 'sk-project)
6.94+ i)))
6.95+ include)))
6.96+ ;; COMPONENTS
6.97+ (when (slot-boundp self 'components)
6.98+ (setf (sk-components self) (map 'vector
6.99+ (lambda (c)
6.100+ (sk-load-component (car c) (pathname (cadr c)) (namestring *skel-path*)))
6.101+ (sk-components self))))
6.102+ ;; SCRIPTS
6.103+ (if (bound-string-p self 'scripts)
6.104+ (if-let* ((path (probe-file (pathname (the simple-string (sk-scripts self))))))
6.105+ (setf (sk-scripts self)
6.106+ (if (directory-path-p path)
6.107+ (find-files path)
6.108+ (list path)))
6.109+ (warn! (format nil "ignoring missing scripts directory: ~A" (sk-scripts self)))))
6.110+ (when-let ((scripts (sk-scripts self)))
6.111+ (setf (sk-scripts self) (map 'vector #'make-sk-script scripts)))
6.112+ ;; ENV
6.113+ ;; TODO
6.114+ (when-let ((env (sk-env self)))
6.115+ (setf (sk-env self) (mapcar
6.116+ (lambda (e)
6.117+ (etypecase e
6.118+ (symbol (cons
6.119+ (sb-int:keywordicate e)
6.120+ (sb-posix:getenv (format nil "~a" (symbol-name e)))))
6.121+ (string (cons
6.122+ (sb-int:keywordicate e)
6.123+ (sb-posix:getenv (string-upcase e))))
6.124+ (list
6.125+ (cons (sb-int:keywordicate (car e)) (cadr e)))))
6.126+ env)))
6.127+ ;; RULES
6.128+ (when-let ((rules (sk-rules self)))
6.129+ (setf (sk-rules self) (map 'vector
6.130+ (lambda (x)
6.131+ (destructuring-bind (target source &rest recipe) x
6.132+ (make-sk-rule target source recipe)))
6.133+ rules)))
6.134+ ;; VC
6.135+ (when-let ((vc (sk-vc self)))
6.136+ (etypecase vc
6.137+ ((or sk-vc-meta null) nil)
6.138+ (vc-designator (setf (sk-vc self) (make-sk-vc-meta vc)))
6.139+ (list (setf (sk-vc self) (apply #'make-sk-vc-meta vc)))))
6.140+
6.141+ (unless *keep-ast* (setf (ast self) nil))
6.142+ (setf (id self) (sxhash (cons (sk-name self) (sk-version self))))
6.143+ self)
6.144+ ;; invalid ast, signal error
6.145+ (invalid-skel-ast ast))))
6.146
6.147 ;; obj -> ast
6.148 (defmethod build-ast ((self sk-project) &key (nullp nil) (exclude '(ast id)))
7.1--- a/lisp/lib/skel/core/proto.lisp Thu Jul 25 21:08:26 2024 -0400
7.2+++ b/lisp/lib/skel/core/proto.lisp Fri Jul 26 19:28:10 2024 -0400
7.3@@ -19,9 +19,11 @@
7.4 (:documentation "Print object SELF."))
7.5 (defgeneric sk-load (self &key &allow-other-keys)
7.6 (:documentation "Load or reload object SELF."))
7.7-(defgeneric sk-load-component (kind form)
7.8+(defgeneric sk-load-component (kind form &optional path)
7.9 (:documentation "Load a component of type KIND from provided FORM, producing an SK-COMPONENT
7.10-type. Usually calls SK-TRANSFORM or SK-CONVERT internally."))
7.11+type. Usually calls SK-TRANSFORM or SK-CONVERT internally.
7.12+
7.13+PATH is an optional directory pathname which will be merged with a filename found in FORM. Defaults to *DEFAULT-PATHNAME-DEFAULTS*."))
7.14 (defgeneric sk-compile (self &key &allow-other-keys)
7.15 (:documentation "Compile object SELF."))
7.16 (defgeneric sk-build (self &key &allow-other-keys)