This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-04
Channels
- # arachne (108)
- # beginners (16)
- # boot (48)
- # cider (34)
- # cljs-dev (12)
- # clojure (237)
- # clojure-spec (50)
- # clojure-uk (5)
- # clojurescript (8)
- # cursive (1)
- # datascript (2)
- # datomic (6)
- # defnpodcast (1)
- # emacs (1)
- # fulcro (7)
- # hoplon (1)
- # keyboards (1)
- # off-topic (22)
- # re-frame (26)
- # reagent (2)
- # specter (16)
- # unrepl (6)
- # yada (1)
I’m building an electron app with hoplon/boot. Works great. But it would be nice to have source maps so I don’t have to work my poor tiny brain so hard to figure out where my exceptions are coming from. Currently, my .js.map
files have source paths in them like "mission.html.out\/weathergen\/ui.cljs"
. Probably because of something to do with the fairly complicated setup involved in getting an Electron app working, this is incorrect. It should instead be simply "ui.cljs"
. It’s easy enough to write a task to rewrite these guys, but it’s not working. I think I’m doing something wrong with the Boot fileset stuff, where the modified file is not getting added to the output. I.e. when I look at the resulting .js.map
files in the target
directory, they still have the incorrect path, even though debug output in my task shows me that they should be getting rewritten correctly. I imagine I’m making some rookie mistake with tasks/filesets. Any idea what it might be?
OK, was missing a with-open
on the writer, but that didn’t fix the problem. I can see that the temp output directory contains the correct file. It just doesn’t wind up making its way into the target folder.
I have a CLJ program that contains a server and a client in the same repository (they share a bit of code).
I currently make an uberjar with the server code but now I would like to make a java .jar
as well with the client.
I am not sure how I should approach this with boot
(or any other tool actually)?
(I don’t want to include everything in the driver - also the next step is to make a thin java wrapper around it and I will probably use the boot javac
task as well)
You can have multiple folders, like client
, server
, and common
and conditionally include subsets of those on the path when compiling.
I’ve used submodules at times to manage things like this, too, although that’s slightly more involved.
I don’t know how you’d manage multiple independent artifacts in a single boot.build
, but I’m guessing you could just modify your paths and dependencies inside a task definition. If not, it’s not unreasonable IMO to have multiple projects in a single repo. It’s not done much in the Clojure world - for some reason we have this one repo = one project = one artifact mindset - so you might run into issues where tools make assumptions about the equivalence. But in general it should work.
sift seems like a sort of odd way to do what you want, although I guess it should work. Again, not that I’ve done this, but I would be trying to do something like setting the environment as part of one of my build.boot tasks. Something like this:
No idea if it will work, either: have never tried to alter the environment inside a task.
Got my task working. No idea why it wasn’t working before; just kept making it look more and more like the example task until it started doing what I want it to.
The thing that bugs me about that approach is that you have side-effects in your task. Which is going to make them hard to compose.
I was looking for something like with-env
in Boot, but it doesn’t seem to exist. Easy to build out of set-env!
and get-env
, though.
Or maybe Boot just really isn’t meant to create two artifacts from a single boot.build
and you should have two.
I think it is possible to use a pod with it’s own env so I am no too worried by that. Also this is not so much a dev task (I want those to compose) as much as a task called once per build you want to release so even if it doesn’t it would be fine.
The thing is that at the moment I have “src/clj” “src/cljs” “src/cljc” folders, and that seems to complicate the task
The correct one will get loaded: clj then cljc if Clojure, cljs then cljc if ClojureScript.
..it seems I end up without .clj
files at the moment in my jar, but the “resources/” folder content is there
There’s a confusing thing about the terminology on “source paths” vs “resource paths”. One of them winds up in the JAR, one doesn’t, and I can never keep it straight. That may be what’s happening to you.
right - :resource-paths #{}
and my jar is empty again. I need to include the sources now somehow - and make them accessible from java
If you want to call your Clojure code from Java your options are AOT (shudder) and using the Clojure API.
Of course if you go the Clojure API route you’re going to wind up with an API that won’t look familiar to most Java programmers.
Yes I saw this http://michaelrkytch.github.io/programming/clojure/interop/2015/05/26/clj-interop-require.html using the Clojure API - hence why I was planning to make a thin Java wrapper around the clojure code
Yeah, I think that’s a good option. You might even be able to generate it with Clojure. 🙂
Hi. I would like to create a Java Web Application using boot. Either an all-included mywebapp.war
which I can drop into Tomcat8. Or an all-included mywebapp.jar
which I can start with java -jar mywebapp.jar
. Can anyone point me to a tutorial? Thank you!
hm it seems I end up with .class
files in the .jar
if I use the aot
task, nothing but meta stuff otherwise