From ddd37b333a5545a41d602bdc11a5d91c536b672d Mon Sep 17 00:00:00 2001 From: Artem Medeu Date: Tue, 21 May 2024 21:16:57 +0500 Subject: [PATCH 1/4] refactor: generic error handling --- src/k16/kmono/ansi.clj | 2 +- src/k16/kmono/api.clj | 42 ++++++++++++++++++++++----------- src/k16/kmono/config_schema.clj | 12 ++++++++++ 3 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/k16/kmono/ansi.clj b/src/k16/kmono/ansi.clj index f8d665d..d33d9e8 100644 --- a/src/k16/kmono/ansi.clj +++ b/src/k16/kmono/ansi.clj @@ -51,7 +51,7 @@ [v msg] (when-not v (println ERROR_PREFIX msg) - (System/exit 1))) + (throw (ex-info msg {:type :errors/assertion})))) (defn print-raw [output] diff --git a/src/k16/kmono/api.clj b/src/k16/kmono/api.clj index 41a8ae7..198912e 100644 --- a/src/k16/kmono/api.clj +++ b/src/k16/kmono/api.clj @@ -10,6 +10,16 @@ [malli.core :as m] [malli.transform :as mt])) +(defmacro with-assertion-error + [& body] + `(try + ~@body + (catch clojure.lang.ExceptionInfo ex# + (let [data# (ex-data ex#)] + (when-not (= :errors/assertion (:type data#)) + (ansi/print-error (ex-message ex#))) + (System/exit 1))))) + (defn- print-stage-results [stage-results] (doseq [stage-result stage-results] @@ -115,9 +125,9 @@ opts) {:keys [repo-root glob exec] :as run-params} (m/decode ?RunOpts opts' mt/default-value-transformer) - config (-> run-params - (merge (config/load-config repo-root glob)) - (config/validate-config!)) + config (->> run-params + (merge (config/load-config repo-root glob)) + (config/validate-config!)) changes (git/scan-for-changes config) _ (ansi/assert-err! (seq (:build-order config)) "no packages to execute found")] (case exec @@ -128,10 +138,11 @@ (defn run ([opts] (run opts nil)) ([opts arguments] - (let [[success?] (-run opts arguments)] - (if success? - (System/exit 0) - (System/exit 1))))) + (with-assertion-error + (let [[success?] (-run opts arguments)] + (if success? + (System/exit 0) + (System/exit 1)))))) (defn- relativize-to-repo-root [repo-root path] @@ -144,23 +155,26 @@ ([opts] (repl opts nil)) ([{:keys [repo-root cp-file configure-lsp?] :as opts} _] - (let [cp-file' (when configure-lsp? - (or (relativize-to-repo-root repo-root cp-file) - (relativize-to-repo-root repo-root ".lsp/.kmonocp"))) - opts' (assoc opts :cp-file (str cp-file'))] - (repl.deps/run-repl opts')))) + (with-assertion-error + (let [cp-file' (when configure-lsp? + (or (relativize-to-repo-root repo-root cp-file) + (relativize-to-repo-root repo-root ".lsp/.kmonocp"))) + opts' (assoc opts :cp-file (str cp-file'))] + (repl.deps/run-repl opts'))))) (defn generate-classpath! ([opts] (generate-classpath! opts nil)) ([opts _] (binding [ansi/*logs-enabled* (:cp-file opts)] - (repl.deps/generate-classpath! opts)))) + (with-assertion-error + (repl.deps/generate-classpath! opts))))) (defn generate-deps! ([opts] (generate-deps! opts nil)) ([opts _] (binding [ansi/*logs-enabled* (:deps-file opts)] - (repl.deps/generate-deps! opts)))) + (with-assertion-error + (repl.deps/generate-deps! opts))))) diff --git a/src/k16/kmono/config_schema.clj b/src/k16/kmono/config_schema.clj index 29c9f29..4b610c5 100644 --- a/src/k16/kmono/config_schema.clj +++ b/src/k16/kmono/config_schema.clj @@ -53,4 +53,16 @@ [:graph ?Graph] [:build-order [:maybe ?BuildOrder]]]) +(defn assert-schema! + ([?schema value] + (assert-schema! ?schema "Schema error" value)) + ([?schema title value] + (binding [ansi/*logs-enabled* true] + (if-not (m/validate ?schema value) + (do (ansi/print-error title) + (ansi/print-shifted + (with-out-str + (pp/pprint (me/humanize (m/explain ?schema value))))) + (throw (ex-info title {:type :errors/assertion}))) + value)))) From 62e4813917f8f7e7821297c85db9981c7f9bf366 Mon Sep 17 00:00:00 2001 From: Artem Medeu Date: Tue, 21 May 2024 21:17:33 +0500 Subject: [PATCH 2/4] feat: workspace support --- src/k16/kmono/config.clj | 101 ++++++++++++++++++++---------- src/k16/kmono/config_schema.clj | 53 ++++++++++++---- src/k16/kmono/repl/deps.clj | 25 ++++---- test/k16/kmono/api_test.clj | 23 +++++++ test/k16/kmono/config_test.clj | 32 ++++++++++ test/k16/kmono/repl/deps_test.clj | 60 +++++++++--------- 6 files changed, 209 insertions(+), 85 deletions(-) diff --git a/src/k16/kmono/config.clj b/src/k16/kmono/config.clj index 3829d83..cc9867e 100644 --- a/src/k16/kmono/config.clj +++ b/src/k16/kmono/config.clj @@ -10,60 +10,96 @@ [k16.kmono.ansi :as ansi] [k16.kmono.config-schema :as schema] [k16.kmono.git :as git] + [k16.kmono.util :as util] [malli.core :as m] - [malli.error :as me])) + [malli.error :as me] + [malli.transform :as mt])) + +(defn- read-workspace-config + [repo-root deps-file] + (let [wp-deps-file (fs/file repo-root deps-file)] + (some-> (when (fs/exists? wp-deps-file) + (util/read-deps-edn! wp-deps-file)) + (select-keys [:kmono/workspace :kmono/config])))) + +(defn get-workspace-config + [repo-root] + (let [kmono-props (read-workspace-config repo-root "deps.edn") + kmono-props-local (read-workspace-config repo-root "deps.local.edn") + kmono-merged-props (merge-with merge kmono-props kmono-props-local) + workspace-config (:kmono/workspace kmono-merged-props)] + (when (seq workspace-config) + (ansi/assert-err! + (not (seq (:kmono/config kmono-merged-props))) + "Both `:kmono/config` and `:kmono/workspace can't be set") + (schema/assert-schema! + schema/?KmonoWorkspaceConfig "Workspace config error" workspace-config)) + (m/encode schema/?KmonoWorkspaceConfig (or workspace-config {}) + (mt/default-value-transformer + {::mt/add-optional-keys true})))) (defn get-adapter [pkg-dir] (or (kmono.edn/->adapter (fs/file pkg-dir)) (clj.deps/->adapter (fs/file pkg-dir)))) -(defn- assert-schema! - [?schema value] - (assert (m/validate ?schema value) - (me/humanize (m/explain ?schema value))) - value) - (defn validate-config! [config] - (assert-schema! schema/?Config config)) + (schema/assert-schema! schema/?Config config)) -(defn- create-package-config [repo-root glob package-dir] +(defn- read-package-config + [workspace-config package-dir] (when-let [adapter (get-adapter package-dir)] - (let [git-repo? (git/git-initialzied? repo-root) - kb-pkg-config (->> (adapter/get-kmono-config adapter) - (assert-schema! schema/?KmonoPackageConfig)) - artifact (or (:artifact kb-pkg-config) + (let [derived-fields (cond-> (select-keys workspace-config + [:group :build-cmd :release-cmd]) + :always (assoc :dir (str package-dir) + :adapter adapter))] + (some->> (adapter/get-kmono-config adapter) + (merge derived-fields) + (schema/assert-schema! schema/?KmonoPackageConfig + "Package config init error"))))) + +(defn- create-package-config + [repo-root glob {:keys [adapter] :as pkg-config}] + (when pkg-config + (let [package-dir (:dir pkg-config) + git-repo? (git/git-initialzied? repo-root) + artifact (or (:artifact pkg-config) (symbol (fs/file-name package-dir))) - pkg-name (str (:group kb-pkg-config) "/" artifact) + pkg-name (str (:group pkg-config) "/" artifact) root-package? (fs/same-file? repo-root package-dir) exclusions (when root-package? (str ":!:" glob)) pkg-commit-sha (or (when git-repo? (git/subdir-commit-sha exclusions package-dir)) "untracked") - pkg-config (merge kb-pkg-config - {:artifact (or (:artifact kb-pkg-config) + pkg-config (merge pkg-config + {:artifact (or (:artifact pkg-config) (symbol (fs/file-name package-dir))) :name pkg-name :commit-sha pkg-commit-sha - :root-package? root-package? - :adapter adapter - :dir (str package-dir)})] - + :root-package? root-package?})] (->> (assoc pkg-config :depends-on (adapter/get-managed-deps adapter)) - (assert-schema! schema/?Package))))) + (schema/assert-schema! schema/?Package "Package config init error"))))) (defn- create-config [repo-root glob] - (let [package-dirs (conj (fs/glob repo-root glob) + (let [workspace-config (get-workspace-config repo-root) + glob' (or glob (:glob workspace-config)) + package-dirs (conj (fs/glob repo-root glob') (-> (fs/path repo-root) (fs/normalize) (fs/absolutize)))] - {:packages (->> package-dirs - (map (partial create-package-config repo-root glob)) - (remove nil?) - vec)})) + (merge + workspace-config + {:glob glob' + :repo-root repo-root + :packages (into [] + (comp + (map (partial read-package-config workspace-config)) + (map (partial create-package-config repo-root glob')) + (remove nil?)) + package-dirs)}))) (defn create-graph {:malli/schema [:=> [:cat schema/?Packages] schema/?Graph]} @@ -156,10 +192,11 @@ (let [graph (create-graph packages)] (assert-missing-deps! graph) (assert-cycles! graph) - {:repo-root repo-root - :glob glob - :packages packages - :package-map (->pkg-map packages) - :graph graph - :build-order (parallel-topo-sort graph)}))))) + (merge config {:package-map (->pkg-map packages) + :graph graph + :build-order (parallel-topo-sort graph)})))))) +(comment + (get-workspace-config ".") + (load-config "." nil) + nil) diff --git a/src/k16/kmono/config_schema.clj b/src/k16/kmono/config_schema.clj index 4b610c5..66e843b 100644 --- a/src/k16/kmono/config_schema.clj +++ b/src/k16/kmono/config_schema.clj @@ -1,7 +1,35 @@ (ns k16.kmono.config-schema (:require + [clojure.pprint :as pp] + [k16.kmono.ansi :as ansi] + [malli.core :as m] + [malli.error :as me] [malli.util :as mu])) +(def ?CommandConfig + [:map + [:glob {:optional true + :default "packages/*"} + :string] + [:snapshot? {:optional true + :default true} + :boolean] + [:include-unchanged? {:optional true + :default true} + :boolean] + [:main-aliases {:optional true} + [:vector :keyword]] + [:aliases {:optional true} + [:vector :keyword]] + [:package-aliases {:optional true} + [:vector :keyword]]]) + +(def ?KmonoWorkspaceConfig + (mu/merge ?CommandConfig + [:map + [:group {:optional true} + [:or :string :symbol]]])) + (def ?KmonoPackageConfig [:map [:group [:or :string :symbol]] @@ -40,18 +68,19 @@ [:vector [:vector :string]]) (def ?Config - [:map {:closed true} - [:exec [:or :string [:enum :build :release]]] - [:glob :string] - [:dry-run? :boolean] - [:snapshot? :boolean] - [:include-unchanged? :boolean] - [:create-tags? :boolean] - [:repo-root :string] - [:packages ?Packages] - [:package-map ?PackageMap] - [:graph ?Graph] - [:build-order [:maybe ?BuildOrder]]]) + (mu/merge + (mu/required-keys ?CommandConfig [:glob :snapshot? :include-unchanged?]) + [:map {:closed true} + [:exec [:or :string [:enum :build :release]]] + [:workspace-config {:optional true} + ?KmonoWorkspaceConfig] + [:dry-run? :boolean] + [:create-tags? :boolean] + [:repo-root :string] + [:packages ?Packages] + [:package-map ?PackageMap] + [:graph ?Graph] + [:build-order [:maybe ?BuildOrder]]])) (defn assert-schema! ([?schema value] diff --git a/src/k16/kmono/repl/deps.clj b/src/k16/kmono/repl/deps.clj index bf0c35e..11c34ea 100644 --- a/src/k16/kmono/repl/deps.clj +++ b/src/k16/kmono/repl/deps.clj @@ -98,8 +98,9 @@ (defn construct-sdeps-overrides! "Accepts kmono config and a collection pairs of package/alias and returns a string for -Sdeps argument" - [config package-alias-pairs] - (let [package-dirs (->> config + [config] + (let [package-alias-pairs (:package-aliases config) + package-dirs (->> config :packages (map (fn [pkg] [(fs/file-name (fs/normalize @@ -144,7 +145,7 @@ (pprint/pprint sdeps-overrides)) "\n" args-str)))) -(defn- cp! +(defn cp! [{:keys [verbose? package-aliases aliases repo-root cp-file]} sdeps-overrides] (let [all-aliases (str (string/join package-aliases) (string/join aliases)) @@ -166,13 +167,13 @@ (bp/shell {:dir repo-root} clojure-cmd)))) (defn- make-cp-params - [config {:keys [package-aliases] :as params}] - (let [package-overrides (construct-sdeps-overrides! config package-aliases) + [config] + (let [package-overrides (construct-sdeps-overrides! config) local-deps-file (fs/file (:repo-root config) "deps.local.edn") deps-local-overrides (when (fs/exists? local-deps-file) (util/read-deps-edn! local-deps-file))] {:package-overrides package-overrides - :cp-params (assoc params + :cp-params (assoc config :package-aliases (-> package-overrides :aliases (keys))) :sdeps-overrides (update package-overrides @@ -184,17 +185,17 @@ [{:keys [repo-root glob] :as params}] (ansi/print-info "Generating kmono REPL classpath...") (assert (m/validate ?ReplParams params) (m/explain ?ReplParams params)) - (let [config (config/load-config repo-root glob) + (let [config (merge (config/load-config repo-root glob) params) {:keys [cp-params sdeps-overrides]} - (make-cp-params config params)] + (make-cp-params config)] (cp! cp-params sdeps-overrides))) (defn generate-deps! [{:keys [repo-root glob deps-file] :as params}] (ansi/print-info "Generating kmono deps.edn...") (assert (m/validate ?ReplParams params) (m/explain ?ReplParams params)) - (let [config (config/load-config repo-root glob) - {:keys [sdeps-overrides]} (make-cp-params config params) + (let [config (merge (config/load-config repo-root glob) params) + {:keys [sdeps-overrides]} (make-cp-params config) project-deps-file (fs/file repo-root "deps.edn") project-deps (when (fs/exists? project-deps-file) (util/read-deps-edn! project-deps-file)) @@ -237,9 +238,9 @@ (ansi/print-info "Starting kmono REPL...") (assert (m/validate ?ReplParams params) (m/explain ?ReplParams params)) (binding [*print-namespace-maps* false] - (let [config (config/load-config repo-root glob) + (let [config (merge (config/load-config repo-root glob) params) {:keys [cp-params package-overrides sdeps-overrides]} - (make-cp-params config params) + (make-cp-params config) main-opts (str "-M" (string/join (-> package-overrides :aliases (keys))) (string/join aliases) diff --git a/test/k16/kmono/api_test.clj b/test/k16/kmono/api_test.clj index 36271db..fcdb9ac 100644 --- a/test/k16/kmono/api_test.clj +++ b/test/k16/kmono/api_test.clj @@ -3,6 +3,7 @@ [babashka.fs :as fs] [clojure.test :refer [deftest is testing use-fixtures]] [k16.kmono.api :as api] + [k16.kmono.repl.deps :as repl.deps] [k16.kmono.test-utils :as test-utils :refer [repo-root]])) (use-fixtures :each test-utils/repo-fixture) @@ -95,3 +96,25 @@ (api/-run release-opts nil))) (is (= #{"kmono-test/root-module@0.0.0.0"} (set (test-utils/get-tags))))))) + +(deftest cp-workplace-test + (let [release-opts {:repo-root repo-root}] + (spit (fs/file repo-root "deps.edn") + (str {:kmono/workspace {:group "kmono-wp-test" + :glob "packages/*" + :aliases [:dev] + :package-aliases [:*/test] + :build-cmd "echo 'build root'" + :release-cmd "echo 'release root'"} + :deps {} + :paths ["src"]})) + (testing "Derive params from workspace" + (with-redefs [repl.deps/cp! (fn [{:keys [package-aliases + aliases]} + sdeps-overrides] + (is (= [:kmono/package-deps + :kmono.pkg/p2.test + :kmono.pkg/p1.test] + package-aliases)) + (is (= [:dev] aliases)))] + (api/generate-classpath! release-opts nil))))) diff --git a/test/k16/kmono/config_test.clj b/test/k16/kmono/config_test.clj index 6f3f620..2272f5a 100644 --- a/test/k16/kmono/config_test.clj +++ b/test/k16/kmono/config_test.clj @@ -45,3 +45,35 @@ (-> config :package-map (update-vals :root-package?))))))) + +(deftest workspace-test + (testing "Packages should derive opts from workspace if not set" + (let [p1-dir "packages/p1" + p2-dir "packages/p2"] + (spit (fs/file repo-root "deps.edn") + (str {:kmono/workspace {:group "kmono-wp-test" + :package-aliases [:*/test] + :build-cmd "echo 'build root'" + :release-cmd "echo 'release root'"} + :deps {} + :paths ["src"]})) + (spit (fs/file repo-root p1-dir "deps.edn") + (str {:kmono/config {:build-cmd "echo 'build p1'" + :release-cmd "echo 'release p1'"} + :deps {} + :paths ["src"]})) + + (spit (fs/file repo-root p2-dir "deps.edn") + (str {:kmono/config {:group "my-own-group" + :build-cmd "echo 'build p2'" + :release-cmd "echo 'release p2'"} + :deps {} + :paths ["src"]})) + (let [config (config/load-config repo-root)] + (is (= 2 (count (:packages config)))) + (is (= #{"my-own-group/p2" "kmono-wp-test/p1"} + (->> config + :packages + (map :name) + (set)))))))) + diff --git a/test/k16/kmono/repl/deps_test.clj b/test/k16/kmono/repl/deps_test.clj index 40ce2a3..150e628 100644 --- a/test/k16/kmono/repl/deps_test.clj +++ b/test/k16/kmono/repl/deps_test.clj @@ -14,33 +14,35 @@ (let [config (config/load-config "test/fixtures/example_repo")] (testing "Should extract aliases and relativize paths" (is (= '{:aliases - {:kmono/package-deps - {:extra-deps {kepler16/bar-lib - {:local/root - "test/fixtures/example_repo/packages/bar"}, - kepler16/foo-lib - {:local/root - "test/fixtures/example_repo/packages/foo"}}} - :kmono.pkg/bar.test - {:extra-deps {some/dependency {:mvn/version "1.0.0"}} - :extra-paths ["packages/bar/test"]} - :kmono.pkg/foo.test - {:extra-deps {kepler16/bar {:local/root "packages/bar"}} - :extra-paths ["packages/foo/test"]}}} - (repl.deps/construct-sdeps-overrides! config [:bar/test - :foo/test]))) + {:kmono/package-deps + {:extra-deps {kepler16/bar-lib + {:local/root + "test/fixtures/example_repo/packages/bar"}, + kepler16/foo-lib + {:local/root + "test/fixtures/example_repo/packages/foo"}}} + :kmono.pkg/bar.test + {:extra-deps {some/dependency {:mvn/version "1.0.0"}} + :extra-paths ["packages/bar/test"]} + :kmono.pkg/foo.test + {:extra-deps {kepler16/bar {:local/root "packages/bar"}} + :extra-paths ["packages/foo/test"]}}} + (repl.deps/construct-sdeps-overrides! + (assoc config :package-aliases [:bar/test + :foo/test])))) (is (= '{:aliases - {:kmono/package-deps - {:extra-deps {kepler16/bar-lib - {:local/root - "test/fixtures/example_repo/packages/bar"}, - kepler16/foo-lib - {:local/root - "test/fixtures/example_repo/packages/foo"}}} - :kmono.pkg/bar.test - {:extra-deps {some/dependency {:mvn/version "1.0.0"}} - :extra-paths ["packages/bar/test"]} - :kmono.pkg/foo.test - {:extra-deps {kepler16/bar {:local/root "packages/bar"}} - :extra-paths ["packages/foo/test"]}}} - (repl.deps/construct-sdeps-overrides! config [:*/test])))))) + {:kmono/package-deps + {:extra-deps {kepler16/bar-lib + {:local/root + "test/fixtures/example_repo/packages/bar"}, + kepler16/foo-lib + {:local/root + "test/fixtures/example_repo/packages/foo"}}} + :kmono.pkg/bar.test + {:extra-deps {some/dependency {:mvn/version "1.0.0"}} + :extra-paths ["packages/bar/test"]} + :kmono.pkg/foo.test + {:extra-deps {kepler16/bar {:local/root "packages/bar"}} + :extra-paths ["packages/foo/test"]}}} + (repl.deps/construct-sdeps-overrides! + (assoc config :package-aliases [:*/test]))))))) From 4db08601c428b864a51b959474cbde138667215d Mon Sep 17 00:00:00 2001 From: Artem Medeu Date: Tue, 21 May 2024 21:17:46 +0500 Subject: [PATCH 3/4] chore: update repl start cmd --- justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/justfile b/justfile index fb59964..b0dc4ac 100644 --- a/justfile +++ b/justfile @@ -34,4 +34,4 @@ test: clojure -M:test -m "kaocha.runner" repl *ARGS: - clojure -M:kmono{{ ARGS }} repl -P ':*/test' -l -v + clojure -M:kmono:test{{ ARGS }} repl From 24efa3e612bb140c514ee2647de65be3b8674590 Mon Sep 17 00:00:00 2001 From: Artem Medeu Date: Tue, 21 May 2024 21:38:00 +0500 Subject: [PATCH 4/4] chore: fix when cp was printed on repl start --- src/k16/kmono/repl/deps.clj | 45 ++++++++++++++++++++----------------- src/k16/kmono/util.clj | 27 ++++++++++------------ 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/k16/kmono/repl/deps.clj b/src/k16/kmono/repl/deps.clj index 11c34ea..ea98902 100644 --- a/src/k16/kmono/repl/deps.clj +++ b/src/k16/kmono/repl/deps.clj @@ -9,6 +9,7 @@ [k16.kmono.adapters.clojure-deps :as clj.deps] [k16.kmono.ansi :as ansi] [k16.kmono.config :as config] + [k16.kmono.config-schema :as config.schema] [k16.kmono.util :as util] [malli.core :as m])) @@ -216,29 +217,31 @@ (defn configure-lsp! [{:keys [repo-root cp-file]}] - (let [lsp-config-file (fs/file repo-root ".lsp/config.edn") - lsp-config (when (fs/exists? lsp-config-file) - (try - (-> lsp-config-file - (slurp) - (edn/read-string)) - (catch Throwable _ {}))) - project-specs (create-project-specs cp-file) - with-project-specs - (assoc lsp-config :project-specs project-specs)] - (ansi/print-info "Setting project-specs for lsp config") - (spit lsp-config-file - (with-out-str - (binding [*print-namespace-maps* false] - (pprint/pprint with-project-specs)))))) + (when (seq cp-file) + (let [lsp-config-file (fs/file repo-root ".lsp/config.edn") + lsp-config (when (fs/exists? lsp-config-file) + (try + (-> lsp-config-file + (slurp) + (edn/read-string)) + (catch Throwable _ {}))) + project-specs (create-project-specs cp-file) + with-project-specs + (assoc lsp-config :project-specs project-specs)] + (ansi/print-info "Setting project-specs for lsp config") + (spit lsp-config-file + (with-out-str + (binding [*print-namespace-maps* false] + (pprint/pprint with-project-specs))))))) (defn run-repl - [{:keys [main-aliases aliases repo-root glob cp-file configure-lsp? verbose?] - :as params}] + [{:keys [repo-root glob] :as params}] (ansi/print-info "Starting kmono REPL...") - (assert (m/validate ?ReplParams params) (m/explain ?ReplParams params)) (binding [*print-namespace-maps* false] - (let [config (merge (config/load-config repo-root glob) params) + (let [{:keys [main-aliases aliases cp-file configure-lsp? verbose?] + :as config} + (merge (config/load-config repo-root glob) params) + _ (config.schema/assert-schema! ?ReplParams "REPL params error" config) {:keys [cp-params package-overrides sdeps-overrides]} (make-cp-params config) main-opts (str "-M" @@ -256,10 +259,10 @@ sdeps-overrides) sdeps (str "-Sdeps '" (pr-str with-nrepl-alias) "'") clojure-cmd (string/join " " ["clojure" sdeps main-opts])] - (when cp-file + (when (seq cp-file) (cp! cp-params sdeps-overrides)) (when configure-lsp? - (configure-lsp! params)) + (configure-lsp! config)) (ansi/print-info "Running clojure...") (when verbose? (print-clojure-cmd sdeps-overrides main-opts)) diff --git a/src/k16/kmono/util.clj b/src/k16/kmono/util.clj index c1d639a..6cf513b 100644 --- a/src/k16/kmono/util.clj +++ b/src/k16/kmono/util.clj @@ -21,21 +21,18 @@ (loop [changes' changes cursor (keys changes)] (if-let [{:keys [published? package-name]} (get changes' (first cursor))] - (do - (println package-name) - - (if-not @published? - (let [dependants (->> graph - (map (fn [[pkg-name deps]] - (when (contains? deps package-name) - pkg-name))) - (remove nil?))] - (recur (reduce (fn [chgs dpn-name] - (update-dependant config chgs dpn-name)) - changes' - dependants) - (rest cursor))) - (recur changes' (rest cursor)))) + (if-not @published? + (let [dependants (->> graph + (map (fn [[pkg-name deps]] + (when (contains? deps package-name) + pkg-name))) + (remove nil?))] + (recur (reduce (fn [chgs dpn-name] + (update-dependant config chgs dpn-name)) + changes' + dependants) + (rest cursor))) + (recur changes' (rest cursor))) changes'))) (defn read-deps-edn!