Fork me on GitHub
#tools-build
<
2022-11-11
>
Apple17:11:33

I have a question. Why compile fails when the copy part is skipped?

(b/copy-dir {:src-dirs ["src/clj" "src/cljc" "env/prod/clj"]
               :target-dir class-dir})
  (b/compile-clj {:basis basis
                  :src-dirs ["src/clj" "src/cljc" "env/prod/clj"]
                  :class-dir class-dir})

Alex Miller (Clojure team)18:11:17

is there kit/net/env.clj in the class-dir ?

Alex Miller (Clojure team)18:11:15

I guess that shouldn't matter given the :src-dirs in compile-clj

Alex Miller (Clojure team)18:11:59

re "Clojure compilation failed, working dir preserved: /tmp/compile-clj2911297849938394779" - that directory is a temp dir that contains the results of the failed compile

Alex Miller (Clojure team)18:11:08

you can inspect the compile.args and compile.clj files in that directory

Alex Miller (Clojure team)18:11:54

it's basically running (in that directory) java with the args in compile.args, which should execute the compile.clj file (which shows what's being compiled)

Apple20:11:12

compile.args reveals the problem: "env/prod/clj" has to go into deps.edn top level :paths not the build alias level :paths

Apple01:11:09

Great. This is it. Tyvm! deps.edn

:aliases {:prod     {:extra-paths ["env/prod/clj"]}}
build.clj
(def basis      (b/create-basis {:project "deps.edn", :aliases [:prod]}))

ghadi17:11:47

fail how? (stacktrace)

Apple17:11:51

{:clojure.main/message
 "Execution error (ExceptionInfo) at clojure.tools.build.tasks.compile-clj/compile-clj (compile_clj.clj:112).\nClojure compilation failed, working dir preserved: /tmp/compile-clj2911297849938394779\n",
 :clojure.main/triage
 {:clojure.error/class clojure.lang.ExceptionInfo,
  :clojure.error/line 112,
  :clojure.error/cause
  "Clojure compilation failed, working dir preserved: /tmp/compile-clj2911297849938394779",
  :clojure.error/symbol
  clojure.tools.build.tasks.compile-clj/compile-clj,
  :clojure.error/source "compile_clj.clj",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.ExceptionInfo,
    :message
    "Clojure compilation failed, working dir preserved: /tmp/compile-clj2911297849938394779",
    :data {},
    :at
    [clojure.tools.build.tasks.compile_clj$compile_clj
     invokeStatic
     "compile_clj.clj"
     112]}],
  :trace
  [[clojure.tools.build.tasks.compile_clj$compile_clj
    invokeStatic
    "compile_clj.clj"
    112]
   [clojure.tools.build.tasks.compile_clj$compile_clj
    invoke
    "compile_clj.clj"
    80]
   [clojure.lang.Var invoke "Var.java" 384]
   [clojure.tools.build.api$compile_clj invokeStatic "api.clj" 312]
   [clojure.tools.build.api$compile_clj invoke "api.clj" 272]
   [build$main invokeStatic "build.clj" 73]
   [build$main invoke "build.clj" 68]
   [clojure.lang.AFn applyToHelper "AFn.java" 154]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$apply invoke "core.clj" 662]
   [clojure.run.exec$exec invokeStatic "exec.clj" 48]
   [clojure.run.exec$exec doInvoke "exec.clj" 39]
   [clojure.lang.RestFn invoke "RestFn.java" 423]
   [clojure.run.exec$_main$fn__205 invoke "exec.clj" 180]
   [clojure.run.exec$_main invokeStatic "exec.clj" 176]
   [clojure.run.exec$_main doInvoke "exec.clj" 139]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.main$main_opt invokeStatic "main.clj" 514]
   [clojure.main$main_opt invoke "main.clj" 510]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause
  "Clojure compilation failed, working dir preserved: /tmp/compile-clj2911297849938394779",
  :data {}}}

Apple17:11:44

Cleaning target
Preparing main jar...
Execution error (FileNotFoundException) at kit.net.web.middleware.core/loading (core.clj:1).
Could not locate kit/net/env__init.class, kit/net/env.clj or kit/net/env.cljc on classpath.

Apple17:11:07

$ find env/prod/
env/prod/
env/prod/resources
env/prod/resources/logback.xml
env/prod/clj
env/prod/clj/kit
env/prod/clj/kit/net
env/prod/clj/kit/net/env.clj

seancorfield18:11:40

Threads, please. Don't post walls of text into the channels.

1