-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.lisp
71 lines (60 loc) · 1.97 KB
/
action.lisp
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
;;;; action.lisp — Make Common Lisp Program
;;;; Melusina Actions (https://github.com/melusina-org/make-common-lisp-program)
;;;; This file is part of Melusina Actions.
;;;;
;;;; Copyright © 2023 Michaël Le Barbier
;;;; All rights reserved.
;;;; This file must be used under the terms of the MIT License.
;;;; This source file is licensed as described in the file LICENSE, which
;;;; you should have received as part of this distribution. The terms
;;;; are also available at https://opensource.org/licenses/MIT
(require '#:asdf)
(require '#:uiop)
(defpackage #:org.melusina.github-action.make-common-lisp-program
(:use #:common-lisp)
(:local-nicknames
(#:actions #:org.melusina.github-actions))
(:export
#:configure
))
(in-package #:org.melusina.github-action.make-common-lisp-program)
(defparameter *implementation*
(or (uiop:getenv "LISP_IMPLEMENTATION")
"sbcl"))
(defparameter *system*
(uiop:getenv "LISP_SYSTEM"))
(defun build-pathname (&optional (system *system*))
(let ((pathname
(slot-value (asdf:find-system system t) 'asdf/system:build-pathname)))
(flet ((ensure-build-pathname-is-set ()
(unless pathname
(error "Build system ~A does not define a BUILD-PATHNAME." system)))
(finalize-pathname ()
(let ((program-pathname
(if (uiop:os-windows-p)
(concatenate 'string pathname ".exe")
pathname)))
(merge-pathnames
program-pathname
(asdf:system-source-directory system)))))
(ensure-build-pathname-is-set)
(finalize-pathname))))
(defun write-make-program-configuration ()
"Write details about the current Common Lisp Implementation."
(loop :for detail
:in
(list
(list
:key "implementation"
:value *implementation*)
(list
:key "system"
:value *system*)
(list
:key "build-pathname"
:value (build-pathname)))
:do (apply #'actions:set-output detail)))
(defun configure ()
"Perform configuration step."
(write-make-program-configuration))
;;;; End of file `action.lisp'