Clojurians
#boot
<
2016-02-09
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

cjmurphy00:02:44

Trying to use http://www.martinklepsch.org/posts/why-boot-is-relevant-for-the-clojure-ecosystem.html to create a jar file in local repo with boot. No sources files in the one I'm currently generating and add-src seems to have disappeared. I will need to exclude some .cljs files as well. I'm a bit new to boot. Is what I'm trying to do possible, where are the docs? Thx.

superstructor00:02:34

has anyone used boot to build rpms before; e.g. with redline rpm ?

cjmurphy00:02:20

I've read that page and 1,2,3 of 2nd edition of modern cljs. I can do boot pom jar install and that works. Just looking for documentation for say the jar task as to how to include/exclude files.

micha00:02:14

boot jar --help will explain how to use the --include/--exclude etc.

micha00:02:27

or (doc jar) in the repl

micha00:02:50

oh whoops

cjmurphy01:02:01

great thanks, so used to seeing things in web pages I forget the other options!

micha01:02:23

we have web pages too!

cjmurphy01:02:33

sift - sounds like a good thing on a pipeline. thanks.

mbertheau08:02:18

How do I debug boot tasks? I.e. look at the fileset between tasks.

pesterhazy09:02:11

@mbertheau: have you tried boot -vv your-task ?

mbertheau09:02:13

@pesterhazy: I'll try that, thanks! :simple_smile:

mbertheau09:02:27

Hmm, apparently I use merge-env! incorrectly.

martinklepsch10:02:02

@mbertheau: boot show --fileset also is a thing

mbertheau10:02:48

@martinklepsch: nice!

mbertheau10:02:18

Can I use speak to signal success or failure of the test (cljs-test)?

mbertheau10:02:32

If I just put it after cljs-test it signals successful compilation.

martinklepsch10:02:23

@mbertheau: put speak in the beginning of the pipeline

martinklepsch10:02:45

I think the boot-cljs-example has the right order, not sure if it should go before or after watch. likely after

mbertheau11:02:00

@martinklepsch: speak before cljs-test still signals successful compilation only

martinklepsch11:02:05

@mbertheau: it's possible that it just does not work correctly. I'd suggest checking what the speak task is looking for (I think it checks for an exception) and then checking if cljs-test throws an exception on failure

martinklepsch11:02:24

also check the cljs-test issues, this might have been discussed before

mbertheau13:02:18

How would I get a non-zero exit code from test-cljs (`[crisptrutski/boot-cljs-test "0.2.2-SNAPSHOT"]`)?

mbertheau13:02:36

I just get zero regardless of any test failures

thomas13:02:28

Hi, quick question… is there some kind of option to point boot to a different build.boot file: eg:

boot -f my-build.boot jar

martinklepsch13:02:01

@thomas: there's an option to ignore your build.boot but afaik none to use a different one

thomas13:02:46

hmm ok… I’ll work around it for the moment.

martinklepsch13:02:55

@thomas: what you could to is boot -B repl => (load-file "my-build.boot") => (boot (jar))

thomas13:02:13

ok thank you

mobileink14:02:42

Hello, aot question here. I need to aot compile src/main/clojure/migae/servlets.clj to build/exploded-app/WEB-INF/classes. I've studied to docs on filesets and experimented but I'm stumped. I can't even get this to work: (core/deftask compile-clj "compile clj" [] (bi/aot :all))

martinklepsch14:02:02

what's not working? :simple_smile:

mobileink14:02:39

I get no output. It works from the command line, $ boot aot -a , although it puts the output in the wrong place. The fileset thing looks pretty clever but it's hard to figure out how to use. I need my output dir structure to be different from the input dir structure.

mobileink14:02:38

I added with-pre-wrap and still nothing happens

martinklepsch14:02:24

@mobileink: are you sure you have some clojure files on the classpath?

mobileink14:02:42

in my build.boot I have :resource-paths #{"src/main/clojure"} :source-paths #{"src/main/clojure"} I aot compile just the one file, the rest get copied

mobileink14:02:41

This works on the command line: $ boot aot -n migae.servlets

mobileink14:02:04

but nothing seems to work in my deftask. that's in a separate project, btw, I'm using boot watch pom jar install which seems to work just great

mobileink14:02:44

Separate question: to copy files where the output dir structure is different than the input dir structure, I take it that the bootish way to go is to query the input fileset, munge the paths, copy to a tmp fileset, then commit! Is that correct?

mobileink14:02:16

For example, to go from <resource-path>/a/b/c.clj to <target-path>/foo/a/b/c.clj

alandipert14:02:53

@mobileink: are you compiling a war file?

alandipert14:02:04

like a war is the desired result?

mobileink14:02:37

@alandipert Nope. servlets.clj contains some gen-class decls, so compiling it results in several .class files, but that should not make any difference I think

alandipert14:02:28

how are you invoking your compile-clj task?

alandipert14:02:38

re: your 2nd question, moving things around in the fileset can be done either the way you describe or via arguments to the sift builtin

alandipert14:02:57

the cljsjs packages have a lot of examples of sift usage for reference

mobileink15:02:08

Ok, I copied the code for the aot task and discovered it has "(core/with-pre-wrap [fs]" . change it to "(core/with-pre-wrap fs" and it works.

mobileink15:02:27

@alandipert: thanks, I'll look at sift. gotta run now, thanks

mobileink15:02:46

I spoke too soon. Now it emits the "Compiling..." message, but the output is nowhere to be found.

martinklepsch15:02:25

@mobileink: do you know about target etc? I.e. files are not emitted to disk unless you put the target task at the end of the pipeline

mobileink16:02:08

yes and no. I don't understand the relation between env entries like :target-path and filesets, e.g. output-files. for example, why is there no core/resource-files to get the stuff on :resource-paths?

skottk16:02:22

Anybody seeing FileNotFound running boot today?

Downloading  in thread "main" java.io.FileNotFoundException: 
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1835)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
	at java.net.URL.openStream(URL.java:1038)
	at boot.Loader.download(Loader.java:175)
	at boot.Loader.install(Loader.java:219)
	at boot.Loader.main(Loader.java:238)
Fresh, clean brew install of boot.

martinklepsch16:02:19

@skottk: that's trying to download a very old version of boot

martinklepsch16:02:31

do you have a boot.properties file? (in your current dir)

skottk16:02:38

I can tell, but I can’t seem to make it stop!

skottk16:02:55

IDK, but it does that wherever I run it, including empty directories.

skottk16:02:06

Mac running El Capitan

martinklepsch16:02:14

try deleting ~/.boot/cache

martinklepsch16:02:04

if that doesn't help wipe the whole ~/.boot thing, this is an issue with old versions that somehow pinned the version via a file in those dirs.

skottk16:02:36

Just tried that last, and it’s working - downloading 2.5.5 as we speak. Thanks!

martinklepsch16:02:44

great :simple_smile:

alandipert16:02:11

@mobileink: there are two "roles" that things in fileset can have, input and output

mobileink17:02:57

Got that, I've been querying and dumping fileset stuff. But then why have :resource-paths etc.? Why not just :inputs and :outputs? I gather that to work with my :resource-paths, I need to filter the fileset inputs using the value of :resource-paths. Is that the correct method?

juhoteperi17:02:50

@mobileink: What do you mean "work with resource-paths"?

juhoteperi17:02:45

Usually one would just use input-files to filter fileset for files with input role (sources and resources)

mobileink17:02:05

For example I might want to do something with the files in my resource directories. I guess I'm not seeing the point of having the :-paths env keys if everything gets glommed into input-files. The :-paths information gets discarded. I feel like I must not be understanding something about the design.

mobileink17:02:03

I think this is a good candidate for a FAQ. "What's the relationship between the :\*-paths env keys and filesets?"

danielsz17:02:58

Instead of boot checkout, can I use symbolic links to source files from project B in the src paths of project A? I'm envisioning this as a lightweight alternative to the checkout feature that requires 2 JVMs.

micha17:02:58

@danielsz: you'd have to merge their build scripts then

micha17:02:11

or at least add checkout project's deps to your build.boot

danielsz17:02:41

Sounds reasonable.

micha17:02:56

it's cleaner to do it via the maven jar interface because that keeps the projects isolated

danielsz17:02:09

Typically when I break a big project into smaller parts, the smaller parts use the dependencies of the bigger one, so that feels natural.

micha17:02:13

especially when the checkout dep needs to be built before it goes into the jar

micha17:02:18

@danielsz: if you wanted you could make a thing that works like lein checkouts

micha17:02:31

lein checkouts require a jar to be in maven, so it can look at the pom

micha17:02:40

that's how it knows which dependencies to add

micha17:02:47

you could do the same

micha17:02:11

make a function that uses the boot.pod functions to find the jar for the checkout dep and return the dependency vector

micha17:02:14

from the pom

micha17:02:29

then when you declare your own dependencies in your build.boot you could merge those in

danielsz17:02:41

Oh, sounds intriguing.

micha17:02:43

and add the directories that are symlinked

micha17:02:16

with the lein way you'd still need to reinstall the jar locally when you change the pom

micha17:02:32

but that's to be expected

micha17:02:20

you can add the checkout dep symlink dirs directly to :directories in the env

micha17:02:42

no, you'd want to add to :source-paths so it will rebuild when they change

micha17:02:03

anyway you can do it :simple_smile:

danielsz17:02:27

Cool. In my case, project B is actually the result of refactoring project A and doesn't bring any new dependencies, so a pure symlink solution sounded quick and clean.

danielsz17:02:54

Thanks, @micha !

micha17:02:49

:+1: lisp can do it

danielsz18:02:21

Lisp and UNIX :simple_smile:

micha18:02:04

speaking of UNIX, that's my new obsession: https://github.com/micha/json-table

micha18:02:16

rewriting it in C

danielsz18:02:36

Brilliant. I immediately thought that's a job for Scheme.

danielsz18:02:51

Which one do you use?

micha18:02:57

actually scheme was awful

micha18:02:04

guile, then chicken

micha18:02:18

yeah it's just really inefficient

micha18:02:35

functional programming style is a hindeance for this

micha18:02:40

except for clojure

micha18:02:48

if clojure compiled to C it would be great

micha18:02:00

i had a 30 line clojure program

micha18:02:07

turned into > 100 lines of scheme

micha18:02:28

but to get speed i want to bang on mutable things

danielsz18:02:39

You weren't satisfied with the resulting C program?

richiardiandrea18:02:42

@micha I think ClojureScript can transpile to scheme that then can compile to C

micha18:02:54

no, it's about 100 times slower than jshon

richiardiandrea18:02:58

I saw the project somewhere

micha18:02:03

it does do a lot more, but still

micha18:02:13

i need it to be usable for really big json

danielsz18:02:19

I've heard Stalin compiles the fastest C programs.

micha18:02:34

and also it needs to be fast enough to use in the shell, which might mean calling it lots of times in a loop

micha18:02:55

the C implementation is coming along really well

micha18:02:03

better than the scheme one for sure

danielsz18:02:08

How were the results of Guile compared to Chicken?

micha18:02:24

the guile environment isn't as usable as chicken

danielsz18:02:24

Roughly equivalent? Big difference?

micha18:02:45

it's hard to find things, packaging is a pain

micha18:02:59

i need to use this on aws machines during the bootstrap process

danielsz18:02:06

Yeah, Chicken is my go-to Scheme as well.

micha18:02:15

so i don't want to install all kinds of things, i just want a statically linked binary on s3

danielsz18:02:57

So you've got one, only it's too slow. Better than nothing :simple_smile:

micha18:02:13

no, you can't really make statically linked things with chicken

micha18:02:30

you can make a bundle that is self contained

micha18:02:45

but i just want a small little tool i can copy around

micha18:02:51

with no dependencies

danielsz18:02:53

Right. Absolutely.

micha18:02:11

and i had to allocate tons of conses in the scheme thing

micha18:02:35

in the c implementation there is very little dynamic allocation that needs to be done

micha18:02:04

only the output, which goes into a linked list

danielsz18:02:34

Right. Are you weighing more options? Pixie?

micha18:02:45

yeah i considered it

micha18:02:55

alan is trying it in ML

micha18:02:15

but really C seems like the ideal tool for making system utilities like this

danielsz18:02:23

Oh, cool. ML can produce a statically linked binary?

micha18:02:32

apparently, yes

micha18:02:44

but i also want to refresh myself on C and use it more

micha18:02:02

i need all kinds of tools i can use in the shell for sysadmin tasks

micha18:02:10

now that we're all sysadmins in the cloud

danielsz18:02:12

Ah, sure, why not.

danielsz18:02:14

:simple_smile:

jethroksy18:02:39

Not v much a clojure or boot question

danielsz18:02:44

You might even end up liking it.

jethroksy18:02:46

But since you guys are on this topic

jethroksy18:02:01

Would you see any value on learning scheme

micha18:02:01

like with my C implementation the json never gets converted to conses or hash-tables etc

jethroksy18:02:08

My first and only lisp language is clojure

micha18:02:28

if you know clojure then scheme will be very easy to use

micha18:02:44

i started with scheme

micha18:02:01

but after using clojure for a while it's really painful to go back and try to write a real program in it

jethroksy18:02:11

I wanted to read SICP etc

jethroksy18:02:19

But it just didn't make sense doing it in clojure

micha18:02:22

clojure is a truly amazing work of engineering and art

jethroksy18:02:37

Yeah I really like the abstractions it provides

jethroksy18:02:54

But I feel like I need to get down in the dirt to really appreciate it

micha18:02:55

the core namespace is like

micha18:02:00

i don't even know, no words

jethroksy18:02:11

That's another thing I gotta do

danielsz18:02:11

@jethroksy: It's more important to read SICP than to learn Scheme. But if you read SICP, you will know Scheme.

jethroksy18:02:39

I was doing SICP in clojure for a while

jethroksy18:02:50

Bumped into that no generalized TCO thing

micha18:02:45

but does it work if you use "eggs"?

danielsz18:02:08

I don't know. I just saw this.

micha18:02:30

eggs generally don't built static libs

micha18:02:53

so you have to rebuild those, and that's where i aborted

danielsz18:02:10

It would be worthless if it doesn't allow eggs, so my bet it is that it does. I'm an optimist.

micha18:02:20

i bet it doesnt

micha18:02:23

i'm a realist

danielsz18:02:06

Yes, very possible.

micha18:02:33

i thnk the C version will be nice

micha18:02:41

so far it's looking good

danielsz18:02:25

Great, you seem happy to play with C.

danielsz18:02:43

There is pleasure to be had in the most unlikely places.

micha18:02:54

i just need this tool

micha18:02:13

i do json stuff in the shell all day long

micha18:02:18

the bullshit must end

alandipert18:02:11

my goal is to be faster than micha :sweat_smile:

richiardiandrea18:02:30

oh I like your company attitude guys :smile:

danielsz18:02:40

ML vs Scheme vs C for the win! The contest is open. Rust people may want to show their muscles. Pixie people have an opportunity to show their language is actually useful in the real world. Etc. :wink:

danielsz18:02:54

(I don't read Russian)

dominicm18:02:44

+:stuck_out_tongue:

martinklepsch18:02:10

what is this all about? :smile:

dominicm18:02:23

@micha is writing a json pretty printer in C

dominicm18:02:34

Because lisp is too slow

danielsz18:02:45

That's a fair assessment indeed. :simple_smile:

martinklepsch18:02:01

but what happened to "Lisp can do it!"?

micha18:02:08

it's not a pretty printer

laforge4918:02:21

too slow, or too slow on startup????

micha18:02:21

it transforms trees into tables, basically

laforge4918:02:34

If the latter, use a server. :simple_smile:

micha18:02:39

so that shell tools like paste, join, sort, cut etc can process the data

micha18:02:56

i can't use a server in a shell script lol

laforge4918:02:47

I'd love to have boot running in the background so I could just pass a build request to it without having to start the jvm.

micha18:02:30

@laforge49: we had such a thing for a short while

micha18:02:07

there are issues with it, the biggest being that you can't change the CWD of a running JVM process

laforge4918:02:38

Yeah, that's why I never use the cwd.

micha18:02:40

that one is pretty mucha deal-breaker

micha18:02:01

most software you'll be using in your build will do stuff with the CWD

micha18:02:11

like resolving relative paths

micha18:02:29

@danielsz: that jsawk thing is what i want to avoid this time around :simple_smile:

micha18:02:52

i don't want a new turing complete language that needs to run in a separate environment

micha18:02:00

i want to use the awesome shell tools

micha18:02:11

like running js in rhino to process json is ok

micha18:02:27

but it will never be as good as sed and grep etc for large data

micha18:02:52

and then you need to rewrite all those shell utilities in that environment

micha18:02:15

the idea of this thing is to get the data out of nested tree format as quickly as possible

micha18:02:31

and do all computing in the shell, operating on tab-delimited lines of text

alandipert18:02:02

i've been doing experiments the past few weeks making statically-linked standalone binaries with CL

danielsz18:02:10

A fast JSON parser/tokenizer in C is http://zserge.com/jsmn.html

danielsz18:02:21

Could be useful for your project.

alandipert18:02:33

the smallest i could get hello world was 25mb w/ ECL

micha18:02:39

i'm using jansson

danielsz18:02:48

@alandipert: Tell us, please. I'm very interested.

alandipert18:02:50

vs. < 2mb w/ mlton

martinklepsch18:02:57

@alandipert: racket can also do this kind of stuff, much smaller binaries (2-5mb iirc)

alandipert18:02:26

i would be very surprised if they could be that small and be statically linked

micha18:02:59

@danielsz: whoa this jsmn looks ideal

martinklepsch19:02:14

not sure I fully understand what static linking means, maybe I'm misunderstanding

alandipert19:02:18

@martinklepsch: isn't dynamically linked to any shared libraries in /usr/lib... requires only a 64bit linux environment

martinklepsch19:02:05

> The output of raco exe is meant to statically include its required modules, so it may not be what you want. — via Stackoverflow. Disclosure: I have no idea what I'm talking about.

micha19:02:23

@danielsz: thanks for that link, it looks perfect

danielsz19:02:44

@micha: Awesome. Good luck with it.

hugod21:02:35

If boot-cljs can’t find cljs.repl, what am I doing wrong. I am using clojure 1.7.0 and clojurescript 1.7.189

hugod21:02:45

:simple_smile:

hugod21:02:44

I should have said boot cljs-repl, as well

martinklepsch21:02:50

@hugod: can you explain what you're doing and what you're expecting to happen?

martinklepsch21:02:27

@hugod: just boot cljs-repl is not sufficient for a working browser repl

hugod21:02:51

@martinklepsch: I have a dev task that invokes the cljs-repl and cljs tasks (among others). I’m just trying to get a cljs repl started (for react native). https://gist.github.com/54c5024113dee42a7792

martinklepsch21:02:35

@hugod: that looks correct. after running the dev task you connect to the repl server and do (start-repl)?

hugod21:02:32

@martinklepsch: : running the task results in java.io.FileNotFoundException: Could not locate cljs/repl__init.class or cljs/repl.clj on classpath (somewhere under boot.repl-server and piggieback)

martinklepsch21:02:34

can you gist the whole stacktrace? seeing piggieback, triggers my "dependency issue" button but you pinned it so I guess that should be fine

hugod21:02:32

@martinklepsch: added to the gist

cjmurphy21:02:33

@hugod: I get the same problem if I try to use the repl when there's no browser open at the page.

cjmurphy21:02:09

(not native, just normal cljs stuff)

martinklepsch22:02:44

@hugod: don't have any suggestions right now sorry

hugod22:02:06

@martinklepsch: thanks for looking

hugod22:02:57

@cjmurphy: I would understand that if I got as far as actually trying to connect to the repl

cjmurphy22:02:31

I'm saying I got the same error message (IIRC). I could not connect to the REPL unless I went to the browser page. I don't know what the equivalent of a browser page is with native stuff.