Fork me on GitHub
#boot
<
2017-08-28
>
hswick02:08:42

Hi! I’m having trouble importing a class in .java file. I have source-paths set to #{“src/java”}, and when I run boot javac it shows that it compiles 1 java source file. But when I try to import it doesnt seem to be on the classpath

hswick02:08:39

Nevermind found the solution by running javac before repl, like boot javac repl

alandipert14:08:30

hswick this might interest you, experimental "live java reload" task https://github.com/RadicalZephyr/boot-javac-star

pleasetrythisathome18:08:31

hey all! I’m working on a cljs chrome extension and it prevent inline script eval. Thus i need to create a files that replicate the currently inline document.write’s output by the file produced by cljs.edn files in boot-cljs

pleasetrythisathome18:08:37

current problem is that there’s a nonce appended to the require for the main ns goog.require(“boot.cljs.main33328”)

pleasetrythisathome19:08:03

or similar. is there a way to either prevent this nonce? or to get the name of the ns in a task the post-wraps cljs?

juhoteperi19:08:49

@pleasetrythisathome Latter is possible by searching for the file in fileset, (by-re [#"^boot\/cljs\/main.*"]) or something, and looking at the found file names.

pleasetrythisathome19:08:28

the following is giving me a weird downstream error `

pleasetrythisathome19:08:04

the following is giving me a weird downstream error about not being able to convert map

No implementation of method: :as-file of protocol: #' found for class: clojure.lang.MapEntry
(with-post-wrap fileset
    (let [cljs-file (some->> fileset
                             (by-re [#"^boot\/cljs\/main.*"])
                             first
                             .getPath)]
      (util/info (str "*********" cljs-file))
      fileset))

juhoteperi19:08:29

you need to call output-files before by-re, the filtering fn works on list of tmp-files, which is different than fileset object

juhoteperi19:08:49

and tmp-path instead of .getPath, because these are tmp-files, not File

Garrett Hopper19:08:52

Should boot-cljs produce an output that will call the init-fns function?

pleasetrythisathome19:08:25

yea it create a new namespace with the init fns that is then required

Garrett Hopper19:08:10

Hmm, I think my main.cljs.edn file isn't being used then. I'm trying a different name now.

Garrett Hopper19:08:04

Yeah, that works now. Hmm

Garrett Hopper19:08:30

@pleasetrythisathome Is main.cljs.edn not used when not specifying :ids?

Garrett Hopper19:08:11

Alright, thanks :thumbsup:

Garrett Hopper19:08:20

It appears to now. I'm not sure what I did wrong to being with.

pleasetrythisathome20:08:01

awesome got it to work

pleasetrythisathome20:08:29

so i’m not seeing the files output in target…see anythign wrong? i’m using the target task

pleasetrythisathome20:08:34

(defn goog-require
  [ns]
  (format "goog.require(\"%s\");" ns))

(deftask chrome-extension
  [d devtools? bool "require devtools and dirac?"]
  (with-post-wrap fileset
    (let [tmp (tmp-dir!)
          cljs-files (some->> fileset
                              (output-files)
                              (by-re [#"boot\/cljs\/main\d*.js$"])
                              (map tmp-path))]
      (doseq [file cljs-files]
        (let [[_ build nonce] (re-find #"js\/(.*)\.out\/boot\/cljs\/main(\d*).js" file)
              out-path (format "js/require-%s.js" build)
              out-file (io/file tmp out-path)
              out (doto out-file
                    io/make-parents)
              requires [(when devtools?
                          "devtools.preload")
                        (when devtools?
                          "dirac.runtime.preload")
                        (format "boot.cljs.main%s.js" nonce)]]
          (util/info (format "writing %s.cljs requires to %s\n" build out-path))
          (->> requires
               (remove nil?)
               (map goog-require)
               (interpose "\n")
               (apply str)
               (spit out))))
      (-> fileset
          (add-resource tmp)
          commit!))))