简体   繁体   中英

Cannot get instrumentable syms in project via Leiningen plugin

I'm trying to write a leiningen plugin based upon clojure.spec.alpha . Among other things, I want to get all of the functions in the project that have been spec'd. This is done by calling instrumentable-syms in clojure.spec.test.alpha . I have a function within my plugin that does this, but when run in the context of another project (via eval-in-project ), the list of instrumentable syms is empty. I suspect this is because the calls to fdef within the project using the plugin, which are generally top-level forms within the source files and which register the specs, are not being evaluated and are thus not being picked up when calling instrumentable-syms .

My question is then, how do I make sure these calls get evaluated so my plugin can find all the spec'd functions in a project.

Try doing something to load the relevant namespaces and thus bring your program "to life", perhaps if you have a file like src/orgname/project/core.clj then you might try calling:

(load "orgname/project/core")

From within the block of code run in the project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM