Skip to content

Commit dd179f4

Browse files
authored
Rework swank.asd to produce actual compilation artifact (slime#760)
* Rework swank.asd to produce actual compilation artifact Until now swank.asd compiled the system files when it was loaded. That is roughly compatible with what slime does when loading swank, however that is not useful for swank that is loaded as a standalone system without slime. Instead of producing compilation artifacts that may be further processed by asdf (either in bundle-op or otherwise) it puts fasls in ~/.slime directory. When a system "foo" depends on "swank" then before the system "foo" is loaded swank is loaded itself. However if we only compile systems and then try to load a bundle then all we have is the swank-loader artifact - no "SWANK" package nor nothing. This issue has been unnoticed because usually people dump images instead of having separate compilation and loading steps. This commit defines two systems "swank" and "swank-exts" - one for the core runtime and one for contribs. * swank.asd: inhibit loading swank only when started from emacs This inhibition is tailored for possibly incompatible slime/swank instances (according to the comment at the top of the file), so there is no need to prevent loading a different swank version in the image without slime. * Remove locking of the system "swank" Don't prevent reloading the system "swank" even if it was previously loaded by emacs. If the user wants to reload swank from a different directory then so be it. Otherwise we can't compile bundles that depend on slime. * meta: add an entry to NEWS section
1 parent e193bc5 commit dd179f4

File tree

2 files changed

+49
-31
lines changed

2 files changed

+49
-31
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
* SLIME News -*- mode: outline; coding: utf-8 -*-
22
* 2.29 (unreleased)
3+
** Core
4+
*** Loading the system "swank" with ASDF produces compilation artifacts
35
** ABCL
46
*** Fix missing source position from string buffer location
57
* 2.28 (January 2023)

swank.asd

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,10 @@
66
;; This is only useful if you want to start a Swank server in a Lisp
77
;; processes that doesn't run under Emacs. Lisp processes created by
88
;; `M-x slime' automatically start the server.
9-
;;
10-
;; If Swank is already loaded (e.g. the Lisp is running under SLIME),
11-
;; then attempts to load it via asdf do nothing, except for emitting a
12-
;; warning if Swank is to be loaded from a location that's different
13-
;; from the location where it was originally loaded from. This
14-
;; behavior is intended to prevent loading a possibly incompatible
15-
;; version of Swank with a running SLIME.
169

1710
;; Usage:
1811
;;
19-
;; (require :swank)
12+
;; (asdf:load-system "swank")
2013
;; (swank:create-swank-server PORT) => ACTUAL-PORT
2114
;;
2215
;; (PORT can be zero to mean "any available port".)
@@ -26,27 +19,50 @@
2619
;; This code has been placed in the Public Domain. All warranties
2720
;; are disclaimed.
2821

29-
(defclass swank-loader-file (asdf:cl-source-file) ())
30-
31-
;;;; after loading run init
32-
33-
(defmethod asdf:perform ((o asdf:load-op) (f swank-loader-file))
34-
(let ((var (uiop:find-symbol* '#:*source-directory* '#:swank-loader nil)))
35-
(cond ((and var (boundp var))
36-
(let ((loaded (truename (symbol-value var)))
37-
(requested (truename (asdf:system-source-directory "swank"))))
38-
(unless (equal requested loaded)
39-
(warn "~@<Not loading SWANK from ~S because it was ~
40-
already loaded from ~S.~:@>"
41-
requested loaded))))
42-
(t
43-
;; swank-loader computes its own source/fasl relation based
44-
;; on the TRUENAME of the loader file, so we need a "manual"
45-
;; CL:LOAD invocation here.
46-
(load (asdf::component-pathname f))
47-
;; After loading, run the swank-loader init routines.
48-
(funcall (read-from-string "swank-loader::init") :reload t)))))
22+
(asdf:defsystem "swank"
23+
:components ((:file "swank-loader")
24+
(:file "packages")
25+
(:file "xref" :if-feature :clisp)
26+
(:file "metering" :if-feature (:or :clozure :clisp :clasp))
27+
(:module "backend"
28+
:pathname "swank"
29+
:components ((:file "backend")
30+
(:file "source-path-parser" :if-feature (:or :cmu :scl :sbcl))
31+
(:file "source-file-cache" :if-feature (:or :cmu :scl :sbcl))
32+
(:file "cmucl" :if-feature :cmu)
33+
(:file "scl" :if-feature :scl)
34+
(:file "sbcl" :if-feature :sbcl)
35+
(:file "ccl" :if-feature :clozure)
36+
(:file "lispworks" :if-feature :lispworks)
37+
(:file "allegro" :if-feature :allegro)
38+
(:file "clisp" :if-feature :clisp)
39+
(:file "abcl" :if-feature :armedbear)
40+
(:file "corman" :if-feature :cormanlisp)
41+
(:file "ecl" :if-feature :ecl)
42+
(:file "clasp" :if-feature :clasp)
43+
(:file "mkcl" :if-feature :mkcl)
44+
(:file "mezzano" :if-feature :mezzano)
45+
(:file "gray" :if-feature (:not :armedbear))
46+
(:file "match")
47+
(:file "rpc")))
48+
(:file "swank")))
4949

50-
(asdf:defsystem :swank
51-
:default-component-class swank-loader-file
52-
:components ((:file "swank-loader")))
50+
(asdf:defsystem "swank/exts"
51+
:depends-on ("swank")
52+
:pathname "contrib"
53+
:components ((:file "swank-util")
54+
(:file "swank-repl")
55+
(:file "swank-c-p-c")
56+
(:file "swank-arglists")
57+
(:file "swank-fuzzy")
58+
(:file "swank-fancy-inspector")
59+
(:file "swank-presentations")
60+
(:file "swank-presentation-streams")
61+
(:file "swank-asdf" :if-feature (:or :asdf2 :asdf3 :sbcl :ecl))
62+
(:file "swank-package-fu")
63+
(:file "swank-hyperdoc")
64+
(:file "swank-sbcl-exts" :if-feature :sbcl)
65+
(:file "swank-mrepl")
66+
(:file "swank-trace-dialog")
67+
(:file "swank-macrostep")
68+
(:file "swank-quicklisp")))

0 commit comments

Comments
 (0)