[Git][clojure-team/tools-namespace-clojure][upstream] New upstream version 1.5.1

Thomas Goirand (@zigo) gitlab at salsa.debian.org
Sat Jul 18 16:21:25 BST 2026



Thomas Goirand pushed to branch upstream at Debian Clojure Maintainers / tools-namespace-clojure


Commits:
09ff177b by Thomas Goirand at 2026-07-18T17:14:13+02:00
New upstream version 1.5.1
- - - - -


14 changed files:

- + .github/workflows/doc-build.yml
- + .github/workflows/release.yml
- + .github/workflows/snapshot.yml
- + .github/workflows/test.yml
- .gitignore
- CHANGES.md
- README.md
- deps.edn
- pom.xml
- src/main/clojure/clojure/tools/namespace/find.clj
- src/main/clojure/clojure/tools/namespace/repl.clj
- src/main/clojure/clojure/tools/namespace/track.cljc
- src/test/clojure/clojure/tools/namespace/find_test.clj
- src/test/clojure/clojure/tools/namespace/test_helpers.clj


Changes:

=====================================
.github/workflows/doc-build.yml
=====================================
@@ -0,0 +1,13 @@
+name: Build API Docs
+
+permissions:
+  contents: write
+
+on:
+  workflow_dispatch:
+
+jobs:
+  call-doc-build-workflow:
+    uses: clojure/build.ci/.github/workflows/doc-build.yml at master
+    with:
+      project: clojure/tools.namespace


=====================================
.github/workflows/release.yml
=====================================
@@ -0,0 +1,22 @@
+name: Release on demand
+
+permissions:
+  contents: write
+
+on:
+  workflow_dispatch:
+    inputs:
+      releaseVersion:
+        description: "Version to release"
+        required: true
+      snapshotVersion:
+        description: "Snapshot version after release"
+        required: true
+
+jobs:
+  call-release:
+    uses: clojure/build.ci/.github/workflows/release.yml at master
+    with:
+      releaseVersion: ${{ github.event.inputs.releaseVersion }}
+      snapshotVersion: ${{ github.event.inputs.snapshotVersion }}
+    secrets: inherit
\ No newline at end of file


=====================================
.github/workflows/snapshot.yml
=====================================
@@ -0,0 +1,11 @@
+name: Snapshot on demand
+
+permissions:
+  contents: read
+
+on: [workflow_dispatch]
+
+jobs:
+  call-snapshot:
+    uses: clojure/build.ci/.github/workflows/snapshot.yml at master
+    secrets: inherit


=====================================
.github/workflows/test.yml
=====================================
@@ -0,0 +1,10 @@
+name: Test
+
+permissions:
+  contents: read
+
+on: [push]
+
+jobs:
+  call-test:
+    uses: clojure/build.ci/.github/workflows/test.yml at master


=====================================
.gitignore
=====================================
@@ -2,3 +2,5 @@ target
 .cpcache
 .idea/
 *.iml
+.clj-kondo/
+.lsp/


=====================================
CHANGES.md
=====================================
@@ -2,6 +2,39 @@
 
 ## 1.x series
 
+## Version 1.5.1
+
+* Update parent pom and dependency versions
+
+## Version 1.5.0
+
+* Update parent pom and dependency versions
+
+## Version 1.4.5
+
+* Fix [TNS-58](https://clojure.atlassian.net/browse/TNS-58): Split refresh logic into scan and refresh-scanned so scan can be called separately
+
+## Version 1.4.4
+
+* Fix [TNS-59](https://clojure.atlassian.net/browse/TNS-59): Fix source files without namespace declaration in a jar file
+
+## Version 1.4.3
+
+* Fix [TNS-60](https://clojure.atlassian.net/browse/TNS-60): CCE on JarFile find
+
+## Version 1.4.2
+
+* Fix [TNS-59](https://clojure.atlassian.net/browse/TNS-59): Files without ns declaration throw on find operation
+
+## Version 1.4.1
+
+  * Fix [TNS-55](https://clojure.atlassian.net/browse/TNS-55): Provide source file info in find functions
+
+## Version 1.4.0
+
+  * Fix [TNS-6](https://clojure.atlassian.net/browse/TNS-6): Attempt to reload deleted file
+  * Fix [TNS-24](https://clojure.atlassian.net/browse/TNS-24): Broken tracker after mis-named namespace
+
 ## Version 1.3.0
 
   * Fix [TNS-56](https://clojure.atlassian.net/browse/TNS-56): Don't consider :as-alias as a load dependency for namespaces


=====================================
README.md
=====================================
@@ -23,34 +23,34 @@ This project follows the version scheme MAJOR.MINOR.PATCH where each component p
 
 ### Stable Release ###
 
-Latest stable release is [1.2.0](https://github.com/clojure/tools.namespace/tree/v1.2.0)
+Latest stable release is [1.5.0](https://github.com/clojure/tools.namespace/tree/v1.5.0)
 
-[CLI/`deps.edn`](https://clojure.org/reference/deps_and_cli) dependency information:
+[CLI/`deps.edn`](https://clojure.org/reference/deps_edn) dependency information:
 ```clojure
-org.clojure/tools.namespace {:mvn/version "1.2.0"}
+org.clojure/tools.namespace {:mvn/version "1.5.0"}
 ```
 
 [Leiningen](https://leiningen.org/) stable dependency information:
 
-    [org.clojure/tools.namespace "1.2.0"]
+    [org.clojure/tools.namespace "1.5.0"]
 
 [Maven](https://maven.apache.org/) stable dependency information:
 
     <dependency>
       <groupId>org.clojure</groupId>
       <artifactId>tools.namespace</artifactId>
-      <version>1.2.0</version>
+      <version>1.5.0</version>
     </dependency>
 
 ### Development Snapshots ###
 
-Git master branch is at **1.2.1-SNAPSHOT**
+Git master branch is at **1.5.1-SNAPSHOT**
 
 [All Snapshot Versions](https://oss.sonatype.org/content/groups/public/org/clojure/tools.namespace/)
 
 Leiningen dependency information for development snapshots:
 
-    :dependencies [[org.clojure/tools.namespace "1.2.1-SNAPSHOT"]]
+    :dependencies [[org.clojure/tools.namespace "1.5.1-SNAPSHOT"]]
     :repositories [["sonatype-oss-public"
                     "https://oss.sonatype.org/content/groups/public/"]]
 
@@ -168,7 +168,7 @@ compile. I wrote tools.namespace to help speed up this development
 cycle.
 
 For more detail on how I use tools.namespace in my development
-workflow, see the article [My Clojure Workflow, Reloaded](http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded).
+workflow, see the article [My Clojure Workflow, Reloaded](https://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded).
 
 
 
@@ -566,15 +566,14 @@ Developer Information
 * [GitHub project](https://github.com/clojure/tools.namespace)
 * [How to contribute](https://clojure.org/community/contributing)
 * [Bug Tracker](https://clojure.atlassian.net/browse/TNS)
-* [Continuous Integration](https://build.clojure.org/job/tools.namespace/)
-* [Compatibility Test Matrix](https://build.clojure.org/job/tools.namespace-test-matrix/)
+* [Continuous Integration](https://github.com/clojure/tools.namespace/actions/workflows/test.yml)
 
 
 
 Copyright and License
 ----------------------------------------
 
-Copyright © 2012-2021 Rich Hickey, Stuart Sierra, and contributors
+Copyright © Rich Hickey, Alessandra Sierra, and contributors
 
 All rights reserved. The use and
 distribution terms for this software are covered by the
@@ -584,4 +583,4 @@ in any fashion, you are agreeing to be bound by the terms of this
 license. You must not remove this notice, or any other, from this
 software.
 
-[Eclipse Public License 1.0]: https://opensource.org/licenses/eclipse-1.0.php
+[Eclipse Public License 1.0]: https://opensource.org/license/epl-1-0/


=====================================
deps.edn
=====================================
@@ -1,9 +1,13 @@
-{:deps {org.clojure/tools.namespace {:local/root "." :deps/manifest :pom}}
+{:paths ["src/main/clojure"]
+ :deps
+ {org.clojure/java.classpath {:mvn/version "1.1.1"}
+  org.clojure/tools.reader {:mvn/version "1.6.0"}}
+
  :aliases
  {:test
   {:extra-paths ["src/test/clojure"]
    :extra-deps {io.github.cognitect-labs/test-runner
-                {:git/tag "v0.5.0" :git/sha "b3fd0d2"}}
+                {:git/tag "v0.5.1" :git/sha "dfb30dd"}}
    ;; :main-opts ["-m" "cognitect.test-runner" "-d" "src/test/clojure"]
    :exec-fn cognitect.test-runner.api/test
    :exec-args {:dirs ["src/test/clojure"]}}}}


=====================================
pom.xml
=====================================
@@ -1,13 +1,14 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <artifactId>tools.namespace</artifactId>
-  <version>1.3.0</version>
+  <version>1.5.1</version>
   <name>tools.namespace</name>
+  <description>Tools for managing namespaces in Clojure.</description>
 
   <parent>
     <groupId>org.clojure</groupId>
     <artifactId>pom.contrib</artifactId>
-    <version>1.1.0</version>
+    <version>1.4.0</version>
   </parent>
 
   <dependencies>
@@ -20,31 +21,25 @@
     <dependency>
       <groupId>org.clojure</groupId>
       <artifactId>java.classpath</artifactId>
-      <version>1.0.0</version>
+      <version>1.1.1</version>
     </dependency>
     <dependency>
       <groupId>org.clojure</groupId>
       <artifactId>tools.reader</artifactId>
-      <version>1.3.6</version>
+      <version>1.6.0</version>
     </dependency>
   </dependencies>
 
   <properties>
     <clojure.warnOnReflection>true</clojure.warnOnReflection>
-    <clojure.version>1.7.0</clojure.version>
+    <clojure.version>1.11.4</clojure.version>
   </properties>
 
-  <developers>
-    <developer>
-      <name>Stuart Sierra</name>
-    </developer>
-  </developers>
-
   <scm>
     <connection>scm:git:git at github.com:clojure/tools.namespace.git</connection>
     <developerConnection>scm:git:git at github.com:clojure/tools.namespace.git</developerConnection>
     <url>git at github.com:clojure/tools.namespace.git</url>
-    <tag>v1.3.0</tag>
+    <tag>v1.5.1</tag>
   </scm>
 
 </project>


=====================================
src/main/clojure/clojure/tools/namespace/find.clj
=====================================
@@ -19,6 +19,8 @@
                     InputStreamReader)
            (java.util.jar JarFile JarEntry)))
 
+(set! *warn-on-reflection* true)
+
 (def ^{:added "0.3.0"}
   clj
   "Platform definition of file extensions and reader options for
@@ -77,6 +79,9 @@
 (defn find-ns-decls-in-dir
   "Searches dir recursively for (ns ...) declarations in Clojure
   source files; returns the unevaluated ns declarations.
+  The symbol name in the returned ns declaration will contain metadata
+  for the corresponding directory and located file within at keys
+  :dir and :file.
 
   Optional second argument platform is either clj (default) or cljs,
   both defined in clojure.tools.namespace.find."
@@ -84,7 +89,11 @@
   ([dir] (find-ns-decls-in-dir dir nil))
   ([dir platform]
    (keep #(ignore-reader-exception
-           (file/read-file-ns-decl % (:read-opts platform)))
+           (let [[_ nom & more :as decl] (file/read-file-ns-decl % (:read-opts platform))]
+             (when (and decl nom (symbol? nom))
+               (list* 'ns (with-meta nom
+                            {:dir (.getName ^File dir) :file (.getName ^File %)})
+                      more))))
          (find-sources-in-dir dir platform))))
 
 (defn find-namespaces-in-dir
@@ -131,6 +140,9 @@
   "Attempts to read a (ns ...) declaration from the named entry in the
   JAR file, and returns the unevaluated form. Returns nil if read
   fails due to invalid syntax or if a ns declaration cannot be found.
+  The symbol name in the returned ns declaration will contain metadata
+  for the corresponding jar filename and located file within at keys
+  :jar and :file.
 
   Optional third argument platform is either clj (default) or cljs,
   both defined in clojure.tools.namespace.find."
@@ -142,7 +154,11 @@
                       (io/reader
                        (.getInputStream jarfile (.getEntry jarfile entry-name))))]
        (ignore-reader-exception
-        (parse/read-ns-decl rdr read-opts))))))
+        (let [[_ nom & more :as decl] (parse/read-ns-decl rdr read-opts)]
+          (when (and decl nom (symbol? nom))
+              (list* 'ns (with-meta nom
+                           {:jar (.getName ^JarFile jarfile) :file entry-name})
+                     more))))))))
 
 (defn find-ns-decls-in-jarfile
   "Searches the JAR file for source files containing (ns ...)


=====================================
src/main/clojure/clojure/tools/namespace/repl.clj
=====================================
@@ -80,33 +80,74 @@
     (when (find-ns ns-name)
       (alias alias-sym ns-name))))
 
-(defn- do-refresh [scan-opts after-sym]
-  (when after-sym
-    (assert (symbol? after-sym) ":after value must be a symbol")
-    (assert (namespace after-sym)
-            ":after value must be a namespace-qualified symbol"))
-  (let [current-ns-name (ns-name *ns*)
-        current-ns-refers (referred *ns*)
-        current-ns-aliases (aliased *ns*)]
-    (alter-var-root #'refresh-tracker dir/scan-dirs refresh-dirs scan-opts)
-    (alter-var-root #'refresh-tracker remove-disabled)
-    (print-pending-reloads refresh-tracker)
-    (alter-var-root #'refresh-tracker reload/track-reload)
-    (in-ns current-ns-name)
-    (let [result (print-and-return refresh-tracker)]
-      (if (= :ok result)
-        (if after-sym
-          (if-let [after (ns-resolve *ns* after-sym)]
-            (after)
-            (throw (Exception.
-                    (str "Cannot resolve :after symbol " after-sym))))
-          result)
-        ;; There was an error, recover as much as we can:
-        (do (when-not (or (false? (::unload (meta *ns*)))
+(defn scan
+  "Scans directories for files which have changed since the last time
+  'scan' or 'refresh' was run; updates the dependency tracker
+  with new/changed/deleted files.
+
+  Optional argument is map of options:
+
+      :platform  Either clj (default) or cljs, both defined in
+                 clojure.tools.namespace.find, controls file extensions
+                 and reader options.
+
+      :add-all?  If true, assumes all extant files are modified regardless
+                 of filesystem timestamps.
+
+  Returns map with keys:
+
+      ::track/unload   list of namespace symbols that will be unloaded
+      ::track/load     list of namespace symbols that will be loaded"
+  ([]
+   (scan nil))
+  ([options]
+   (alter-var-root #'refresh-tracker
+     #(-> %
+        (dir/scan-dirs refresh-dirs options)
+        (remove-disabled)))))
+
+(defn refresh-scanned
+  "Reloads namespaces in dependency order. Does not scan directories again,
+  expected to be used after 'scan'.
+
+  Returns :ok or an error; sets the latest exception to
+  clojure.core/*e (if *e is thread-bound).
+
+  The directories to be scanned are controlled by 'set-refresh-dirs';
+  defaults to all directories on the Java classpath.
+
+  Options are key-value pairs. Valid options are:
+
+      :after   Namespace-qualified symbol naming a zero-argument
+               function to be invoked after a successful refresh. This
+               symbol will be resolved *after* all namespaces have
+               been reloaded."
+  [& options]
+  (let [{:keys [after]} options]
+    (when after
+      (assert (symbol? after) ":after value must be a symbol")
+      (assert (namespace after)
+        ":after value must be a namespace-qualified symbol"))
+    (let [current-ns-name (ns-name *ns*)
+          current-ns-refers (referred *ns*)
+          current-ns-aliases (aliased *ns*)]
+      (print-pending-reloads refresh-tracker)
+      (alter-var-root #'refresh-tracker reload/track-reload)
+      (in-ns current-ns-name)
+      (let [result (print-and-return refresh-tracker)]
+        (if (= :ok result)
+          (if after
+            (if-let [after (ns-resolve *ns* after)]
+              (after)
+              (throw (Exception.
+                       (str "Cannot resolve :after symbol " after))))
+            result)
+          ;; There was an error, recover as much as we can:
+          (do (when-not (or (false? (::unload (meta *ns*)))
                           (false? (::load (meta *ns*))))
-              (recover-ns current-ns-refers current-ns-aliases))
+                (recover-ns current-ns-refers current-ns-aliases))
             ;; Return the Exception to the REPL:
-            result)))))
+            result))))))
 
 (defn disable-unload!
   "Adds metadata to namespace (or *ns* if unspecified) telling
@@ -142,7 +183,8 @@
                been reloaded."
   [& options]
   (let [{:keys [after]} options]
-    (do-refresh {:platform find/clj} after)))
+    (scan {:platform find/clj})
+    (apply refresh-scanned options)))
 
 (defn refresh-all
   "Scans source code directories for all Clojure source files and
@@ -159,7 +201,9 @@
                been reloaded."
   [& options]
   (let [{:keys [after]} options]
-    (do-refresh {:platform find/clj :add-all? true} after)))
+    (scan {:platform find/clj
+           :add-all? true})
+    (apply refresh-scanned options)))
 
 (defn set-refresh-dirs
   "Sets the directories which are scanned by 'refresh'. Supports the


=====================================
src/main/clojure/clojure/tools/namespace/track.cljc
=====================================
@@ -96,7 +96,7 @@
          :or {load (), unload (), deps (dep/graph)}} tracker
         known (set (dep/nodes deps))
         removed-names (filter known names)
-        new-deps (remove-deps deps removed-names)
+        new-deps (reduce dep/remove-all deps removed-names)
         changed (affected-namespaces deps removed-names)]
     (assoc tracker
       ::deps new-deps


=====================================
src/test/clojure/clojure/tools/namespace/find_test.clj
=====================================
@@ -27,3 +27,14 @@
     (is (help/same-files?
          [main-cljs one-cljc two-cljs]
          (find/find-sources-in-dir dir find/cljs)))))
+
+(deftest t-find-ns-decl-meta
+  (let [dir (help/create-temp-dir "t-find-clj-and-cljc-files")
+        main-clj (help/create-source dir 'example.main :clj '[example.one])
+        one-cljc (help/create-source dir 'example.one :cljc '[example.two])
+        two-clj (help/create-source dir 'example.two :clj)
+        two-cljs (help/create-source dir 'example.two :cljs)
+        headless-clj (help/create-headless-source dir 'example.headless :clj)]
+    (is (every? #{(.getName ^java.io.File dir)}
+         (map #(-> % second meta :dir)
+              (find/find-ns-decls [dir]))))))


=====================================
src/test/clojure/clojure/tools/namespace/test_helpers.clj
=====================================
@@ -73,6 +73,22 @@
                    (list 'ns sym))]
      (create-file full-path (into [ns-decl] contents)))))
 
+(defn create-headless-source
+  "Creates a file at the correct path under base-dir for a file that
+  declares in-ns for namespace named sym, with file extension (keyword)
+  and will also require the dependencies (symbols). Optional contents
+  written after the ns declaration as by write-contents."
+  ([base-dir sym extension]
+   (create-headless-source base-dir sym extension nil nil))
+  ([base-dir sym extension dependencies]
+   (create-headless-source base-dir sym extension dependencies nil))
+  ([base-dir sym extension dependencies contents]
+   (let [full-path (into [base-dir] (source-path sym extension))
+         ins-decl (list 'in-ns (list 'quote sym))
+         deps-decl (when (seq dependencies)
+                     (map #(list 'require `(quote ~%)) dependencies))]
+     (create-file full-path (filter identity (concat [ins-decl] deps-decl contents))))))
+
 (defn same-files?
   "True if files-a and files-b contain the same canonical File's,
   regardless of order."



View it on GitLab: https://salsa.debian.org/clojure-team/tools-namespace-clojure/-/commit/09ff177bca96878cb00a25bac3e203807ca5dc87

-- 
View it on GitLab: https://salsa.debian.org/clojure-team/tools-namespace-clojure/-/commit/09ff177bca96878cb00a25bac3e203807ca5dc87
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20260718/f8133cb8/attachment.htm>


More information about the pkg-java-commits mailing list