Fork me on GitHub
#polylith
<
2024-02-09
>
jasonjckn10:02:28

@imre does this ring any bells for you? trying to build a jar, polylith + kaocha all together.

⚡ clojure -T:build uberjar
Execution error (ExceptionInfo) at clojure.tools.deps.extensions.local/eval1435$fn (local.clj:107).
No known ancestor relationship between local versions for polylith-kaocha.components/util: /Users/j/.gitlibs/libs/polylith-kaocha/kaocha-wrapper/8

jasonjckn10:02:43

deps

{:deps {

        polyfy/polylith {:git/url   ""
                         :git/sha   "e8feb79"
                         :git/tag   "v0.2.18"
                         :deps/root "projects/poly"}

        polylith-kaocha/test-runner {:git/url   ""
                                     :git/tag   "v0.8.3"
                                     :git/sha   "87b74a4"
                                     :deps/root "projects/test-runner"}

        polylith-kaocha/kaocha-wrapper {:git/url   ""
                                        :git/tag   "v0.8.3"
                                        :git/sha   "87b74a4"
                                        :deps/root "projects/kaocha-wrapper"}
        }

 :aliases {:run   {:main-opts ["-m" "polylith.clj.core.poly-cli.core"]}
           :build {:extra-deps {io.github.clojure/tools.build {:mvn/version "0.9.6"}} 
                   :ns-default build}}}

jasonjckn10:02:08

build.clj

(ns build
  "To compile & package the Polylith CLI, run:

     $ clojure -T:build uberjar

  To execute the newly built artifact

     $ java -jar target/standalone.jar <Polylith CLI args>
  "
  (:require [clojure.tools.build.api :as b]))

(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))

(defn uberjar [_]
  (b/delete {:path "target"})
  (b/compile-clj {:basis        basis
                  :src-dirs     ["src"]
                  :compile-opts {:direct-linking true}
                  :ns-compile   '[polylith.main]
                  :class-dir    class-dir})
  (b/uber {:class-dir class-dir
           :uber-file "target/standalone.jar"
           :basis     basis
           :main      'polylith.main}))

imre10:02:35

That deps setup looks unusual

imre10:02:48

pk/test-runner is supposed to go into a :poly alias

imre10:02:09

and pk/kaocha-wrapper is supposed to go into individual projects' test aliases

imre10:02:58

I'm also finding it strange to try and build an uberjar out of these test runner helper things which pk is

👍 1
imre10:02:46

if you really need to build it then build 2 jars - one with poly and pk/test-runner

👍 1
imre10:02:54

and one with pk/kaocha-wrapper

👍 1
imre10:02:00

(the latter doesn't have any deps on poly itself, only kaocha)

imre10:02:15

(and the former does the reverse, it's only dependent on poly, but not kaocha)

👍 1