Fork me on GitHub
#boot
<
2017-04-27
>
alandipert00:04:50

def is cool if boot is the entrypoint for your app at runtime

alandipert00:04:29

the version.txt approach is cool if boot isn't around at runtime, for ie servlets or standalone jars

alandipert00:04:50

real ultimate power is generating a file based on a def and adding it to the fileset at build time bowtie

kenny00:04:48

@alandipert I don't see how boot's presence would affect my example 🙂 (probably because my example isn't clear on files). project-version is def'ed in core.clj so it'd be around at runtime.

colliderwriter00:04:01

someone's had an organized think about this and come up with this: https://github.com/degree9/boot-semver

macrobartfast00:04:24

is it possible to add dependencies to a project with boot ala 'npm install foo --save' ?

micha00:04:36

@macrobartfast that command modified package.json in the current project?

micha00:04:46

*modifies

macrobartfast00:04:56

it grabs it and also saves it to the current project

micha00:04:26

you could accomplish this with boot, and there may be tasks out there that do such a thing

macrobartfast00:04:00

I'm using lein, and currently tediously copy each dep out clojars and paste it into project.clj

macrobartfast00:04:06

super annoying

micha00:04:25

the usual way you add dependencies is like this, in your project build.boot file:

(set-env! :dependencies #(into % '[[foo/bar "1.0"] [baz "2.0"]]))

micha00:04:36

but since you're just programming in clojure in build.boot you could do this instead:

(set-env! :dependencies #(into % (read-string (slurp "package.edn"))))

micha00:04:11

then it would be straightforward to make a task that updates package.edn or whtaever

micha00:04:17

adding or removing dependencies

micha00:04:23

does that make sense?

macrobartfast00:04:32

it does, and thanks!

micha00:04:09

you could also add this task in your ~/.boot/profile.boot file

macrobartfast00:04:16

that's the lein approach

macrobartfast00:04:49

there's a tool called lein plz that goes into your global lein profile

macrobartfast00:04:54

which I haven't tried

micha01:04:14

yeah i think it would be a straightforward job to make such a task

micha01:04:37

probably i'd live with the set-env! boilerplate in the build.boot file

micha01:04:43

to keep things simple

micha01:04:55

i mean the second set-env! snippet above

macrobartfast01:04:05

I have all the ingredients now

micha01:04:25

awesome :+1:

seancorfield01:04:42

@micha Any reason to prefer set-env! with a function, over merge-env! with just the list of dependencies to add?

seancorfield01:04:29

(merge-env! :dependencies '[[foo/bar "1.0"] [baz "2.0"]])
(merge-env! :dependencies (read-string (slurp "package.edn")))

micha02:04:28

@seancorfield no, i can't think of any reason to prefer one or the other

alandipert04:04:06

@kenny i understand your example now - 👍

djebbz09:04:26

Hello everyone

djebbz09:04:19

I have a problem and don't know if it's related to boot, boot-cljs, scrum (the lib I've just introduced) or my code that introduced it. Since my last commit (which added the lib and integrated it), the boot-cljs task is stuck with no CPU Usage. I used -vvvv to be super verbose and I noticed it's stuck after printing the CLJS options.

djebbz09:04:38

Environment :

boot --version
#
#Thu Apr 27 11:44:20 CEST 2017
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_CLOJURE_VERSION=1.8.0
BOOT_VERSION=2.7.1
[adzerk/boot-cljs "1.7.228-2" :scope "test"] Java version :
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)
Linux up-to-date.

djebbz10:04:43

Ok by dichotomy I managed to isolate that it's from my code... I rerun the task with just the scrum dependency added, of course it works. I run the boot-cljs task individually with the whole code : stuck. I run another task that calls cljs.build.api/build manually, stuck too. My code seems to create a kind of infinite loop at compile time but I can't see where, I just introduced the scrum lib that doesn't contain macros ! Only deftypes, one defprotocol and defns... AAAARGH ! 😱

djebbz12:04:26

What can make Clojurescript compilation get stuck silentely ?

martinklepsch13:04:02

@djebbz the clojurescript compiler also has a verbose option

martinklepsch13:04:14

also consider trying the newer boot-cljs 2.0.0 or so

djebbz13:04:56

Did both with no luck... 😕

djebbz13:04:24

It seems scrum and boot-cljs aren't friends, since its maintainer uses lein and has no problem.

djebbz13:04:55

I still can't get how a lib without macros can screw up the compilation process...

martinklepsch13:04:37

@roman01la maybe you have any ideas?

martinklepsch13:04:41

@djebbz with the clojurescripts :verbose compiler option you should see a lot more output like which file is currently being compiled

martinklepsch13:04:47

@djebbz did you see that?

roman01la13:04:31

@martinklepsch no idea, the code in Scrum is very simple 🤔

roman01la13:04:16

@djebbz try to remove functions one by one from Scrum and see how it compiles, should help to locate the problem

roman01la13:04:22

@djebbz or even try to compile CLJS directly with CLJS compiler, without Boot

djebbz13:04:38

@roman01la I'm currently removing functions one by one. Compiling directly with CLJS compiler doesn't work too, same problem.

roman01la13:04:06

ok, let me know if you find the problem

martinklepsch13:04:30

@djebbz did you see the compiler’s verbose output as I described?

djebbz13:04:21

@martinklepsch Yep, it blocks after one specific file ("Compiling /path/to/file"). I compared with our dev branch which doesn't use scrum and it works normally. I detected 2 files adjacents to the specific file when compiling the dev branch in verbose mode, but one of them doesn't even have scrum code in it.

djebbz13:04:45

I'm currently trying to set up a minimal repo to helpfully reproduce the bug

martinklepsch13:04:04

That would be very helpful :+1:

djebbz13:04:27

I hope I manage to do it, I'm losing patience and hope... 😕

djebbz13:04:26

I'm using boot/new. Good idea ?

djebbz14:04:37

@martinklepsch I spawned a basic app project with boot/new. After adding clojurescript, boot-cljs, scrum and its dependencies, I issue boot cljs --help and get the following error : Classpath conflict: org.clojure/clojure version 1.7.0 already loaded, NOT loading version 1.8.0. I have no other instance of boot running (confirmed with ps -ef | grep -i boot). What's wrong ?

martinklepsch14:04:54

@djebbz you’re probably missing a boot.properties file. boot -V > boot.properties and then specify clojure 1.8 there and in your project dependencies

djebbz14:04:08

Oh, didn't know it was required.

martinklepsch14:04:35

it’s not requried. usually that conflict is not fatal so not sure what’s happening there

roman01la14:04:52

could it be caused by a dependency having [org.clojure/clojure "1.8.0" :scope "provided"] ?

martinklepsch14:04:27

well, if it would have scope provided, everything would be good but there’s no discipline in that regard in the clojure community 😛

martinklepsch14:04:02

Some library always depends on Clojure and brings in some other version if you don’t explicitly depend on Clojure yourself. So always do that.

djebbz14:04:23

I have. Rum says [org.clojure/clojure "1.7.0" :scope "provided"]

martinklepsch14:04:54

it is “recommended” though

djebbz14:04:18

No luck. Still the same classpath error after boot -V > boot.properties. When I set BOOT_CLOJURE_VERSION to 1.8.0 (like in my project) I get the same error/stack trace but without the message...

martinklepsch14:04:57

@djebbz add [org.clojure/clojure "1.8.0"] to your :dependecies

djebbz14:04:12

already there

djebbz14:04:33

My build.boot file :

(def project 'boot-scrum)
(def version "0.1.0-SNAPSHOT")

(set-env! :resource-paths #{"resources" "src"}
          :source-paths #{"test"}
          :dependencies '[ ;; Core
                          [org.clojure/clojure "1.8.0"]
                          [org.clojure/clojurescript "1.9.473"]

                          ;; 3rd party
                          [cljsjs/react-with-addons "15.4.2-0"]
                          [rum "0.10.8" :exclusions [cljsjs/react]]
                          [org.roman01la/scrum "2.0.0-SNAPSHOT" :exclusions [rum]]

                          ;; Boot
                          [adzerk/boot-cljs        "1.7.228-2" :scope "test"]
                          [adzerk/boot-test "RELEASE" :scope "test"]])

(deftask build
         "Build the project locally."
         []
         )

djebbz14:04:26

I didn't require cljs... HAHAHA

martinklepsch14:04:44

@djebbz if you now also have the BOOT_CLOJURE_VERSION set properly you should not get that version conflict issue

djebbz14:04:00

It was the cljs task not being required and just added to the dependencies. My bad. My first time writing build.boot file from (almost) scratch.

djebbz14:04:25

Continuing with bug reproduction. I hope I don't introduce other problems like this, just a waste of time

roman01la14:04:14

@djebbz so the bug is still present even when cljs task is enabled?

djebbz14:04:01

I don't know, I haven't written any scrum code yet in this repo

roman01la14:04:24

@djebbz I’ve just created a separate channel for Scrum related issues

djebbz14:04:59

Nice ! I will pollute that one 😅

djebbz16:04:20

@martinklepsch Just so you know, I managed to recreate a mini app with boot and scrum and everything works nice. Good news for boot and scrum, bad news for me... I still haven't found the problem of stuck compilation.

djebbz16:04:43

I'll keep you informed tomorrow if I find the solution (or at least understand the problem)

djebbz16:04:54

End of work day for me. Bye !

martinklepsch16:04:43

@djebbz I’d be curious in a gist of the :verbose output of the clojurescript compiler

anmonteiro18:04:06

@djebbz also interested to see the compiler options you’re using

anmonteiro18:04:16

I’d try disabling :parallel-build first if it’s enabled

currentoor18:04:25

Is it possible to change the :source-paths in a task?

currentoor18:04:53

I have one task that re-compiles both frontend and backend parts of my app. The problem is it’s kind of slow. I was thinking if I could split it into two tasks, so if I modify a cljs file only the frontend re-compile is triggered.

anmonteiro18:04:30

@currentoor sure, I do that all the time for testing for example

currentoor18:04:44

Thanks @anmonteiro

currentoor18:04:06

do you have any other suggestions for speeding up reload times in a large cljs app?

anmonteiro18:04:58

not with boot-cljs

currentoor18:04:03

what do you use?

anmonteiro18:04:23

you can turn off :recompile-dependents in the CLJS compiler options but that might lead to weird bugs

anmonteiro18:04:55

I mean that boot-cljs can be quite slow and doesn’t support the entire spectrum of options that Figwheel supports, for instance

anmonteiro18:04:13

I still use boot-cljs though

anmonteiro18:04:25

or should I say boot-reload

anmonteiro18:04:31

it’s the combination of both

currentoor18:04:09

yeah i already turn off :recompile-dependents

anmonteiro18:04:12

there’s also https://github.com/boot-clj/boot-figreload but I don’t know how mature it is

currentoor18:04:57

figwheel is the only thing I still miss from lein 😅

tord18:04:16

I'm playing with Elm for front-end work these days. The language by itself is pretty neat (I still prefer ClojureScript, but it's always fun to try something new), but the build and reload tooling leave a lot to be desired. I've never written a non-trivial Boot task before, so perhaps this is a stupid question: Would it be possible to write a Boot task that automatically compiles all .elm files in some sub-directory of the project whenever they change, and use boot-reload (or whatever) to have the generated JavaScript code automatically reloaded in the browser? If yes, is there any existing Boot task I can look at that does something remotely similar?

mobileink20:04:25

haven't used elm myself, tho it looks very interesting. but in general boot can do anything. how do you compile elm, normally?

donaldball20:04:50

I’d figure anything that transforms files matching a pattern would be good inspiration, maybe a .sass compiler?

mobileink20:04:11

lots of examples of input->transform->output at https://github.com/boot-clj/boot/wiki/Community-Tasks