-
-
Save bendlas/4a2a98b1cbe1d1efa8a7ef6850934e13 to your computer and use it in GitHub Desktop.
A piece of `eval-in-leiningen` code to generate source paths for `clojure-lsp` from subprojects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns acme.repl | |
(:require [leiningen.core.project :as prj] | |
[lein-acme-mono.task :as mtask] | |
[clojure.string :as str] | |
[clojure.java.io :as io] | |
[clojure.pprint :refer [pprint]])) | |
(-> | |
(mtask/subprojects | |
(prj/read "project.clj")) | |
keys | |
(->> (map #(str % "/project.clj")) | |
(def subproject-files))) | |
(->> subproject-files | |
(map prj/read) | |
(def subprojects)) | |
(->> subprojects | |
(map :profiles) | |
(mapcat keys) | |
(into #{}) | |
(def profiles)) | |
(->> subprojects | |
(map #(prj/set-profiles % profiles)) | |
(mapcat :source-paths) | |
(into #{}) | |
(def source-paths)) | |
(comment ;; for generating a :source-paths set | |
(->> source-paths | |
(hash-map :source-paths) | |
(pprint) | |
(binding [*out* out]) | |
(with-open [out (io/writer ".lsp/config.edn")])) | |
) | |
(comment ;; for generating a :project-specs vector | |
;; FIXME this doesn't work, see https://github.com/clojure-lsp/clojure-lsp/issues/551 | |
(->> subproject-files | |
(mapv (partial hash-map :project-path)) | |
(hash-map :project-specs) | |
(pprint) | |
(binding [*out* out]) | |
(with-open [out (io/writer ".lsp/config.edn")])) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment