From ab4f2f349e2201ec5c35f25c3db69e8a4bd4bf87 Mon Sep 17 00:00:00 2001 From: Joakim Tengstrand Date: Thu, 9 Nov 2023 04:38:45 +0100 Subject: [PATCH] Add support for updating libraries to latest version. Issue #376. --- .../src/polylith/clj/core/poly_cli/core.clj | 1 + .../antq/src/polylith/clj/core/antq/core.clj | 20 -------- .../antq/src/polylith/clj/core/antq/ifc.clj | 8 +++- .../src/polylith/clj/core/antq/latest.clj | 24 ++++++++++ .../src/polylith/clj/core/antq/upgrade.clj | 46 +++++++++++++++++++ .../src/polylith/clj/core/api/interface.clj | 4 +- .../src/polylith/clj/core/command/core.clj | 9 +++- .../help/src/polylith/clj/core/help/libs.clj | 6 ++- .../src/polylith/clj/core/help/summary.clj | 1 + .../src/polylith/clj/core/lib/interface.clj | 6 ++- .../core/shell/candidate/specification.clj | 7 +-- .../candidate/select_candidates_test.clj | 4 +- components/tap/deps.edn | 2 +- .../src/polylith/clj/core/user_input/core.clj | 2 + .../polylith/clj/core/version/interface.clj | 4 +- doc/commands.adoc | 8 +++- doc/libraries.adoc | 22 ++++++++- doc/workspace-structure.adoc | 7 ++- next-release.txt | 9 ++-- .../test/project/poly/poly_workspace_test.clj | 17 ++----- readme.adoc | 2 +- scripts/output/help/help.txt | 3 +- scripts/output/help/libs.txt | 5 +- workspace.edn | 1 + 24 files changed, 159 insertions(+), 59 deletions(-) delete mode 100644 components/antq/src/polylith/clj/core/antq/core.clj create mode 100644 components/antq/src/polylith/clj/core/antq/latest.clj create mode 100644 components/antq/src/polylith/clj/core/antq/upgrade.clj diff --git a/bases/poly-cli/src/polylith/clj/core/poly_cli/core.clj b/bases/poly-cli/src/polylith/clj/core/poly_cli/core.clj index 6c03503b4..f5aa4812f 100644 --- a/bases/poly-cli/src/polylith/clj/core/poly_cli/core.clj +++ b/bases/poly-cli/src/polylith/clj/core/poly_cli/core.clj @@ -44,6 +44,7 @@ (-main "ws" "get:components:account:namespaces:src:core:file-path" "ws-file:../sandbox/furkan.edn" ":no-exit") (-main "ws" "get:components:api:namespaces:src:core:file-path" "ws-dir:../../Downloads/polylith-0.1.0-alpha9/" ":no-exit") (-main "check" ":no-exit") + (-main "libs" ":update" ":no-exit") (-main "libs" ":outdated" ":no-exit") (-main "doc" "page:polylith-ci-setup" ":no-exit") (-main "ws-dir:examples/doc-example" ":no-exit") diff --git a/components/antq/src/polylith/clj/core/antq/core.clj b/components/antq/src/polylith/clj/core/antq/core.clj deleted file mode 100644 index 16bb58060..000000000 --- a/components/antq/src/polylith/clj/core/antq/core.clj +++ /dev/null @@ -1,20 +0,0 @@ -(ns ^:no-doc polylith.clj.core.antq.core - (:require [antq.api :as antq] - [polylith.clj.core.common.interface :as common])) - -(defn truncate [version type] - (if (= :git-sha type) - (subs version 0 7) - version)) - -(defn key-value [{:keys [name version latest-version type]}] - [[name (truncate version type)] - (truncate latest-version type)]) - -(defn library->latest-version - "Returns a map where the key is [lib-name lib-version] - and the value is the latest version of the library." - [{:keys [projects]}] - (let [dev-config (:deps (common/find-project "development" projects))] - (into {} (map key-value - (antq/outdated-deps dev-config))))) diff --git a/components/antq/src/polylith/clj/core/antq/ifc.clj b/components/antq/src/polylith/clj/core/antq/ifc.clj index 96e1cd768..6ccfa803f 100644 --- a/components/antq/src/polylith/clj/core/antq/ifc.clj +++ b/components/antq/src/polylith/clj/core/antq/ifc.clj @@ -1,6 +1,10 @@ ;; This interface has the name ifc, just to check that it's allowed! (ns ^:no-doc polylith.clj.core.antq.ifc - (:require [polylith.clj.core.antq.core :as core])) + (:require [polylith.clj.core.antq.latest :as latest] + [polylith.clj.core.antq.upgrade :as upgrade])) (defn library->latest-version [configs] - (core/library->latest-version configs)) + (latest/library->latest-version configs)) + +(defn upgrade-all-libs! [workspace color-mode] + (upgrade/upgrade-all-libs! workspace color-mode)) diff --git a/components/antq/src/polylith/clj/core/antq/latest.clj b/components/antq/src/polylith/clj/core/antq/latest.clj new file mode 100644 index 000000000..ec50c89ef --- /dev/null +++ b/components/antq/src/polylith/clj/core/antq/latest.clj @@ -0,0 +1,24 @@ +(ns ^:no-doc polylith.clj.core.antq.latest + (:require [antq.api :as antq])) + +(defn truncate [version type] + (if (= :git-sha type) + (subs version 0 7) + version)) + +(defn key-value [{:keys [name version latest-version type]}] + [[name (truncate version type)] + (truncate latest-version type)]) + +(defn configs [{:keys [configs]}] + (let [{:keys [bases components projects]} configs] + (concat bases components projects))) + +(defn library->latest-version + "Returns a map where the key is [lib-name lib-version] + and the value is the latest version of the library." + [workspace] + (into {} (map key-value) + (antq/outdated-deps + {:deps (apply merge (mapv #(-> % :deps :deps) + (configs workspace)))}))) diff --git a/components/antq/src/polylith/clj/core/antq/upgrade.clj b/components/antq/src/polylith/clj/core/antq/upgrade.clj new file mode 100644 index 000000000..01b8917f7 --- /dev/null +++ b/components/antq/src/polylith/clj/core/antq/upgrade.clj @@ -0,0 +1,46 @@ +(ns ^:no-doc polylith.clj.core.antq.upgrade + (:require [antq.api :as antq] + [clojure.set :as set] + [polylith.clj.core.antq.latest :as latest] + [polylith.clj.core.util.interface.color :as color])) + +(defn outdated-libs-in-config [config outdated-libs] + (seq (set/intersection outdated-libs + (-> config :deps :deps keys set)))) + +(defn keep? [entity-name lib entity-config] + (contains? (set (get-in entity-config [entity-name :keep-lib-versions])) + lib)) + +(defn keep-lib-version? [entity-name type lib {:keys [bricks projects]}] + (if (= "project" type) + (keep? entity-name lib projects) + (keep? entity-name lib bricks))) + +(defn upgrade-dep-in-config [entity-name type filename lib lib->latest-version settings color-mode] + (when-not (keep-lib-version? entity-name type lib settings) + (let [[[_ version] latest-version] (first (filter #(= lib (-> % ffirst symbol)) + lib->latest-version)) + ok? (get (antq/upgrade-deps! [{:file filename + :dependency {:project :clojure + :type :java + :name (str lib) + :version version + :latest-version latest-version}}]) + true)] + (when ok? + (println (str " Updated " lib " to " latest-version " in " (color/entity type entity-name color-mode) ".")))))) + +(defn upgrade-deps-in-config [{:keys [name type] :as config} outdated-libs lib->latest-version ws-dir settings color-mode] + (let [filename (str ws-dir "/" type "s/" name "/deps.edn")] + (doseq [lib (outdated-libs-in-config config outdated-libs)] + (upgrade-dep-in-config name type filename lib lib->latest-version settings color-mode)))) + +(defn upgrade-all-libs! [{:keys [ws-dir settings] :as workspace} color-mode] + (let [lib->latest-version (latest/library->latest-version workspace) + outdated-libs (set (mapv #(-> % first symbol) + (keys lib->latest-version))) + outdated-configs (filter #(outdated-libs-in-config % outdated-libs) + (latest/configs workspace))] + (doseq [outdated-config outdated-configs] + (upgrade-deps-in-config outdated-config outdated-libs lib->latest-version ws-dir settings color-mode)))) diff --git a/components/api/src/polylith/clj/core/api/interface.clj b/components/api/src/polylith/clj/core/api/interface.clj index 11e9bb6b0..9732ce5f9 100644 --- a/components/api/src/polylith/clj/core/api/interface.clj +++ b/components/api/src/polylith/clj/core/api/interface.clj @@ -57,7 +57,7 @@ any of the three APIs may change version, but the ambition is to never break `:api` and `:test-runner`. With `:ws` it's different, and we know that the workspace structure will change over time, so pay extra - attention every time you bump `clj-poly` and have a look in the `version` component's interface namespace, + attention every time you bump `clj-poly` and have a look at the [versions](https://cljdoc.org/d/polylith/clj-poly/CURRENT/doc/versions) page, which lists all the changes for different versions. Examples of a breaking change of the workspace structure: @@ -69,7 +69,7 @@ Any changes that only add functionality/attributes, will increase the `:non-breaking` number by one. If you use a SNAPSHOT version, then you can check [next-release.txt](https://github.com/polyfy/polylith/blob/issue-318/next-release.txt) - to get a summary of all the changes that have been made since the last final release." + to get a summary of all the changes that have been made since the last stable/final release." {:api version/api-version :test-runner version/test-runner-api-version :ws version/ws-api-version}) diff --git a/components/command/src/polylith/clj/core/command/core.clj b/components/command/src/polylith/clj/core/command/core.clj index fc0db3dee..0627e477b 100644 --- a/components/command/src/polylith/clj/core/command/core.clj +++ b/components/command/src/polylith/clj/core/command/core.clj @@ -81,7 +81,12 @@ ":local" ["shell" (assoc user-input :is-local true)] [cmd user-input]))) -(defn execute [{:keys [cmd args name top-ns branch help is-local more page ws is-tap is-git-add is-github is-commit is-all is-outdated is-show-brick is-show-workspace is-show-project is-verbose is-fake-poly get out interface selected-bricks selected-projects unnamed-args ws-file] :as user-input}] +(defn libs [workspace is-outdated is-update color-mode] + (if is-update + (lib/update-all-libs! workspace color-mode) + (lib/print-lib-table workspace is-outdated))) + +(defn execute [{:keys [cmd args name top-ns branch help is-local more page ws is-tap is-git-add is-github is-commit is-all is-outdated is-update is-show-brick is-show-workspace is-show-project is-verbose is-fake-poly get out interface selected-bricks selected-projects unnamed-args ws-file] :as user-input}] (let [color-mode (common/color-mode user-input) ws-dir (config-reader/workspace-dir user-input) workspace-fn (workspace-reader-fn) @@ -106,7 +111,7 @@ "diff" (diff workspace) "help" (open-help args is-all is-show-project is-show-brick is-show-workspace toolsdeps1? is-fake-poly color-mode) "info" (info/info workspace unnamed-args) - "libs" (lib/print-lib-table workspace is-outdated) + "libs" (libs workspace is-outdated is-update color-mode) "migrate" (migrator/migrate ws-dir workspace) "overview" (overview/print-table workspace) "shell" (shell/start execute user-input workspace-fn workspace color-mode) diff --git a/components/help/src/polylith/clj/core/help/libs.clj b/components/help/src/polylith/clj/core/help/libs.clj index d476e7306..d3bfa5fac 100644 --- a/components/help/src/polylith/clj/core/help/libs.clj +++ b/components/help/src/polylith/clj/core/help/libs.clj @@ -1,17 +1,18 @@ (ns ^:no-doc polylith.clj.core.help.libs (:require [polylith.clj.core.help.shared :as s] - [polylith.clj.core.system.interface :as system] [polylith.clj.core.util.interface.color :as color])) (defn help [extended? cm] (str " Shows all libraries that are used in the workspace.\n" "\n" - " poly libs [" (s/key ":compact" cm) "] [" (s/key ":outdated" cm) "] [out:" (s/key "FILENAME" cm) "]\n" + " poly libs [" (s/key ":compact" cm) "] [" (s/key ":outdated" cm) "] [" (s/key ":update" cm) "] [out:" (s/key "FILENAME" cm) "]\n" "\n" " " (s/key ":compact" cm) " = Shows the table in a more compact way.\n" "\n" " " (s/key ":outdated" cm) " = Shows the latest version of each library, or blank if up to date.\n" "\n" + " " (s/key ":update" cm) " = Updates all libraries to the latest version.\n" + "\n" (if extended? (str " " (s/key "FILENAME" cm) " = The name of the text or image file to create, containing the\n" " output from this command. If " (s/key "FILENAME" cm) " ends with .bmp, .wbmp,\n" @@ -64,6 +65,7 @@ " poly libs\n" " poly libs :compact\n" " poly libs :outdated\n" + " poly libs :update\n" " poly libs out:libs.txt\n" " poly doc page:libraries" (if extended? diff --git a/components/help/src/polylith/clj/core/help/summary.clj b/components/help/src/polylith/clj/core/help/summary.clj index 923beb9ec..8b52f0b5d 100644 --- a/components/help/src/polylith/clj/core/help/summary.clj +++ b/components/help/src/polylith/clj/core/help/summary.clj @@ -177,6 +177,7 @@ " poly libs\n" " poly libs :compact\n" " poly libs :outdated\n" + " poly libs :update\n" " poly libs out:libs.txt\n" (if extended? " poly libs out:libs.png\n" diff --git a/components/lib/src/polylith/clj/core/lib/interface.clj b/components/lib/src/polylith/clj/core/lib/interface.clj index 73317570f..c70f000e8 100644 --- a/components/lib/src/polylith/clj/core/lib/interface.clj +++ b/components/lib/src/polylith/clj/core/lib/interface.clj @@ -1,5 +1,6 @@ (ns ^:no-doc polylith.clj.core.lib.interface - (:require [polylith.clj.core.lib.core :as core] + (:require [polylith.clj.core.antq.ifc :as antq] + [polylith.clj.core.lib.core :as core] [polylith.clj.core.lib.size :as size] [polylith.clj.core.lib.resolve-libs :as resolve-libs] [polylith.clj.core.lib.text-table.lib-table :as lib-table])) @@ -19,6 +20,9 @@ (defn resolve-libs [src-deps override-deps] (resolve-libs/resolve-libs src-deps override-deps)) +(defn update-all-libs! [workspace color-mode] + (antq/upgrade-all-libs! workspace color-mode)) + (defn table [workspace] (let [outdated? (-> workspace :user-input :is-outdated)] (lib-table/table workspace outdated?))) diff --git a/components/shell/src/polylith/clj/core/shell/candidate/specification.clj b/components/shell/src/polylith/clj/core/shell/candidate/specification.clj index 28b603447..5b088eda5 100644 --- a/components/shell/src/polylith/clj/core/shell/candidate/specification.clj +++ b/components/shell/src/polylith/clj/core/shell/candidate/specification.clj @@ -126,15 +126,16 @@ (when (or all? extended?) [info-out])))) ;; libs -(def outdated (c/flag "outdated" :libs)) +(def libs-update (c/flag "update" :libs)) +(def libs-outdated (c/flag "outdated" :libs)) (def libs-out (c/fn-explorer "out" :libs (file-explorer/select-fn))) (def libs-skip (c/fn-explorer "skip" :libs #'ws-projects/select)) (def libs-color-mode (c/fn-values "color-mode" :libs #'color-modes/select)) (defn libs [all? extended?] (c/single-txt "libs" :libs - (concat [outdated] - (when all? [outdated compact libs-skip libs-color-mode]) + (concat [libs-update libs-outdated] + (when all? [compact libs-skip libs-color-mode]) (when (or all? extended?) [libs-out])))) ;; test diff --git a/components/shell/test/polylith/clj/core/shell/candidate/select_candidates_test.clj b/components/shell/test/polylith/clj/core/shell/candidate/select_candidates_test.clj index 67d248183..5f8f85a01 100644 --- a/components/shell/test/polylith/clj/core/shell/candidate/select_candidates_test.clj +++ b/components/shell/test/polylith/clj/core/shell/candidate/select_candidates_test.clj @@ -300,11 +300,11 @@ (deftest libs (is (= (candidates "libs") - [":outdated"]))) + [":outdated" ":update"]))) (deftest libs- (is (= (candidates "libs" :next "") - [":outdated"]))) + [":outdated" ":update"]))) (deftest test (is (= (candidates "test") diff --git a/components/tap/deps.edn b/components/tap/deps.edn index 6125999d7..a2bc15284 100644 --- a/components/tap/deps.edn +++ b/components/tap/deps.edn @@ -1,4 +1,4 @@ {:paths ["src"] - :deps {djblue/portal {:mvn/version "0.48.0"}} + :deps {djblue/portal {:mvn/version "0.49.1"}} :aliases {:test {:extra-paths [] :extra-deps {}}}} diff --git a/components/user-input/src/polylith/clj/core/user_input/core.clj b/components/user-input/src/polylith/clj/core/user_input/core.clj index 1c93e7019..658846cb9 100644 --- a/components/user-input/src/polylith/clj/core/user_input/core.clj +++ b/components/user-input/src/polylith/clj/core/user_input/core.clj @@ -95,6 +95,7 @@ skip tap! top-ns + update! verbose! workspace! ws @@ -136,6 +137,7 @@ (= "true" resources!)) :is-show-workspace (= "true" workspace!) :is-tap (= "true" tap!) + :is-update (= "true" update!) :is-verbose (= "true" verbose!) :more (as-more more) :name name diff --git a/components/version/src/polylith/clj/core/version/interface.clj b/components/version/src/polylith/clj/core/version/interface.clj index 8506b880d..9d864439a 100644 --- a/components/version/src/polylith/clj/core/version/interface.clj +++ b/components/version/src/polylith/clj/core/version/interface.clj @@ -25,7 +25,7 @@ (def minor 2) (def patch 18) (def revision SNAPSHOT) ;; Set to SNAPSHOT or RELEASE. -(def snapshot 11) ;; Increase by one for every snapshot release, or set to 0 if a release. +(def snapshot 12) ;; Increase by one for every snapshot release, or set to 0 if a release. (def snapshot? (= SNAPSHOT revision)) (def name-without-rev (str major "." minor "." patch)) @@ -36,7 +36,7 @@ (def tool (if system/extended? "polyx" "poly")) -(def date "2023-11-07") +(def date "2023-11-09") ;; Execute 'poly doc version' to see when different changes was introduced. (def api-version {:breaking 1, :non-breaking 0}) diff --git a/doc/commands.adoc b/doc/commands.adoc index a40e09026..54b155398 100644 --- a/doc/commands.adoc +++ b/doc/commands.adoc @@ -14,7 +14,7 @@ poly help [source,text] ---- - poly 0.2.18 (2023-11-07) - https://github.com/polyfy/polylith + poly 0.2.18 (2023-11-09) - https://github.com/polyfy/polylith poly CMD [ARGS] - where CMD [ARGS] are: @@ -166,6 +166,7 @@ poly help poly libs poly libs :compact poly libs :outdated + poly libs :update poly libs out:libs.txt poly migrate poly shell @@ -883,12 +884,14 @@ poly help ---- Shows all libraries that are used in the workspace. - poly libs [:compact] [:outdated] [out:FILENAME] + poly libs [:compact] [:outdated] [:update] [out:FILENAME] :compact = Shows the table in a more compact way. :outdated = Shows the latest version of each library, or blank if up to date. + :update = Updates all libraries to the latest version. + FILENAME = The name of the text file to create, containing the output from this command. u u @@ -935,6 +938,7 @@ poly help poly libs poly libs :compact poly libs :outdated + poly libs :update poly libs out:libs.txt poly doc page:libraries ---- diff --git a/doc/libraries.adoc b/doc/libraries.adoc index 9a578b4f2..c57eb6fdc 100644 --- a/doc/libraries.adoc +++ b/doc/libraries.adoc @@ -27,7 +27,7 @@ image::images/libraries/libs.png[] An `x` means that the library is added to the `src` context, while `t` means that it's only used from the `test` context. -We can list the outdated libraries by passing in `:outdated` (which uses https://github.com/liquidz/antq[antq] internally): +We can list the outdated libraries by passing in `:outdated`: [source,shell] ---- @@ -38,6 +38,26 @@ image::images/libraries/libs-outdated.png[] {nbsp} + +[#update] +We can also tell the tool to update all libraries to the latest version, in all `deps.edn` files for all bricks and projects: + +[source,shell] +---- +poly libs :update +---- + +If + +We can ignore updating libraries for a brick or project by adding the `:keep-lib-versions` in `workspace.edn`: + +[source,clojure] +---- +{... + :bricks {"article" {:keep-lib-versions [djblue/portal]}}} + :projects {"realworld-backend" {:alias "rb" + :keep-lib-versions [clj-jwt/clj-jwt clj-time/clj-time]} +---- + Libraries can be specified in three different ways in tools.deps: [%autowidth] diff --git a/doc/workspace-structure.adoc b/doc/workspace-structure.adoc index 0b4193e23..8da0fb3b9 100644 --- a/doc/workspace-structure.adoc +++ b/doc/workspace-structure.adoc @@ -688,7 +688,8 @@ poly ws get:settings * `:bricks` A map with configuration information per brick where the keys are brick names, specified in `workspace.edn`: ** `:ignore-files` A vector containing file or file paths to ignore, e.g.: `["myfile.clj" "myns/another_file.clj" "com/myns/a-thrird-file.clj"]`. -See xref:validations.adoc#ignore-files[Validations]. +** `:keep-lib-versions` A vector containing the library names (as symbols) that should not be affected when executing `poly libs :update`. +See xref:libraries.adoc#update[update libs] and xref:validations.adoc#ignore-files[Validations]. [#color-mode] * `:color-mode` The color mode specified in `~/.config/polylith/config.edn`. @@ -716,6 +717,7 @@ Set to "~/.m2" by default, but can be overridden in `~/.config/polylith/config.e ** `:ignore-files` A vector containing file or file paths to ignore, e.g.: `["myfile.clj" "myns/another_file.clj" "com/myns/a-thrird-file.clj"]`. All files ending with the specified files () will be ignored, or to be exact, if it's an exact match or if it ends with `/` + the string. Dashes (-) will be replaced by underscores (_). +** `:keep-lib-versions` A vector containing the library names (as symbols) that should not be affected when executing `poly libs :update`. ** `:necessary` If we get xref:validations.adoc#warning206[warning 206 - Unreadable namespace in brick/project] and know that the brick(s) has to be included in the project, then we can add the necessary bricks(s) to the project in a vector for this key. ** `:test` *** `:include` Specifies which bricks should be included when running the test command. @@ -779,6 +781,7 @@ poly ws get:user-input :is-show-resources false :is-show-workspace false :is-tap false + :is-update false :is-verbose false :selected-profiles #{} :selected-projects #{} @@ -898,6 +901,8 @@ Used by `poly help deps :workspace` to show help for the deps command when `work * `:is-tap` Set to `true` if `:tap` is given. +* `:is-update` Set to `true` if `:update` is given. Used by the xref:commands.adoc#libs[libs] command. + * `:is-verbose` Used in combination with the `test` command to show extra information. * `:out` Mainly used by the xref:commands.adoc#ws[ws] command, but can also be passed in to the xref:commands.adoc#info[info], xref:commands.adoc#deps[deps], and xref:commands.adoc#libs[libs] commands to generate a text file from the output. diff --git a/next-release.txt b/next-release.txt index 9cf7b4db1..76c04ff67 100644 --- a/next-release.txt +++ b/next-release.txt @@ -6,6 +6,7 @@ Included in 0.2.18-SNAPSHOT #11: 187 Support for more than one interface. Always accept 'interface' and 'ifc' + what's specified in :interface-ns. 205 The new polyx tool has been added that allow us to generate images from command's output. It includes all functionality in 'poly' plus the overview command that generates the info/deb/libs image. + 249 Include bases in the circular dependency check (error 104). 259 Added warning 206 'Unreadable namespace in brick/project' + support for excluding files to parse, see 'poly help check' (warning 206) for details. 264 Improved error messages for workspace.edn and deps.edn config files (we now use clojure.edn when reading edn files). @@ -29,10 +30,11 @@ Included in 0.2.18-SNAPSHOT #11: together with the source code + updated the documentation + added new pages: Artifacts, Doc, Poly as a library, Tap, Test Runners, Validations, Source code, Polyx, and Maintenance. The new 'doc' command was added, giving us easy access all web based, Polylith related documentation. + 376 Support updating all libraries to the latest version, by using 'poly libs :update'. PR Author Description ----- ------------ ---------------------------------------------------------------------------- - 268 seancorfield Start using tools.deps instead of tools.deps.alpha. + 268 seancorfield Start using tools.deps instead of tools.deps.alpha + related PR 269. 275 sundbry Require clojure.tools.deps correctly in build.clj. 319 lread Tweak bb doc task that offers cljdoc previews + the related PRs 320, 321 and 325. 323 john-shaffer Fix NPE when taking the size of a directory. @@ -46,12 +48,13 @@ Other improvements - We no longer include tools.deps as a library when creating projects. - Removed the :all option for the deps and libs commands, so that we no longer include bricks that don't have a lib dep. - Also include missing bases in validation error 107. - - A shell can be started using 'poly :tap' which is equivalent to 'poly shell :tap', this will start a shell + - A shell can be started using 'poly :tap' which is equivalent to 'poly shell :tap'. This will start a shell and open up a portal window at the same time. Other valid first parameters: :all, :fake-poly, :github, :local, :ws-file, and :ws-dir. - The portal window now only includes the workspace structure, which makes it an alternative way to browse the workspace. - In the deps command, we now exclude empty columns (bricks that don't use any library). - If we use switch-ws in a shell and execute a command and give the color-mode, then it will be used by that command. - The autocomplete now works when starting a shell outside a workspace, which can be useful when creating a workspace, or if we want to switch to another workspace. - - The test that executed 'libs :outdated' has been removed, so that it doesn't fail intermittently. + - The test that executed 'libs :outdated' has been removed, so that it doesn't fail intermittently. Earlier, the tests for + a PR could suddenly start failing if a newer version of a used library was released. - If we switch to a file using e.g. 'switch-ws file:ws.edn', the :no-changes will now work properly. diff --git a/projects/poly/test/project/poly/poly_workspace_test.clj b/projects/poly/test/project/poly/poly_workspace_test.clj index 1a30c1fe3..3be5cfa61 100644 --- a/projects/poly/test/project/poly/poly_workspace_test.clj +++ b/projects/poly/test/project/poly/poly_workspace_test.clj @@ -113,7 +113,7 @@ " borkdude/edamame 1.3.23 maven 24 x x x - - . . x . . . . . . ." " clj-commons/fs 1.6.310 maven 12 x x x - - . . x . . . . . . ." " com.github.liquidz/antq 2.7.1133 maven 51 x x x - - x . . . . . . . . ." - " djblue/portal 0.48.0 maven 1,838 x x x - - . . . . . . x . . ." + " djblue/portal 0.49.1 maven 1,841 x x x - - . . . . . . x . . ." " metosin/malli 0.13.0 maven 85 x x x - - . . . . . . . x . ." " mvxcvi/puget 1.3.4 maven 15 x x x - - . . . . . . . . . x" " org.clojure/clojure 1.11.1 maven 4,008 x x x - - . . . . . . . . . ." @@ -185,7 +185,7 @@ " t g n o e o p o l i l o i o e e s l e a e c o l i u i o o c l e l" " brick q e d n r r s c e t p r b r w r h l m p r t r e g t l r n e j r e" " ---------------------------------------------------------------------------------------------------------------------------" - " antq . . . x . . . . . . . . . . . . . . . . . . . . . . . . . . . . ." + " antq . . . . . . . . . . . . . . . . . . . . . . . . . . x . . . . . ." " api . x . . . . . . . . . . . . . . . . . . . . . . . x . . x x x x ." " change . . . x . . . . . x . . . . . x . . . . . . . . . . x . . . . . ." " clojure-test-test-runner . . . . . . . . . . . . . . . . . . . . . x . . . . x . . . . . ." @@ -255,7 +255,7 @@ " t g n o e o p o l i l o i o e e s l e a e c o l i u i o o c l e l" " brick q e d n r r s c e t p r b r w r h l m p r t r e g t l r n e j r e" " ---------------------------------------------------------------------------------------------------------------------------" - " antq . . . x . . . . + . . + . . . . . . + . . . . + + . + . + . . . ." + " antq . . . . . . . . . . . . . . . . . . . . . . . . . . x . . . . . ." " api + x . + + . + . + + . + + . . + + . + . . + . + + x + + x x x x ." " change . . . x . . . . + x . + . . . x + . + . . . . + + . x . + . . . ." " clojure-test-test-runner . . . . . . . . . . . . . . . . . . . . . x . . . . x . . . . . ." @@ -323,7 +323,7 @@ " t g n o e o p o l i l o i o e e s l e a e c o l i u i o o c l e l" " brick q e d n r r s c e t p r b r w r h l m p r t r e g t l r n e j r e" " ---------------------------------------------------------------------------------------------------------------------------" - " antq . . . x . . . . + . . + . . . . . . + . . . . + + . + . + . . . ." + " antq . . . . . . . . . . . . . . . . . . . . . . . . . . x . . . . . ." " api + x . + + . + . + + . + + . . + + . + . . + . + + x + + x x x x ." " change . . . x . . . . + x . + . . . x + . + . . . . + + . x . + . . . ." " clojure-test-test-runner . . . . . . . . . . . . . . . . . . . . . x . . . . x . . . . . ." @@ -392,14 +392,7 @@ (deftest polylith-poly-project-deps (is (= (ws-explorer/extract (workspace) ["projects" "poly" "deps"]) - {"antq" {:src {:direct ["common"] - :indirect ["file" - "image-creator" - "system" - "text-table" - "user-config" - "util" - "version"]} + {"antq" {:src {:direct ["util"]} :test {}} "api" {:src {:direct ["change" "user-input" diff --git a/readme.adoc b/readme.adoc index bfe8ccc05..4e802cc69 100644 --- a/readme.adoc +++ b/readme.adoc @@ -1,7 +1,7 @@ image::doc/images/logo.png[width=400] :cljdoc-doc-url: https://cljdoc.org/d/polylith/clj-poly/CURRENT/doc // Make sure we use the same version here as in components/version/.../interface.clj -:snapshot-version: 0.2.18 SNAPSHOT #11 +:snapshot-version: 0.2.18 SNAPSHOT #12 //https://cljdoc.org/d/polylith/clj-poly/CURRENT[image:https://cljdoc.org/badge/polylith/clj-poly[cljdoc]] https://polylith.gitbook.io/poly[image:https://badgen.net/badge/doc/0.2.17-alpha/blue[]] diff --git a/scripts/output/help/help.txt b/scripts/output/help/help.txt index 1d7c416da..ce2c43c29 100644 --- a/scripts/output/help/help.txt +++ b/scripts/output/help/help.txt @@ -1,4 +1,4 @@ - poly 0.2.18 (2023-11-07) - https://github.com/polyfy/polylith + poly 0.2.18 (2023-11-09) - https://github.com/polyfy/polylith poly CMD [ARGS] - where CMD [ARGS] are: @@ -150,6 +150,7 @@ poly libs poly libs :compact poly libs :outdated + poly libs :update poly libs out:libs.txt poly migrate poly shell diff --git a/scripts/output/help/libs.txt b/scripts/output/help/libs.txt index cdab9bbbf..6f45d235e 100644 --- a/scripts/output/help/libs.txt +++ b/scripts/output/help/libs.txt @@ -1,11 +1,13 @@ Shows all libraries that are used in the workspace. - poly libs [:compact] [:outdated] [out:FILENAME] + poly libs [:compact] [:outdated] [:update] [out:FILENAME] :compact = Shows the table in a more compact way. :outdated = Shows the latest version of each library, or blank if up to date. + :update = Updates all libraries to the latest version. + FILENAME = The name of the text file to create, containing the output from this command. u u @@ -52,5 +54,6 @@ poly libs poly libs :compact poly libs :outdated + poly libs :update poly libs out:libs.txt poly doc page:libraries diff --git a/workspace.edn b/workspace.edn index b17ffb32c..94d53715f 100644 --- a/workspace.edn +++ b/workspace.edn @@ -6,6 +6,7 @@ :compact-views #{} :tag-patterns {:stable "stable-*" :release "v[0-9]*"} + :bricks {"shell" {:keep-lib-versions [org.jline/jline]}} :projects {"poly" {:alias "poly" :necessary ["api" "clojure-test-test-runner"] :test {:setup-fn project.poly.hto/activate!}}