Clojurians
#boot
<
2015-12-22
>

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

micha00:12:17

does anyone know of a codox writer to generate markdown suitable for including in a github repo?

micha00:12:09

i want to generate markdown api documentation for boot and have a precommit hook so the docs are always reflecting the specific commit

micha00:12:40

html docs are nicer but not as practical for that

alandipert02:12:04

@micha: how do you feel about using boot-heredoc in the boot sources, then parsing doc meta as markdown?

micha02:12:26

interesting i like it

alandipert02:12:35

complicates repl dev tho

micha02:12:11

@alandipert: how so?

micha02:12:31

the heredoc stuff would be comments, ignored

alandipert02:12:49

oh right, i forgot about that

alandipert02:12:26

ok yes, i'm back onboard again

alandipert02:12:58

i'm doing the classloader walk thing

alandipert02:12:30

any reason not to start with ClassLoader.getSystemClassLoader() as my parent?

micha02:12:56

i don't knwo of any

micha02:12:16

yeah that seems easier than walking

alandipert02:12:48

so the gameplan is make a URLclassloader subclass and set system CL as its parent. then, load boot.jar into that

micha02:12:05

you don't need to subclass

micha02:12:18

you can just provide boot.jar when you create it

micha02:12:25

and use a regular URLClassLoader

micha02:12:40

or you can inject via reflection if you want

alandipert02:12:13

oh right it takes URL in ctor

alandipert02:12:45

i'm gonna get scalac in the pod too i think

micha02:12:47

that's the reflection way

micha02:12:28

does boot scalac make sense?

micha02:12:38

or is scala too crazy to just compile

alandipert02:12:47

i bet we could be the best scala build tool lol

alandipert02:12:51

but yeah i'd need to be drunk

alandipert02:12:35

but yeah it wouldn't make sense, since the thing that makes scala tenable is IDE support

alandipert02:12:39

which our task would never have, probably

alandipert02:12:04

i guess we could emit pom.xml

seancorfield02:12:25

Sounds like I should make frege-boot-task then? (Given I already made frege-lein-plugin) :simple_smile:

alandipert02:12:39

@seancorfield: i'm sure it would be awesome

seancorfield02:12:49

Today I moved all our code around at work. Tomorrow I’m off (celebrating wedding anniversary). Wednesday onward I’ll be migrating our build system from Ant/Lein to Boot (probably still with bits of Ant around it).

micha02:12:21

i wonder if ant-in-a-pod would be helpful there?

micha02:12:26

i've used the ant api from clojure before, i forget what that was for but i think it worked

micha02:12:03

yeah i think that would work

micha02:12:55

oh nevermind yes

micha02:12:16

i got confused thinking that your jar would pollute the system classloader, and you'd have the same conflict again

micha02:12:24

but the conflicting dep will be in pod

micha02:12:32

so i think it would work

alandipert02:12:49

hm tho wouldn't the spark container have polluted the system cl potentially?

micha02:12:58

the pod is a shild classloader, not visible to the conflicting code

micha02:12:08

if that's the case then you're sunk

micha02:12:17

because that infects the entire jvm i think

alandipert02:12:25

yeah let's hope not

alandipert02:12:33

there's a layer of hadoop in there, hopefully spark doesn't go above it

micha02:12:44

yeah that would be uncouth

micha02:12:59

the trick used in Boot.java is frowned upon

alandipert02:12:10

any reason not to deploy boot-bin as jar?

micha02:12:13

so they hopefully don't use it

micha02:12:25

how do you mean?

micha02:12:43

it is a jar

alandipert02:12:51

err, on clojars i mean

alandipert02:12:02

then i could get it with sbt

micha02:12:13

yeah we should do that

alandipert02:12:34

i will set it up

micha02:12:55

what about an alternative boot-bin, for embedded use like what you're doing?

micha02:12:05

embedded boot

alandipert02:12:32

i'm not sure how different it has to be, if at all

alandipert02:12:41

i'll install locally and start playing around, see if this approach actually works

micha02:12:48

it would download dependencies at build-time perhaps

micha02:12:14

yeah it's confusing to think about

micha02:12:25

very meta

micha02:12:20

we need a kotlin task

alandipert03:12:20

so in App, the main method, i think it would be good if we split the setup and the system.exit call

alandipert03:12:37

in the embedded scenario i want at newPod only

alandipert03:12:29

actually i want newCore i suppose

micha03:12:21

yeah we could split that

micha03:12:49

i think i ran into some issue but i don't remember what now

micha03:12:12

definitely splitting up the environment setup from the argument handling would be good

seancorfield03:12:04

So, boot-as-a-library? Interesting. Leiningen took a long time to go that way...

alandipert03:12:02

in this case, just for pads and getting deps

alandipert03:12:21

we have a dependency hell situation at work in a scala project - Spark API conflicts with jackson dep in AWS api

alandipert03:12:24

@micha: ^^ to not change boot-bin for now.. ultimately i think we want setup() to go in boot-bin

micha03:12:47

boot-bin needs to be very simple though

micha03:12:56

so we can be sure we'll never break it

alandipert03:12:02

it wouldn't add code, just split setup and initialization

micha03:12:12

oh you mean boot.jar?

micha03:12:16

like boot.App

micha03:12:36

boot-bin just downloads boot.jar

alandipert03:12:54

oh yeah, sorry, i confus

alandipert03:12:57

i don't actually even need boot-bin

micha03:12:15

there are a lot of jars around here lol

micha03:12:42

that looks great

micha03:12:27

might need to call setup() in the arg handlers for --update and --version

alandipert04:12:27

success!

Welcome to Scala version 2.10.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_66).
Type in expressions to have them evaluated.
Type :help for more information.

scala> System.setProperty("BOOT_VERSION", "2.5.3")
res0: String = null

scala> boot.App.setup(Array())

scala> import boot.App;
import boot.App

scala> val worker = App.newWorker().get()
worker: org.projectodd.shimdandy.ClojureRuntimeShim = [email protected]

scala> val core = App.newCore().get()
core: org.projectodd.shimdandy.ClojureRuntimeShim = [email protected]

def evalIn(pod: ClojureRuntimeShim, codeStr: String) = { pod.invoke("clojure.core/eval", pod.invoke("clojure.core/read-string", codeStr)) }
import org.projectodd.shimdandy.ClojureRuntimeShim

scala> evalIn: (pod: org.projectodd.shimdandy.ClojureRuntimeShim, codeStr: String)Object

scala> evalIn(core, "(println (+ 1 2))")
3
res4: Object = null

alandipert04:12:55

i was surprised that eval/read-string combo worked

alandipert04:12:04

i suppose it does because i feed the clj objects back to the classloader that knows about them

micha04:12:41

you're sending it a string though, right?

micha04:12:52

strings are coming from the system classloader

micha04:12:07

so they shouldbe portable across any classloader

alandipert04:12:30

but my evalIn function there

alandipert04:12:35

it nests pod.invoke

alandipert04:12:48

getting dependencies works!

scala> evalIn(core, "(boot.core/set-env! :dependencies '[[clj-time \"RELEASE\"]])")
res6: Object = null

scala> evalIn(core, "(use 'clj-time.core)")
res7: Object = null

scala> evalIn(core, "(str (now))")
res8: Object = 2015-12-22T04:06:25.523Z

micha04:12:51

the shim is in two parts

micha04:12:54

the api and the impl

micha04:12:00

the api has .invoke

micha04:12:06

the impl is the one you can't get to

alandipert04:12:35

@micha: have you seen Pop without matching push before? coming from shimdandy

micha04:12:54

what was that

micha04:12:19

ah i think it's when you exit ungracefully

micha04:12:30

one sec i'll try to find the place where i ran into it

micha04:12:47

but i think that clojure isn't being given time to unwind itself

micha04:12:51

(unrelated to #6 lol)

micha04:12:24

but if i mess around with that piece of program i can make it thrown that error

alandipert04:12:25

so i should put my invoke call in a future you think?

micha04:12:52

if i had a good online orgmode app i could keep track of all these weird little things

alandipert04:12:17

man, i think they might have diddled the system CL

micha04:12:06

checkmate

alandipert04:12:53

although - that might only be locally, or inside intellij

alandipert04:12:59

in the sky, maybe it could work

micha04:12:48

this is the prayer of my people

alandipert04:12:45

i think we may have to shell out to another jvm

alandipert05:12:52

i would call the embeddable boot experiment a success though

micha05:12:53

yeah that's worthwhile even if spark is still unusable

nha08:12:51

@martinklepsch @juhoteperi After re-reading my message I was not clear : 10% gain in my case after cljs optimisation, but this doesn't translate to 10% after gzipping (though it was better) - will have to retest to be sure of the gains if any.

laforge4910:12:09

Where do I create an issue for lein new hoplon-castra?

danielgrosse13:12:13

I cannot get boot to run. When I start it, it tries to download boot.2.0.0-rc13 but don’t find it.

danielgrosse13:12:23

I use OSX and isntalled it with homebrew

martinklepsch13:12:32

@danielgrosse: make sure home brew is up to date and if it is check that BOOT_VERSION isn't set

danielgrosse13:12:35

I also tried to download the boot.sh from the repository. But the same error. BOOT_VERSION isn’T set

martinklepsch13:12:13

@danielgrosse: do you have a boot.properties file?

danielgrosse13:12:25

where should it be?=

martinklepsch13:12:10

Problem solved?

danielgrosse13:12:44

Yeah. I had a .boot folder in my home. Maybe from a former tryout. :grinning:

danielgrosse13:12:56

Is 2.5.2 just released? It download 2.4.2 at the first time. Now when I used it, the 2.5.2 was downloaded

danielgrosse13:12:08

And I get this

danielgrosse13:12:10

clojure.lang.ExceptionInfo: Unable to resolve symbol: Protocol in this context
    data: {:file
           "/var/folders/qj/rtsvn3wd7mq4nlj54fnjl3jr0000gr/T/boot.user3494953550947180493.clj",
           :line 13}
java.lang.RuntimeException: Unable to resolve symbol: Protocol in this context

nha13:12:52

Regarding the version I think it is because the homebrew wrapper has not yet been updated to 2.5.2 (latest), but I think that the wrapper did not change since.

danielgrosse13:12:46

Okay. The error seems to come from my boot.file, is there a testing routine?

danielgrosse13:12:16

@martinklepsch: I try to create a cljsjs package. But the boot process always throws errors. Also on exisiting packages

danielgrosse13:12:57

$dropbox> boot package jar install
Downloading dropbox.js
Downloading dropbox.min.js
Sifting output files...
Sifting output files...
Writing deps.cljs
Writing project.jar...
Installing project.jar...
             clojure.lang.ExceptionInfo: java.lang.NullPointerException: entry
    data: {:file
           "/var/folders/qj/rtsvn3wd7mq4nlj54fnjl3jr0000gr/T/boot.user651602337335621290.clj",
           :line 19}
java.util.concurrent.ExecutionException: java.lang.NullPointerException: entry
         java.lang.NullPointerException: entry
                                          ...                     
                             boot.pod/pom-xml        pod.clj:  162
                          boot.aether/install     aether.clj:  178
                                          ...                     
                           clojure.core/apply       core.clj:  630
                        boot.pod/eval-fn-call        pod.clj:  223
                            boot.pod/call-in*        pod.clj:  230
                                          ...                     
                            boot.pod/call-in*        pod.clj:  233
               boot.task.built-in/fn/fn/fn/fn   built_in.clj:  725
               boot.task.built-in/fn/fn/fn/fn   built_in.clj:  618
cljsjs.boot-cljsjs.packaging/eval285/fn/fn/fn  packaging.clj:  110
               boot.task.built-in/fn/fn/fn/fn   built_in.clj:  402
               boot.task.built-in/fn/fn/fn/fn   built_in.clj:  402
 cljsjs.boot-cljsjs.packaging/eval239/fn/G/fn  packaging.clj:   86
 cljsjs.boot-cljsjs.packaging/eval239/fn/G/fn  packaging.clj:   86
                          boot.core/run-tasks       core.clj:  791
                            boot.core/boot/fn       core.clj:  801
          clojure.core/binding-conveyor-fn/fn       core.clj: 1916

danielgrosse13:12:05

$localforage> boot package jar install
clojure.lang.ExceptionInfo: Unable to resolve symbol: bootlaces! in this context
    data: {:file
           "/var/folders/qj/rtsvn3wd7mq4nlj54fnjl3jr0000gr/T/boot.user6806057931586254894.clj",
           :line 13}
java.lang.RuntimeException: Unable to resolve symbol: bootlaces! in this context
               ...                  
boot.main/-main/fn     main.clj: 192
   boot.main/-main     main.clj: 192
               ...                  
  boot.App.runBoot     App.java: 390
     boot.App.main     App.java: 467
               ...                  
  boot.Loader.main  Loader.java: 253

danielgrosse13:12:16

What am I doing wrong?

seancorfield16:12:35

@danielgrosse: if it can't resolve bootlaces! maybe you haven't required the namespace and referred in the symbols?

seancorfield16:12:04

We'd need to see your build.boot file.

juhoteperi16:12:16

Bootlaces is no longer used by cljsjs packages

nha16:12:39

How do I slurp a file in resources from within a pod (`pod/with-call-in`)? (slurp "resources/Uglify2/uglifyjs.self.js") throws an exception

micha16:12:16

@nha is resources in your :source-paths or :resource-paths?

micha16:12:35

if not you should add it

micha16:12:40

then you can do:

micha16:12:19

(pod/with-eval-in p
  (require '[ :as io])
  (slurp (io/resource "Uglify2/uglifyjs.self.js")))

danielgrosse16:12:28

As I said. These were existing packages. (Dropbox, localforage) Later I found that boot package pom jar install got the desired effect. So maybe the documentation needs an update.

nha16:12:57

@micha perfect, works !

kanwei18:12:59

I'm reading http://clojurians-log.mantike.pro/boot/2015-08-23.html and I'm still confused by how to setup cljs properly

kanwei18:12:13

converting from lein-cljsbuild

kanwei18:12:47

I also have a wrap-resource in a ring handler

micha18:12:55

there probably isn't much for you to setup

kanwei18:12:08

I understand that all the generated stuff is ending up in target, but how do I wrap-resource it?

micha18:12:09

the boot cljs task etc will figure things out for itself

micha18:12:35

you want to serve from the classpath, which those things will all be on automatically

micha18:12:50

so you don't need to do anything special

micha18:12:13

you shouldn't need to worry about the target dir for dev either

micha18:12:49

the target is just where you spit out your final artifacts, like jar files or war files etc

micha18:12:27

if you're running boot watch reload cljs serve etc you don't care about the target dir

micha18:12:39

jetty will be serving from the classpath

kanwei18:12:19

hmm, it does seem to work now with :asset-path "js/ddplugin.out"

micha18:12:51

oh, yeah asset path makes things more complicated

micha18:12:17

i'd let boot-cljs handle the details of cljs if possible

juhoteperi18:12:34

Boot-cljs doesn't handle asset-path very well currently

juhoteperi18:12:23

I think I'm setting asset-path manually everywhere

kanwei18:12:21

so the serve plugin is doing some voodoo with the classpath and adding "/target"? Or is that just how the JVM works?

kanwei18:12:23

so confusing

micha18:12:06

the target is not relevant while boot is running

micha18:12:20

boot tasks don't know about it

micha18:12:41

the purpose of the target is simply a place to dump the final state of the fileset just before boot exits

micha18:12:02

starting with boot 2.5.0 the target dir is actually deprecated

kanwei18:12:13

so you're saying in the serve plugin, it's using a boot Fileset for classpath?

micha18:12:21

it's using the jvm classpath

micha18:12:32

you add things to that by adding them to the fileset

kanwei18:12:46

are the intermediary files in the filesystem anywhere?

kanwei18:12:55

(besides target as the final)

micha18:12:59

you can access them from the fileset

micha18:12:15

all files, intermediate or otherwise are anonymous temp files managed by boot

micha18:12:30

but you can get an actual file, like to read the contents, from the fileset

micha18:12:38

but they're read-only

kanwei18:12:44

that's pretty cool

micha18:12:12

you modify existing files in the fileset by adding a new file with the same path

micha18:12:34

then you obtain a new immutable fileset

kanwei18:12:39

it's definitely than cljsbuild where you have to either change your dev/prod bootstrap code, or use :optimization :simple

kanwei18:12:46

uberjar also worked

kanwei18:12:19

so yeah besides the /asset-path thing

kanwei18:12:23

pretty straightforward

micha18:12:02

usually you can just not use asset-path

juhoteperi18:12:03

@kanwei: Changing bootstrap code with Cljsbuild shouldn't be necessary either. ClojureScript has had the :main option since January.

micha18:12:59

where the js files are is merely cosmetic

kanwei18:12:01

ahh.. I set it up like 2.5 years ago so had no idea :simple_smile:

kanwei18:12:35

definitely nice to have just one script instead of running 4 different daemons

kanwei19:12:28

is there any doc on the new "target" task? can't find it

micha19:12:45

boot target -h is the best docs right now

micha19:12:51

or in the repl (doc target)

magomimmo19:12:58

@kanwei: you can take a look at https://github.com/magomimmo/modern-cljs hope it could help in the migration. just take into account that at the moment it has been pinned to boot 2.4.2 release

kanwei19:12:35

I was looking at that yesterday... kind of why I started porting to boot in the first place. Thanks for the work!

kanwei19:12:56

It's taken 2 hours but I think I'm all booted-up from leiningen.

magomimmo19:12:32

it takes a while to understands its philosophy

magomimmo19:12:07

but after that the signal/noise ratio is favourable

magomimmo19:12:20

@micha: I should test the 2.5.2 release and take a look at the target task

kanwei19:12:30

(lein-generate) is by itself in deftask, and not part of the (comp)?

kanwei19:12:38

cause it's erroring out if I put in comp

martinklepsch19:12:54

@magomimmo: the 2.5.2 Release should be mostly compatible with 2.4.2 except for some gpg/push related things. The target/ behavior is the same by default, new behavior has to be enabled explicitly.

magomimmo19:12:54

ok. because of a motorbike accident I’ll stay at home few days….I’ll take care of this

martinklepsch19:12:48

@kanwei: the lein-generate task isn't really composable, most people just call it once or when they change things in build.boot

martinklepsch19:12:33

@magomimmo: oh, I hope you're ok! :crying_cat_face:

magomimmo19:12:44

@martinklepsch: nothing so tuff. muscle tear...

flyboarder19:12:50

@micha: I’m getting the following error when trying to to do a push-release

micha19:12:19

@magomimmo: get better soon :simple_smile:

micha19:12:32

@flyboarder: ah yea

micha19:12:43

are you on windows?

micha19:12:52

oh no i see osx

micha19:12:00

you can do brew install gpg probably

magomimmo19:12:07

@micha: thanks! I’ll do

micha19:12:13

or do you already have gpg installed?

micha19:12:38

if so and it's not on your PATH you can set BOOT_GPG_COMMAND=/path/to/gpg

flyboarder19:12:50

i have it installed as but i will install the new brew package

micha19:12:04

what happens if you type which gpg in the terminal?

flyboarder19:12:27

/usr/local/bin/gpg

micha19:12:09

you don't need to install the brew package if that works

micha19:12:30

can you do gpg --list-keys for instance?

flyboarder19:12:35

yeah and they show up, seems the reinstall may have fixed it

flyboarder19:12:49

brew did install a new package

flyboarder19:12:32

yeah strange cuz my other projects are using gpg fine, hope they keep working :joy:

crisptrutski20:12:57

have a question about boot task parameters

crisptrutski20:12:24

want a super permission type, basically {:parse identity, :validate identity} (well, that wrapped in a set)

micha20:12:50

you can use the edn or code types there

crisptrutski20:12:50

don’t see that in the type matrix, is it a terrible idea to figure out getting it in anyway?

crisptrutski20:12:01

well, read-string tries to read it

crisptrutski20:12:16

just want a string to be a string

micha20:12:16

one thing you can do is use the type just for cli

micha20:12:57

then you can use the ^:! meta on the argument to tell clifn not to validate the type when called from build.boot or repl

micha20:12:27

like what is the use case?

micha20:12:32

i can show an example

crisptrutski20:12:48

^:! sounds fine

crisptrutski20:12:59

the use case is that regex / symbol / string punning we talked about the other night

crisptrutski20:12:01

for namespace filters

micha20:12:08

exactly yes

micha20:12:38

the meta goes on the type

crisptrutski20:12:44

where does the hint go? on the binding name or the type “hint”?

micha20:12:55

i haven't used it in a long time :simple_smile:

micha20:12:06

is it on the wiki?

micha20:12:20

ah, no it's not

micha20:12:42

if you get it working would you please add to the wiki if you have the time?

crisptrutski20:12:48

works like a charm

crisptrutski20:12:52

see you can’t nest it though :simple_smile:

crisptrutski20:12:01

tried {^:! str} first

crisptrutski20:12:09

sure, will update the wiki now

micha20:12:24

i think perhaps ^:! #{str}?

crisptrutski20:12:43

yip, the winner