taylorwood / clj.native-image

Build GraalVM native images with Clojure Deps and CLI tools
MIT License
271 stars 20 forks source link

Extra compilation? #19

Open sogaiu opened 4 years ago

sogaiu commented 4 years ago

Don't know if it's really a problem, but it appears one can end up with redundant compilations invoking build.

main-ns in build is typically a string IIUC. namespaces appears to have symbols in it and may end up including the namespace that main-ns refers to.

Thus, (cons main-ns namespaces) can end up with a string version of main-ns as well as a symbol version:

    (let [deps-map (merged-deps)
          namespaces (mapcat (comp find-namespaces-in-dir io/file) (:paths deps-map))]
      (prep-compile-path)
      (doseq [ns (distinct (cons main-ns namespaces))]
        (println "Compiling" ns)
        (compile (symbol ns)))

I have seen "Compiling script" appear twice -- once for the string "script" and once for the symbol script.

I guess one could do (cons (symbol main-ns) namespaces) since there is a wrapping distinct. Not sure if namespaces will always contain a symbol version of main-ns.