Skip to content

Commit 7cc4717

Browse files
committed
wip
1 parent bc51c82 commit 7cc4717

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

src/cmds/build.lisp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
(list
2727
(clingon:make-option
2828
:string
29-
:description "path to the ASD file"
29+
:description "system name"
3030
:short-name #\n
3131
:long-name "name"
3232
:required t
@@ -42,19 +42,18 @@
4242
(defun handler (cmd)
4343
"Handler for the `build' command."
4444
(let* ((name (clingon:getopt cmd :name))
45-
(output (clingon:getopt cmd :output))
46-
(name (qob:load-system name)))
47-
(format t "~A" (asdf/system-registry:registered-system name))
48-
(format t "~A" output)
49-
;;(setq asdf/system:build-pathname output)
50-
;;(asdf:operate :build-op name)
45+
(output (clingon:getopt cmd :output)))
46+
;;(format t "~A" (asdf/system-registry:registered-system name))
47+
;;(format t "~A" output)
48+
(qob:setup)
49+
(asdf:operate :build-op name)
5150
))
5251

5352
(defun command ()
5453
"Build the executable."
5554
(clingon:make-command
5655
:name "build"
5756
:description "Build the executable"
58-
:usage "-n /path/to/file.asd -o /bin/program-name"
57+
:usage "-n <name> -o <path>"
5958
:options (options)
6059
:handler #'handler))

src/logger.lisp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,23 @@
3434
(defun -error (fmt &rest args)
3535
"TODO: .."
3636
(apply #'format t fmt args))
37+
38+
(defvar elapsed-time nil
39+
"Log with elapsed time.")
40+
41+
(defvar minimum-reported-time 0.1
42+
"Minimal load time that will be reported.")
43+
44+
(defmacro with-progress (msg-start body msg-end)
45+
"Progress BODY wrapper with prefix (MSG-START) and suffix (MSG-END) messages."
46+
(declare (indent 0) (debug t))
47+
`(if elapsed-time
48+
(let ((now (current-time)))
49+
(ignore-errors (-write ,msg-start)) ,body
50+
(let ((elapsed (float-time (time-subtract (current-time) now))))
51+
(if (< elapsed minimum-reported-time)
52+
(ignore-errors (-msg ,msg-end))
53+
(ignore-errors (-write ,msg-end))
54+
(-msg (ansi-white (format " (%.3fs)" elapsed))))))
55+
(ignore-errors (-write ,msg-start)) ,body
56+
(ignore-errors (-msg ,msg-end))))

src/utils.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
(let ((files (asd-files t)))
1919
(mapc (lambda (file)
2020
(load-system file)
21-
(-info ""))
21+
(-info "Load ASD file ~A" file))
2222
files)))
2323

2424
(defun load-system (filename)

0 commit comments

Comments
 (0)