Fork me on GitHub
#depstar
<
2021-08-23
>
kirill.salykin08:08:11

good morning! I am debugging weird error, help is much appreciated. Some clojure file which expected to be compiled is missing. -- The missing file is prod specific and it is located outside of the src directory. ./env/prod/storage.clj:

(ns some-project.storage
  “Storage implementation that uses Google Storage buckets”
  (:require [integrant.core :as ioc]
            [clj-gcp.storage.core :as gcp]
            [clojure.tools.logging :as log]
            [ :as io]))

;;
;; IoC
;;

(defmethod ioc/init-key ::store [_ {:keys [project-id bucket] :as opts}]
  (assoc opts :store (gcp/->gcs-storage-client project-id)))
There is also ./src/cls/storage/store.clj (which uses dev or prod implementation of the store). The content of the jar file built with depstar:
some-project/storage/
some-project/storage/store$fn__22403.class
some-project/storage/store__init.class
some-project/storage/store$fetch_file.class
some-project/storage/store$read_BANG_.class
some-project/storage/store$write_BANG_.class
some-project/storage/store$sanitize_path.class
some-project/storage/store$blob.class
some-project/storage/store$sanitize_key.class
some-project/storage/store$loading__6721__auto____21762.class
I would expect a file like some-project/storage$... to be in the list, but it is not there. Build command:
clojure -X:prod:uberjar
prod alias
:prod {:extra-paths [“env/prod/clj”]}
--- I’ve tried to copy ./env/prod/storage.clj into the src directory (preserving proper ns layout) - same result. Please advice how I can debug it? --- UPD: problem found, the ns were never required.

seancorfield17:08:58

@kirill.salykin depstar is a tool and the classpath used to execute a tool is different to whatever the tool builds in order to do its thing. Running :uberjar with :prod has no effect. That's explained in the docs -- use :aliases to pass extra aliases to depstar to control the classpath you want it to use when building the JAR, and there's also :compile-aliases if you need a different classpath for compilation (compared to building the JAR file).

kirill.salykin19:08:08

thanks, but i think it is because of missing require 🙂