Skip to content

Commit

Permalink
Fix: resolve our Clojure source dependencies first in the classpath (#…
Browse files Browse the repository at this point in the history
…17919)

In PR #17867 we have a namespace
named schema.core, but this namespace is taken by library prismatic/schema
already (see https://github.com/plumatic/schema/tree/master/src/cljc/schema), a
library used by our direct dependency on bidi 2.1.6. This leads to a broken
build where the ClojureScript compiler reports undeclared vars
(https://clojurescript.org/reference/compiler-options#warnings).

We change the order Java resolves dependencies via the classpath mechanism. We
now first resolve our own Clojure sources, and then project dependencies.
  • Loading branch information
ilmotta authored and yevh-berdnyk committed Dec 8, 2023
1 parent 67e3a78 commit 18d96f7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nix/mobile/jsbundle/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ stdenv.mkDerivation {
'';
buildPhase = ''
# Assemble CLASSPATH from available clojure dependencies.
# We append 'src' so it can find the local sources.
export CLASS_PATH="$(find ${deps.clojure} \
-iname '*.jar' | tr '\n' ':')src"
# We prepend 'src' so it can find the local sources and prioritize
# our own namespaces over dependencies, given that indirect dependencies
# can also cause naming conflicts (e.g. prismatic/schema already uses
# namespace schema.core).
export CLASS_PATH="src:$(find ${deps.clojure} \
-iname '*.jar' | tr '\n' ':')"
# target must be one of the builds defined in shadow-cljs.edn
java -cp "$CLASS_PATH" clojure.main \
Expand Down

0 comments on commit 18d96f7

Please sign in to comment.