Uploaded image for project: 'tools.namespace'
  1. TNS-42

scan-dirs / scan-all can return incorrect dependencies when both clj and cljc files define same namespace

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:

      tools.namespace 0.2.11 and 0.3.0-alpha2

      Description

      Originally filed as an issue for function scan-all, which at the time I was unaware was deprecated in 0.3.0 alphas. I have tested against the newer scan-dirs as well, and it has the same problem.

      When there are both .clj and .cljc files defining the same namespace, tools.namespace scan-dirs and scan-all can use the dependencies from the .cljc file, ignoring those in the .clj file, whereas for Clojure/Java the opposite should be done.

      See sample project and its README here for steps to reproduce: https://github.com/jafingerhut/tnstest

      Note that Clojure/Java's behavior is to prefer .clj file over a .cljc file defining the same namespace, even if the .clj file is in a directory that is later in the classpath than a .cljc file. According to Alex Miller email on clojure-dev Google group, this behavior is by design. Link: https://groups.google.com/d/msg/clojure-dev/d5Hb1E7zfHE/sPybIAxgCwAJ

        Attachments

          Activity

            People

            • Assignee:
              stuart.sierra Stuart Sierra
              Reporter:
              jafingerhut Andy Fingerhut
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: