This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-07
Channels
- # admin-announcements (2)
- # boot (111)
- # capetown (5)
- # cider (15)
- # clara (15)
- # cljs-dev (8)
- # clojure (78)
- # clojure-brasil (1)
- # clojure-dev (2)
- # clojure-greece (25)
- # clojure-hk (1)
- # clojure-russia (5)
- # clojure-seattle (1)
- # clojure-spec (120)
- # clojure-sweden (3)
- # clojure-uk (63)
- # clojurescript (161)
- # data-science (1)
- # datomic (21)
- # editors (43)
- # emacs (3)
- # funcool (1)
- # hoplon (72)
- # instaparse (11)
- # jobs (1)
- # off-topic (2)
- # om (212)
- # onyx (9)
- # other-languages (129)
- # proton (5)
- # re-frame (15)
- # reagent (18)
- # slack-help (4)
- # spacemacs (18)
- # untangled (224)
- # yada (21)
@nha this is the best I could come up with:
(deftask public []
(comp (production)
(build)
(sift :invert true :include #{#"js/app.out" #"js/app.cljs.edn"})
(target :dir #{"public"})))
I couldn't find a way to explicitly choose everything from a resources/public
that worked for deployment, dev serving and compiling (I could get them all working individually, but not together)... at least the above avoids deploying all the intermediary cljs output. I would love to know if you find a way to isolate the deployable assets from the rest of the resources, because using an explicit list is tedious.@timothypratley: Thanks ! I will have a look tomorrow and let you know š
Is there a straightforward way to run a boot process, inside another boot process, with a completely different environment, without damaging/altering the parent environment? The use case is for building sub-projects of my main project, that live in their own directories with their own build.boot
files, etc.
The best solution I have right now is shelling out a full subprocess, which works, but that seems a bit wasteful.
@luke I would look into boot.pot
for classpath isolation, band even more in boot parallel
for running completely separate boot envs for your tasks (if you have any question about the latter, feel free to ping me)
hello! i'm trying to run an immutant webserver with boot and configured a task that simply starts a hello world page. problem is boot keeps killing the app and when I include (boot (wait)) it just son't start at all. any pointers ?!
@avabinary: you you launch this from a REPL what do your boot
invocations look like?
hi @martinklepsch, my task is this
(deftask run [a args ARG [str] "the arguments for the application."] (require '[myapp.core :as myapp]) (with-pass-thru _ (resolve 'myapp/-main)))
(defn -main [& args] (.addShutdownHook (Runtime/getRuntime) (Thread. #(do (immutant/stop @http-server) (shutdown-agents)))) (reset! http-server (immutant/run app :host "0.0.0.0" :port 8080)) (timbre/info "server started on port:" (:port @http-server)) )
consider using triple backticks for code `
and how do you start this?
so you type boot run
into a terminal and hit enter?
have you tried boot run wait
?
and boot run
exits right? do any of these two print the timbre log message?
nope to which question @avabinary? š
oh, sorry. i meant none of them print any timbre logs,
boot run
just exits and boot run wait
hangsduh, (resolve 'x/y)
does not call the function y
š
try ((resolve 'myapp/-main))
@richiardiandrea using pods does seem like the way to go, but what I canāt find out is how to initialize the pod with an āinnerā instance of boot reading from itās own build.boot
and a different working directory.
@luke: pods aren't really made for having their own boot pipeline. If you want to run tasks you need boot parallel I think
@luke: maybe it helps if you outline the kind of use-case you have in mind etc
does anyone know where to get an example of a development and production profile for boot ? in the boot-clj wiki it's mainly about system environments
@avabinary: if you run lein new tenzing
it will have basic dev/prod profiles. The wiki also has this https://github.com/boot-clj/boot/wiki/Boot-for-Leiningen-Users
ok, I'll have a look, thanks @martinklepsch
well, yeah š
@martinklepsch: Basically I want to build some other projects at arbitrary locations, but without starting a whole new JVM.
parallel/runboot looks like exactly what I want except it doesnāt seem to offer a way to redefine the ācurrentā directory.
yeah, then you need multiple pipelines which is what boot parallel
enables
@luke https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/parallel.clj#L51-L63
@luke: by passing args
you can set different source/resource dirs but this doesn't tie in nicely with having existing build.boot files..
yeah, kind of want to be able to run either standalone or driven from a parent boot process
@luke: maybe you could circumvent this issue by having an edn file in each project that you read upfront to determine args
shelling out and creating a whole subprocess actually does exactly what I want, just tends to add some overhead
In any case I'm not very familiar with this so we should probably wait for @richiardiandrea to shed some light on this š
Yeah Martin is right, boot in boot still ties you to the original jvm, but that can be your parent process. What it does not do at the moment is to read a completely new env from somewhere...this is basically a small patch to add but probably does not allow it to work for your use case
How about passing an env-map option for the runboot task that will be handed to set-env! ? This way you can read that kind of stuff from a edn file in the individual projects
The build.boot files on those projects should then also read this information from the edn file
I reckon it is the simplest way ^ too bad we don't have a boot only solution though
I mean a clean one
I wanted to have customizable envs for boot.parallel , maybe combined with the env dynamic var
Just need time to do it š
I find this approach pretty clean actually, it's a pretty special scenario and requires some extra work but given the requirements it seems almost appropriate
Hey is there a flag for clearing a project cache folder?
I just wiped the .boot/cache/
folder but I was wondering if there is a flag i didnāt see?
there's no flag afaik and very rarely you should need to do this (except you want to free up space)
[ANN] boot-expectations 1.0.10 is available. Adds expecting
task to make it easier to work with your Expectations tests in a REPL: https://clojars.org/seancorfield/boot-expectations
So this is an interesting thing, I have two pod, one with backend deps and one with frontend compiling cljs
now I have a file that I want to share, this file is a cljc
I have a #?(:clj (:require [clj-time.core :as t]))
reaquire
that I want to be visible only in the backend
unfortunately, there is no way to tell the cljs compiler that this is not a "cljs macro" and throw an error because clj-time
is not on the path
it can never happen with lein
, there is no classpath isolation, but in boot
, with pods, it can
If this only ends up in the clj file why would the compiler think it's a cljs macro?
If it's not required in the cljs file it shouldn't matter no?
In general can you reference namespaces in irrelevant reader conditional branches that are not on the classpath? @richiardiandrea
my understanding is that every #?(:clj ...)
is treated as macro in cljs
but in my cljs pod I don't have the dep
so it is required I guess
adzerk.boot-cljs.impl/reload-macros!/invokeStatic impl.clj: 108
adzerk.boot-cljs.impl/reload-macros! impl.clj: 100
...
clojure.core/apply/invokeStatic core.clj: 646
clojure.core/apply core.clj: 641
boot.pod/eval-fn-call pod.clj: 328
boot.pod/call-in* pod.clj: 379
...
boot.pod/call-in* pod.clj: 382
adzerk.boot-cljs/compile/invokeStatic boot_cljs.clj: 66
adzerk.boot-cljs/compile boot_cljs.clj: 59
adzerk.boot-cljs/compile-1/fn boot_cljs.clj: 126
clojure.core/binding-conveyor-fn/fn core.clj: 1938
the above ends up causing the require (and the error)
Hmm, yeah, boot-cljs will require (reload) any clj/cljc "macro" namespaces
But it should only do that for namespaces that are already loaded
are you using cljs macros at all? maybe some macro ns requires this ns
that namespace is required, because I need cljs stuff from it, but it does not contain any macro
that's not quite what I meant
kk maybe I did not understand then š
Reload-macros requires any namespaces in Clojure context that are already loaded in Clojure context
And that should only be caused by :require-macros
Doesn't really matter if the file defines any macros
If a Cljs namespace does require-macros, the macro namespace is loaded in Clojure context and all it's dependencies are loaded in Clojure context
ok now it is clear, but I think I never require it using require-macros
, nor some dependent is...but I am double checking
Could be something else, but I'm yet to hit problems with the reload-macros! logic
I'm in fact quite surprised how well the approach has worked seeing how simple it is
i can share the file...maybe it is better to create a smaller repro repo
it starts like this:
(ns my-ns.events
#?@(:clj ((:require [clj-time.core :as t])
(:refer-clojure :exclude [type]))
:cljs ((:refer-clojure :exclude [type]))))
@richiardiandrea: i don't think the reader conditionals are treated as macros in the cljs compiler, because they're expanded in the reader...the cljs compiler can't see them
true that I agree, this looks like a problem in the reloading part...but not sure, let me work on a repro repo first
well actually
:clj
clauses are used for declaring macros
in cljc
files no?
You could enable debug prints and I think this would provide information about which namespaces are loaded in Clojure side: https://github.com/adzerk-oss/boot-cljs/blob/master/src/adzerk/boot_cljs/impl.clj#L107
@juhoteperi I enabled -verbose
and I see:
Reload macro ns: booma.data-format
clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate cognitect/transit__init.class or cognitect/transit.clj on classpath., compiling:(booma/data_format.cljc:1:1)
java.io.FileNotFoundException: Could not locate cognitect/transit__init.class or cognitect/transit.clj on classpath.
this does not happen in a tenzing
project so I guess I have some difference from the standard config
it looks for a clj
file that cannot be there because I have transit-cljs
not transit-clj
on the classpath
this is a different cljc
from the above, so this happens for all the cljc
that require something as clj
(ns booma.data-format
(:require [cognitect.transit :as transit])
#?(:clj (:import [org.joda.time DateTime ReadableInstant])))