Fork me on GitHub
#cider
<
2022-10-28
>
dev-hartmann15:10:49

hello folks, I’m trying to create a cider addition for clojure-cli to run aliases if present in the deps.edn, pretty much what is already available for shadow-clj builds

dev-hartmann15:10:53

(defun cider--deps-parse-aliases (hash)
  (let* ((builds (when (hash-table-p hash)
                   (gethash :aliases hash)))
         (build-keys (when (hash-table-p builds)
                       (hash-table-keys builds))))
    (append build-keys '(:none))))

(defun cider--deps-get-aliases ()
  (let ((deps-edn (concat (clojure-project-dir) "deps.edn")))
    (when (file-exists-p deps-edn)
      (with-temp-buffer
        (insert-file-contents deps-edn)
        (let ((hash (car (parseedn-read '((map . identity))))))
          (cider--deps-parse-aliases  hash))))))

(defun cider-get-deps-aliases ()
  (interactive)
  (let ((options (completing-read "Select alias to run: "
                                      (cider--deps-get-aliases))))))

dpsutton15:10:00

lets move this to a thread

dpsutton15:10:10

you’ll need to figure out how this fits into the jack in process overall. Presumably you only ever want to do this when its a deps.edn project. Sometimes there can be multiple so you might have to check the var that sets a preferred build tool. What do we do if there is no preferred build tool and a project.clj file and a deps.edn file. If the clojure-cli-aliases defvar (forget the exact title) is set, do you offer this? Presumably not. But if that is set, can you supply a prefix to override it? If so, do they combine or completely override. Build this locally, iron out the kinks, and then PR or open an issue with this proposed strategy and iron out the decision points in the issue then implement

dev-hartmann15:10:39

all valid points [5:19 PM] will try to figure out the happy path first, to see If i am capable of building this and then work through the branches [5:20 PM] I know that leiningen needs the with-profile args [5:20 PM] and I now that theres the prefered build tool var [5:21 PM] And I think before the jack-in process if prefered build tool is nil there’s a selection which kind of process you want so this will be set

dpsutton15:10:14

Build this locally, iron out the kinks, and then PR [10:18 AM] or open an issue with this proposed strategy and iron out the decision points in the issue then implement