Fork me on GitHub
#boot
<
2017-10-13
>
qqq03:10:17

is there a way to configure boot so that /src/my/util.clj gets also requird :refer-all in all *.clj files ? (except /src/my/util.clj , of course)

alandipert03:10:02

qqq yes, a boot_shim.clj file colocated with build.boot gets run in every pod after clj is loaded. you can use it to refer your own stuff, patch clj functions, various other ill-advised but awesome things

alandipert03:10:37

not good to use in a library or if boot isn't your app entrypoint tho

alandipert03:10:59

actually now i can't remember if you can use just that, or if you need to use it to patch a clj function to do the refer for you. either way, you're on your own now :-)

qqq08:10:21

@qqq: quoting that link:

This file will be evaluated via clojure.core/load-file in each Clojure runtime that's created (all pods, including the main one in which the build.boot runs). Clojure core will be available but no boot-related code will have been loaded or run yet.
My question: is a clojure-pod created for each namespace? I'm looking to inject a set of functions into EVERY NAMESPACE, not the original boot build envirnoment. Perhaps I am misunderstanding something -- and you can point out what I'm misunderstanding.

dominicm10:10:32

@cddr worth noting that this isn't perfect: tools.deps wants to generate the resulting classpath on your behalf in order provide additional ordering features.

dave13:10:43

@qqq: perhaps you could, in your boot-shim.clj, add the functions you want available to clojure.core? I think that would make them available in every namespace

dominicm13:10:20

I think the answer is no, but, is there a way to do subprojects in boot, with their own dependencies & such? I'd like to have a directory that will be open sourced some day(tm), but I'd like to manage it independently. Working on a team, and nobody is going to run a separate jvm to manage my dependency though.

psdp13:10:15

Hi, I am having an issue trying to compile CLJS with optimizations for Electron. Much appreciated if anyone can help 🙇

(set-env!
 :source-paths   #{"src"}
 :resource-paths #{"resources"}
 :dependencies '[[org.clojure/clojurescript     "1.9.854"]
                 [reagent                       "0.6.1"]
                 [org.clojure/tools.nrepl       "0.2.12"   :scope "test"]
                 [com.cemerick/piggieback       "0.2.1"    :scope "test"]
                 [weasel                        "0.7.0"    :scope "test"]
                 [adzerk/boot-cljs              "2.1.4"    :scope "test"]
                 [adzerk/boot-cljs-repl         "0.3.3"    :scope "test"]
                 [adzerk/boot-reload            "0.5.2"    :scope "test"]])

(require
  '[adzerk.boot-cljs              :refer [cljs]]
  '[adzerk.boot-cljs-repl         :refer [cljs-repl start-repl]]
  '[adzerk.boot-reload            :refer [reload]])

(deftask prod-build []
  (comp (cljs :ids #{"main"}
              :optimizations :simple)
        (cljs :ids #{"ui"}
              :optimizations :simple)
        (target :dir #{"dist"})))
Errors output in console:
ui.js:2186 Error rendering component (in reagent1)
reagent.impl.component.do_render @ ui.js:2186
ui.js:2300 Uncaught TypeError: Cannot read property 'call' of undefined
    at Object.ui.core.root_component [as reagentRender] (ui.js:2300)
    at ui.js:2183
    at reagent.impl.component.wrap_render (ui.js:2184)
    at reagent.impl.component.do_render (ui.js:2186)
    at ui.js:2188
    at reagent.ratom.in_context (ui.js:2095)
    at reagent.ratom.deref_capture (ui.js:2096)
    at reagent.ratom.run_in_reaction (ui.js:2168)
    at Object.render (ui.js:2188)
    at p._renderValidatedComponentWithoutOwnerOrContext (ui.js:37)
/usr/lib/electron/resources/electron.asar/renderer/init.js:131 Uncaught TypeError: global.process.listeners is not a function
    at window.onerror (/usr/lib/electron/resources/electron.asar/renderer/init.js:131:24)
    

cjsauer15:10:52

@alandipert currently trying to use env in my project. It's working great, except what is the most straightforward way to actually set env vars in a project at dev time? I'm coming from environ and leiningen, so I've normally been using the lein-environ plugin for setting those. Is there a similar adzerk.env boot task that can load it from say, profile.boot?

dave15:10:39

@cjsauer: this isn't documented in the README, but maybe this init task will do what you want? https://github.com/adzerk-oss/env/blob/master/src/adzerk/boot_env.clj

dave15:10:32

it loads a properties file and uses adzerk.env/setenv to set the properties in the file

dave15:10:05

i think there is not really a cross-platform way to set an environment variable in java, but setenv sets java "system properties," and the properties and environment variables are all lumped together and work in the same way with env

cjsauer15:10:07

@dave that works great! Just tested it. Appreciate the tip.

alandipert15:10:34

env looks at both env vars and jvm system properties, which are jvm-global

alandipert15:10:50

so yuo can also (System/setProperty "FOO" "bar") at a repl and env will pick it up

Mudge23:10:46

How can I change the font colors of the boot repl?