Fork me on GitHub
#boot
<
2017-12-06
>
danielcompton02:12:33

I'm writing a blog post on updating to Java 9, does anyone have any feedback on it? Things I missed? https://deploy-preview-11--deps.netlify.com/blog/upgrading-clojure-projects-to-use-java-9/

danielcompton02:12:33

I'm writing a blog post on updating to Java 9, does anyone have any feedback on it? Things I missed? https://deploy-preview-11--deps.netlify.com/blog/upgrading-clojure-projects-to-use-java-9/

alexmiller04:12:15

@danielcompton that link doesn’t work for me

danielcompton06:12:09

ah I updated the (not so) permalink, my bad

danielcompton06:12:57

Just published cause I'm about to go to bed, but feedback still welcome https://www.deps.co/blog/how-to-upgrade-your-clojure-projects-to-use-java-9/

fmind08:12:10

Hello, I have a question on how boot use Java classpath. I want to develop a web app that combines danielsz/system and weavejester/environ

fmind08:12:48

;; dev/.boot-env
{:http-port "3000"}

;; project/systems.clj
(defsystem webserver
  [:web (new-web-server (env :http-port))])

;; build.boot
(merge-env! {:resource-paths #{"res"}})

(deftask with-dev "" []
  (merge-env! :resource-paths #{"dev/res"})
  identity)

(deftask run "" []
  (comp (with-dev) (comment start system)))

;; => error .boot-env not in classpath

fmind08:12:00

I create a component system from environment variables via environ

fmind08:12:27

In development mode, I store these variables in dev/res/.boot-env. I want to include this file in the classpath during development only.

fmind08:12:12

thus, I created two boot tasks: with-dev to include dev/res in the resource paths and run to execute the system (a web server)

fmind08:12:52

It works when I put .boot-env in res (the common resource paths), but not when the file is in dev/res

fmind08:12:18

my understanding is that the classpath is loaded once build.boot is read, and that it cannot be changed by other tasks

dominicm09:12:47

@fmind boot's classpath can be changed dynamically. It can be changed by other tasks.

fmind10:12:22

so do you know why I have this issue ?

fmind10:12:43

should I change something else than resource-paths ?

fmind10:12:17

the thing is: it works when I put the file in the top level merge-env!, but not the task level merge-env!

dominicm12:12:23

@fmind tasks need to return a function, You probably want to use with-pass-thru

dominicm12:12:08

(deftask x
  …
  (with-pass-thru _
    (merge-env! …)))

fmind13:12:02

@dominicm I forgot the line in my copy paste, this is what I have:

fmind13:12:47

(deftask with-dev "" []
  (merge-env! :resource-paths #{"dev/res"})
  identity))

dominicm13:12:49

@fmind that looks correct. Why do you think it's not working?

dominicm13:12:03

Try doing boot with-dev repl and then do ( ".boot.env")

fmind13:12:19

I tried, and it gives me nil

dominicm13:12:32

@fmind is this open source? Can you share so I can try myself? Otherwise I will create a repo showing how I think this should work.

fmind13:12:47

@dominicm well ... I tried to create a single repo to demonstrate the issue, and it works

fmind13:12:05

i may have some strange interaction in my boot process

fmind13:12:23

I'll have a look when I'm home. Thanks for the help.

dominicm13:12:29

No problem.

seancorfield21:12:35

[boot-tools-deps "0.1.4"] released: depends on latest tools.deps.alpha and system defaults from brew-install; fixes how -r and -c options work (in light of discussion above about -Srepro); adds a -A option as a synonym for -R and -C both specifying the same alias for resolving and classpath updates.

martinklepsch22:12:57

@seancorfield hey! From your experience working with tools.deps — how hard would it be to say “here’s a deps.edn; go make me a pod with it”? I assume that should be relatively straightforward?

seancorfield22:12:10

@martinklepsch Should be straightforward. Probably something I could refactor the code in boot-tools-deps to expose easily...?

seancorfield22:12:37

If I refactored the main load-deps function out to return the three things it does here https://github.com/seancorfield/boot-tools-deps/blob/master/src/boot_tools_deps/core.clj#L81-L94 then you could just call that function from code that wanted to set up a pod I think?

seancorfield22:12:00

Can you open an issue with what you'd like to see there?

richiardiandrea22:12:16

@martinklepsch that's a nice nice idea...especially if the files comes from the fileset and therefore can be rewritten

richiardiandrea22:12:32

in particular for pods in dependencies...`boot-cljs` could have a deps.edn that it marks with metadata :adzerk.boot-cljs and that it reads deps from. If other tasks want add stuff to the pod classpath they can rewrite the file

richiardiandrea22:12:42

(brainstorming here)