diff --git a/README.md b/README.md index 39d3c96..a8531f9 100644 --- a/README.md +++ b/README.md @@ -225,24 +225,24 @@ One can pass this CLI args to `-T:kmono` command ### Package configuration -Package-specific configurations are done within each `deps.edn` file under the `:kmono/config` key: +Package-specific configurations are done within each `deps.edn` file under the `:kmono/package` key: ```clj -:kmono/config {;; maven artifact's group - :group com.example - ;; maven's artifactId - ;; this is optional and inferred from a package's dir name - :artifact my-lib - ;; below are two builtin commands, each package must provide this commands - ;; run :exec :build - :build-cmd "just build" - ;; run :exec :release - :release-cmd "just release"} +:kmono/package {;; maven artifact's group + :group com.example + ;; maven's artifactId + ;; this is optional and inferred from a package's dir name + :artifact my-lib + ;; below are two builtin commands, each package must provide this commands + ;; run :exec :build + :build-cmd "just build" + ;; run :exec :release + :release-cmd "just release"} ``` ## Quick start (kmono.edn) - experimental -If a package directory has `kmono.edn` file it will be preferred. Configuration schema is the same, but without `:kmono/config` top level key: +If a package directory has `kmono.edn` file it will be preferred. Configuration schema is the same, but without `:kmono/package` top level key: ```clj {;; maven artifact's group diff --git a/build/build.clj b/build/build.clj index 45e3277..e7b31b8 100644 --- a/build/build.clj +++ b/build/build.clj @@ -11,7 +11,7 @@ (-> (io/file "deps.edn") slurp edn/read-string - :kmono/config)) + :kmono/package)) (def lib (symbol (or (System/getenv "KMONO_PKG_NAME") (str (:group kmono-config) "/" (:artifact kmono-config))))) diff --git a/deps.edn b/deps.edn index ef4b120..83ea3a7 100644 --- a/deps.edn +++ b/deps.edn @@ -1,7 +1,7 @@ -{:kmono/config {:group com.kepler16 - :artifact kmono - :build-cmd "clojure -T:build build" - :release-cmd "clojure -T:build release"} +{:kmono/package {:group com.kepler16 + :artifact kmono + :build-cmd "clojure -T:build build" + :release-cmd "clojure -T:build release"} :paths ["src" "resources"] :deps {babashka/process {:mvn/version "0.5.21"} babashka/fs {:mvn/version "0.4.19"} diff --git a/src/k16/kmono/adapters/clojure_deps.clj b/src/k16/kmono/adapters/clojure_deps.clj index b2c9f58..b0a2e2f 100644 --- a/src/k16/kmono/adapters/clojure_deps.clj +++ b/src/k16/kmono/adapters/clojure_deps.clj @@ -41,7 +41,7 @@ (->adapter package-path 10000)) ([package-path timeout-ms] (when-let [deps-edn (read-pkg-deps! package-path)] - (when-let [kmono-config (some-> deps-edn :kmono/config)] + (when-let [kmono-config (some-> deps-edn :kmono/package)] (let [{:keys [group artifact] :as config} (-> kmono-config (adapter/ensure-artifact package-path)) diff --git a/src/k16/kmono/config.clj b/src/k16/kmono/config.clj index 543da0c..fe8c96f 100644 --- a/src/k16/kmono/config.clj +++ b/src/k16/kmono/config.clj @@ -20,7 +20,7 @@ (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])))) + (select-keys [:kmono/workspace :kmono/package])))) (defn get-workspace-config [repo-root] @@ -30,8 +30,8 @@ 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") + (not (seq (:kmono/package kmono-merged-props))) + "Both `:kmono/package` and `:kmono/workspace can't be set") (schema/assert-schema! schema/?KmonoWorkspaceConfig "Workspace config error" workspace-config)) (m/encode schema/?KmonoWorkspaceConfig (or workspace-config {}) diff --git a/src/k16/kmono/util.clj b/src/k16/kmono/util.clj index 6cf513b..1baeb50 100644 --- a/src/k16/kmono/util.clj +++ b/src/k16/kmono/util.clj @@ -40,7 +40,12 @@ (try (-> (fs/file file-path) (slurp) - (edn/read-string)) + (edn/read-string) + ;; support for legacy name :kmono/config + (update-keys (fn [k] + (if (= k :kmono/config) + :kmono/package + k)))) (catch Throwable e (throw (ex-info "Could not read deps.edn file" {:file-path file-path diff --git a/test/fixtures/example_repo/packages/bar/deps.edn b/test/fixtures/example_repo/packages/bar/deps.edn index 7f0a22b..2d117e3 100644 --- a/test/fixtures/example_repo/packages/bar/deps.edn +++ b/test/fixtures/example_repo/packages/bar/deps.edn @@ -1,7 +1,7 @@ -{:kmono/config {:group kepler16 - :artifact bar-lib - :build-cmd "just build-and-install" - :release-cmd "just release"} +{:kmono/package {:group kepler16 + :artifact bar-lib + :build-cmd "just build-and-install" + :release-cmd "just release"} :paths ["src"] :aliases {:test {:extra-paths ["test"] :extra-deps {some/dependency {:mvn/version "1.0.0"}}} diff --git a/test/fixtures/example_repo/packages/foo/deps.edn b/test/fixtures/example_repo/packages/foo/deps.edn index 9a0efef..f8f041e 100644 --- a/test/fixtures/example_repo/packages/foo/deps.edn +++ b/test/fixtures/example_repo/packages/foo/deps.edn @@ -1,7 +1,7 @@ -{:kmono/config {:group kepler16 - :artifact foo-lib - :build-cmd "just build-and-install" - :release-cmd "just release"} +{:kmono/package {:group kepler16 + :artifact foo-lib + :build-cmd "just build-and-install" + :release-cmd "just release"} :paths ["src"] :aliases {:test {:extra-paths ["test"] :extra-deps {kepler16/bar {:local/root "../bar"}}}}} diff --git a/test/k16/kmono/config_test.clj b/test/k16/kmono/config_test.clj index 2272f5a..492cde2 100644 --- a/test/k16/kmono/config_test.clj +++ b/test/k16/kmono/config_test.clj @@ -58,13 +58,13 @@ :deps {} :paths ["src"]})) (spit (fs/file repo-root p1-dir "deps.edn") - (str {:kmono/config {:build-cmd "echo 'build p1'" + (str {:kmono/package {: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" + (str {:kmono/package {:group "my-own-group" :build-cmd "echo 'build p2'" :release-cmd "echo 'release p2'"} :deps {} diff --git a/test/k16/kmono/test_utils.clj b/test/k16/kmono/test_utils.clj index 3cb6d49..73d1c84 100644 --- a/test/k16/kmono/test_utils.clj +++ b/test/k16/kmono/test_utils.clj @@ -19,24 +19,24 @@ (fs/create-dirs (fs/path repo-root d))) (spit (fs/file repo-root "deps.edn") - (str {:kmono/config {:group "kmono-test" - :artifact "root-module" - :build-cmd "echo 'build root'" - :release-cmd "echo 'release root'"} + (str {:kmono/package {:group "kmono-test" + :artifact "root-module" + :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 {:group "kmono-test" - :build-cmd "echo 'build p1'" - :release-cmd "echo 'release p1'"} + (str {:kmono/package {:group "kmono-test" + :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 "kmono-test" - :build-cmd "echo 'build p2'" - :release-cmd "echo 'release p2'"} + (str {:kmono/package {:group "kmono-test" + :build-cmd "echo 'build p2'" + :release-cmd "echo 'release p2'"} :deps {} :paths ["src"]}))))