如何告诉ASDF只有在组件文件存在时才会处理它(所以如果还不存在,它就不会生成错误)。
(asdf:defsystem "my-system"
:components ((:file "utilities")
(:file "temp-file" :depends-on ("utilities"))))我的解决办法是使用读取器宏#。在(probe-file "temp-file")上,但不能让它起作用。
发布于 2019-06-19 00:32:45
我认为您真正想做的是让ASDF只是警告您,而不是在编译错误时打开调试器。更改*compile-file-warnings-behaviour*和*compile-file-failure-behaviour*,并在手册中阅读关于错误处理的部分。
其余的答案是如何检查整个系统。您可以将可能加载的文件打包到他们自己的系统中,然后按照下面的方式进行。
6.3.8弱依赖 我们不建议您使用此功能。
所以无论如何你都可以用它。如下所示:
(defpackage :foo-system
(:use :cl :asdf))
(in-package :foo-system)
(defsystem foo
:description "The main package that maybe loads bar if it exists."
:weakly-depends-on (:bar)
:components ((:file "foo")))很简单对吧?
以下是他们的建议:
如果您想编写一个依赖于系统条的系统foo,我们建议您用参数化的方式编写system,并提供一些特殊的变量和/或一些钩子来专门化它的行为;然后您应该编写一个系统foo+bar,它可以将事物连接在一起。
我从来没有在野外见过这样的动物,可能是因为这样做是一种可怕的混乱。
(defpackage :bar-system
(:use :cl :asdf))
(in-package :bar-system)
(defsystem bar
:description "The package that maybe exists and is needed by foo."
:components ((:file "bar")))
(defpackage :foo+bar-system
(:use :cl :asdf))
(in-package :foo+bar-system)
(defsystem foo+bar
:version "0.1.0"
:description "Hook together foo and bar."
:author "Spenser Truex <web@spensertruex.com>"
:serial t
:components ((:file "foo+bar")))
(defpackage :foo-system
(:use :cl :asdf))
(in-package :foo-system)
(defsystem foo
:description "The main package that maybe loads bar if it exists."
:depends-on (:foo+bar)
:components ((:file "foo")))https://stackoverflow.com/questions/56483597
复制相似问题