hi everybody! I'm trying to use rewrite-clj to rewrite my lib (ns ...) forms in a build step before creating my jar. It was pretty easy until I found (ns ...) forms with conditionals, which are parsed as (read-string "..."). What is the best way of renaming namespaces in :requires and :imports that also works with conditionals? The use case is that I need to duplicate namespaces to enable a debugger I'm writing to be able to instrument itself.
Welcome @jpmonettas!
thanks!
https://github.com/benedekfazekas/mranderson does this kind of thing but for different reasons. It uses rewrite-clj to move namespaces. Can’t remember if it deals with reader conditionals.
yeah I know about MrAnderson but I don't think it works for my case. But now you mention it I could take a look and try to see if I can steal some ideas from it in case it works with conditionals
But… clj-kondo also uses a version of rewrite-clj internally https://github.com/clj-kondo/clj-kondo/tree/master/analysis. I’ve been thinking of using it for MrAnderson to quickly local namespaces and their uses. The thing I’m not sure about yet is the import references.