-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrsb-formatting.asd
206 lines (165 loc) · 8.12 KB
/
rsb-formatting.asd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
;;;; rsb-formatting.asd --- Formatting functions for rsb-based utilities.
;;;;
;;;; Copyright (C) 2011-2019 Jan Moringen
;;;;
;;;; Author: Jan Moringen <[email protected]>
(cl:defpackage #:rsb-formatting-system
(:use
#:cl
#:asdf)
(:export
#:version/list
#:version/string))
(cl:in-package #:rsb-formatting-system)
;;; Version stuff
(defparameter +version-major+ 0
"Major component of version number.")
(defparameter +version-minor+ 19
"Minor component of version number.")
(let* ((version-file (merge-pathnames "version.sexp" *load-truename*))
stream)
(when (probe-file version-file)
(setf stream (open version-file)))
(defparameter +version-revision+ (if stream (read stream) 0)
"Revision component of version number.")
(defparameter +version-commit+ (when stream (read stream))
"Commit component of version number.")
(when stream (close stream)))
(defun version/list (&key
(revision? t)
commit?)
"Return a version of the form (MAJOR MINOR [REVISION [COMMIT]])
where REVISION and COMMIT are optional.
REVISION? controls whether REVISION should be included. Default
behavior is to include REVISION.
COMMIT? controls whether COMMIT should be included. Default behavior
is to not include COMMIT."
(append (list +version-major+ +version-minor+)
(when revision? (list +version-revision+))
(when (and commit? +version-commit+)
(list +version-commit+))))
(defun version/string (&rest args
&key
revision?
commit?)
"Return a version string of the form
\"MAJOR.MINOR[.REVISION[-.COMMIT]]\" where REVISION and COMMIT are
optional.
See `version/list' for details on keyword parameters."
(declare (ignore revision? commit?))
(format nil "~{~A.~A~^.~A~^-~A~}" (apply #'version/list args)))
;;; System definition
(defsystem :rsb-formatting
:author "Jan Moringen <[email protected]>"
:maintainer "Jan Moringen <[email protected]>"
:version #.(version/string)
:license "GPLv3" ; see COPYING file for details.
:description "This system provides some formatting functions for
RSB-related systems."
:depends-on (:alexandria
:let-plus
:more-conditions
:cl-interpol
(:version :log4cl "1.1.1")
(:version :architecture.service-provider "0.1")
(:version :utilities.binary-dump "0.1")
(:version :utilities.print-tree "0.1")
(:version :rsb #.(version/string :revision? nil))
(:version :rsb-protocol #.(version/string :revision? nil)) ; for payload-collection
(:version :rsb-transport-socket #.(version/string :revision? nil)) ; likewise
(:version :rsb-introspection #.(version/string :revision? nil)))
:encoding :utf-8
:components ((:module "formatting-early"
:pathname "src/formatting"
:serial t
:components ((:file "package")
(:file "types")
(:file "conditions")
(:file "variables")
(:file "util")
(:file "protocol")
(:file "orders-of-magnitude")
(:file "format-functions")
(:file "dynamic-width")))
(:module "formatting-mixins"
:pathname "src/formatting"
:depends-on ("formatting-early")
:components ((:file "style-mixins")
(:file "text-style-mixins")
(:file "binary-style-mixins")))
(:module "formatting"
:pathname "src/formatting"
:depends-on ("formatting-early"
"formatting-mixins")
:serial t
:components (;; Column classes
(:file "columns")
;; Payload formatting classes
(:file "payload-generic")
(:file "rst-forward")
(:file "payload-audio")
(:file "payload-audio-wav")
;; Event formatting style classes
(:file "event-style-discard")
(:file "event-style-meta-data")
(:file "event-style-payload")
(:file "event-style-detailed")
(:file "event-style-compact")
(:file "event-style-columns")
(:file "event-style-programmable")
(:file "event-style-multiple-files")
(:file "payload-collection"))) ; Uses detailed style at load-time
(:module "formatting-introspection"
:pathname "src/formatting/introspection"
:depends-on ("formatting-early")
:serial t
:components ((:file "package")
(:file "print")
(:file "styles"))))
:in-order-to ((test-op (test-op :rsb-formatting/test))))
;;; System definition for tests of the rsb-formatting system
(defsystem :rsb-formatting/test
:author "Jan Moringen <[email protected]>"
:maintainer "Jan Moringen <[email protected]>"
:version #.(version/string)
:license "GPLv3" ; see COPYING file for details.
:description "This system contains tests for the rsb-formatting
system."
:depends-on (:cl-ppcre
(:version :lift "1.7.1")
(:version :rsb-formatting #.(version/string))
(:version :rsb-formatting-png #.(version/string))
(:version :rsb-formatting-json #.(version/string))
(:version :rsb/test #.(version/string :revision? nil)))
:encoding :utf-8
:components ((:module "formatting-early"
:pathname "test/formatting"
:serial t
:components ((:file "package")
(:file "mock-column")
(:file "protocol")
(:file "orders-of-magnitude")
(:file "dynamic-width")))
(:module "formatting"
:pathname "test/formatting"
:depends-on ("formatting-early")
:components ((:file "style-mixins")
(:file "text-style-mixins")
(:file "style-meta-data")
(:file "style-detailed")
(:file "style-columns")
(:file "style-compact")
(:file "style-programmable")
(:file "style-multiple-files")
(:file "style-json")))
(:module "formatting-introspection"
:pathname "test/formatting/introspection"
:depends-on ("formatting-early")
:serial t
:components ((:file "package")
(:file "json")))))
(defmethod perform ((operation test-op)
(component (eql (find-system :rsb-formatting/test))))
(funcall (find-symbol "RUN-TESTS" :lift)
:config (funcall (find-symbol "LIFT-RELATIVE-PATHNAME" :lift)
"lift-rsb-formatting.config")))