Fork me on GitHub
#boot
<
2016-01-22
>
richiardiandrea00:01:22

it is too bad no Clojure jar has corresponding has _source

richiardiandrea00:01:21

ah right, there is no need 😄

richiardiandrea00:01:36

all the sources are already there unless you AOT right?

micha00:01:01

yep, i believe so

micha00:01:14

at least up to 1.7.0 it's true

micha00:01:43

(-> "clojure/core.clj" slurp print) is how you can test

richiardiandrea00:01:24

i was checking in the jars directly but your version is better 😄

micha00:01:52

i guess a better way is to use the source macro in the repl

micha00:01:20

cause that thing needs to have the source files in the jar to work

richiardiandrea00:01:05

yes that exactly I stated in my post here I am trying to solve: http://blog.scalac.io/2015/12/21/cljs-replumb-require.html

jaredly00:01:03

do nested comps flatten? e.g is (comp (task1) (comp (task2) (task3))) equivalent to (comp (task1) (task2) (task3))?

jaredly01:01:27

hmmm I’m guessing “yes”, b/c I just tried it w/ some transducers, and it seemed to work

micha01:01:53

@jaredly: yes you're right

richiardiandrea01:01:41

well...it is not flattening per se, you are just applying functions to functions 😄

jaredly02:01:53

looks like (sift :move doesn’t support moving directories?

jaredly03:01:20

oh I was doing it wrong

nayzak08:01:48

hi everyone simple_smile How to avoid creation of main.out subdirectory in target dir for cljs task (for production builds)?

Slackbot08:01:49

Yo it's clojurian, whats up ?

juhoteperi08:01:55

@nayzak: You can use sift to filter which files are included in output

nayzak08:01:54

I saw that sift only moves files... Ok, I'll check docs. Thanks.

sooheon09:01:43

It’s looking like a problem with the way I wrote my code that doesn’t allow for it to be reloaded. If anyone has any ideas or an inkling, I can show my code as well.

sooheon09:01:47

Strangely, I’ve tried checking out a previously bug free commit, and after a couple cljs changes the browser is showing that error again, so now I’m really confused.

martinklepsch11:01:06

@sooheon: could be the file is reloaded before it's present. I.e. reloading event is sent but you already initiated a new build (by changing a file) and so the requested file isn't there anymore

martinklepsch11:01:18

@sooheon: does it persist after modifying a file again?

sooheon11:01:44

@martinklepsch: it appears some time after the first modification, and then recurs after every subsequent one.

martinklepsch11:01:15

@sooheon: how are you serving files? mind pasting your build.boot?

sooheon11:01:02

the actual server code is pretty much taken from daraen’s saapas

martinklepsch11:01:17

I don't have any good ideas right now. I'd suggest opening an issue. Ideally provide a minimal case. If you can't some relevant code snippets might also help simple_smile

sooheon11:01:19

Ok, thanks, will try to make a coherent issue. :)

sooheon12:01:07

I know that boot show -d will show me the dep tree, was there another command to show conflicts? I’m getting a version conflict warning but I can’t seem to find where it originates

martinklepsch12:01:26

@sooheon: boot show -p/--pedantic I believe

martinklepsch12:01:39

@sooheon: boot show --help should list it simple_smile

sooheon12:01:20

@martinklepsch: ah thanks :) was only looking at boot -h.

martinklepsch12:01:05

@sooheon: in general all tasks have a -h/--help option simple_smile

nha14:01:26

Is anyone having this error ?

boot -u
/usr/local/bin/boot: array assign: line 1: unexpected EOF while looking for matching `"'
/usr/local/bin/boot: array assign: line 3: syntax error: unexpected end of file

nha14:01:34

(on any boot command I type, but it doesn't seem to break anything apart from that)

micha14:01:08

can you paste echo $BOOT_JVM_OPTIONS please?

micha14:01:20

i think there may be a stray quote in there perhaps

nha14:01:33

Ah I think you are right :

echo $BOOT_JVM_OPTIONS
-Xmx2g -client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xverify:none -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:-OmitStackTraceInFastThrow -Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}

micha14:01:46

yeah boot needs to put those into an array

micha14:01:00

so it can pass them to java correctly

nha14:01:29

So it should be

[ -Xmx2g -client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xverify:none -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:-OmitStackTraceInFastThrow -Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl} ]
Thanks simple_smile

micha14:01:06

the double quote at the end

nha14:01:17

oops yes

dajana14:01:28

Hi guys, I’m trying to setup :compiler options like this :output dir “resources/public/js/compiled/out" but after running my task boot gives me a warning WARNING: Replacing ClojureScript compiler option :output-dir with automatically set value. Do you know where the problem can be?

Slackbot14:01:29

Yo it's clojurian, whats up ?

martinklepsch14:01:58

Hey @dajana, with boot-cljs you usually don't set :output-dir directly

martinklepsch14:01:08

@dajana: whats your motivation to set it?

dajana14:01:40

I need to compile my ClojureScript into resources.

martinklepsch14:01:38

so the easiest way to do that is to create a .cljs.edn file as described here https://github.com/adzerk-oss/boot-cljs/wiki/Usage#multiple-builds

martinklepsch14:01:12

(ignore the Multiple builds thing for now)

dajana14:01:06

this is how my code looks like

(deftask dev
  "Start the dev env..."
  []
  (set-env! :source-paths #{"src/clj" "src/cljs"})
  (comp (serve :dir "resources/public")
   (watch)
   (speak)
   (reload :on-jsload 'cljs-repl-web.core/main)
   (cljs-repl)
   (cljs :compiler-options {:closure-defines {"goog.DEBUG" false}
                            :source-map :true
                            :output-to "resources/public/js/compiled/main.js"
                            :output-dir "resources/public/js/compiled/out"
                            :asset-path "js/compiled/out"                                                                                                                          
                            :main "cljs-repl-web.core"
                            :optimizations :none
                            :source-map-timestamp true
                            })))

martinklepsch14:01:22

if you want the compiled file to end up in your resources in public/js/ then you need to put the cljs.edn file into resources/public/js/my-build.cljs.edn

dajana14:01:37

Thanks guys simple_smile

martinklepsch14:01:42

basically anything related to where files end up is handled by .cljs.edn — I have to leave now unfortunately but I'm sure you'll figure it out simple_smile

dajana14:01:42

yes, sure... thanks a lot @martinklepsch simple_smile

laforge4915:01:44

Starting to work with (test-cljs :update-fs? true :js-env :phantom :namespaces '#{aautil.simple-test}) Getting this error: WARNING: Replacing ClojureScript compiler option :main with automatically set value. ò output.js clojure.lang.ExceptionInfo: clojure.lang.ExceptionInfo: ERROR: No such namespace: main.out.cljs.core, could not locate main/out/cljs/core.cljs, main/out/cljs/core.cljc, or Closure namespace "main.out.cljs.core" in file C:\Users\Bill\.boot\cache\tmp\Users\Bill\Documents\aatree\aautil\6uo\9p5por\boot\cljs\main1055.cljs at file boot\cljs\main1055.cljs It could be my test: (ns aautil.simple-test) (println "hi!") But basically I am clueless. 'elp!

micha15:01:22

can you paste your build.boot please?

laforge4915:01:52

(set-env! :dependencies '[[org.clojure/clojure "1.8.0" :scope "provided"] [org.clojure/clojurescript "1.7.228" :scope "provided"] [org.clojure/tools.logging "0.3.1"] [org.apache.logging.log4j/log4j-core "2.5" :scope "test"] [org.apache.logging.log4j/log4j-slf4j-impl "2.5" :scope "test"] [adzerk/bootlaces "0.1.13" :scope "test"] [adzerk/boot-test "1.1.0" :scope "test"] [adzerk/boot-cljs "1.7.228-1" :scope "test"] [crisptrutski/boot-cljs-test "0.2.1" :scope "test"]] :source-paths #{"test/cljs" "test/clj" "dev-resources"} :resource-paths #{"src/clj" "src/cljs" "src/cljc"}) (require '[adzerk.boot-cljs :refer [cljs]] '[adzerk.bootlaces :refer :all] '[adzerk.boot-test :refer :all] '[crisptrutski.boot-cljs-test :refer [test-cljs]]) (def +version+ "0.0.1") (bootlaces! +version+ :dont-modify-paths? true) (task-options! pom {:project 'aatree/aautil :version +version+ :description "Snippets of useful code." :url "https://github.com/aatree/aautil" :scm {:url "https://github.com/aatree/aautil"} :license {"EPL" "http://www.eclipse.org/legal/epl-v10.html"}}) (deftask dev "Build project for development." [] (comp (build-jar))) (deftask test-it "Setup, compile and run the tests." [] (comp (cljs) (test-cljs :update-fs? true :js-env :phantom :namespaces '#{aautil.simple-test}) ; (run-tests) )) (deftask deploy-release "Build for release." [] (comp (build-jar) (push-release)))

micha15:01:47

it would be easier to see if you paste into a slack "snippet", or perhaps https://www.refheap.com/

micha15:01:31

hmm, i don't see anything wrong there

micha15:01:35

i mean with build.boot

laforge4915:01:07

could e my test? I have not defined any test, just a plain cljs file.

micha15:01:37

also i'm not sure about the cljc stuff

micha15:01:53

i haven't used cljc much

laforge4915:01:39

If I remove the test-cljs line from test-it, it woiks

laforge4915:01:52

So I get the feeling that test-cljs might be looking for a test to run? I don't think it is cljc stuff.

laforge4915:01:42

I've dropped most of my code, same error: :source-paths #{"test/cljs"} ; "test/clj" "dev-resources"} ; :resource-paths #{"src/clj" "src/cljs" "src/cljc"} )

juhoteperi15:01:17

Hmm I wonder what causes the warning about :main option

laforge4915:01:29

Like I said, I haven't included any deftest in my test code.

laforge4915:01:36

Could that be it?

juhoteperi15:01:58

Not sure, but I don't think so

laforge4915:01:11

added the deftest anyway. no change

laforge4915:01:33

Perhaps I need a aautil.core name space?

laforge4916:01:22

Perhaps I need to specify a sourcemap on the cljs? This gives lots of errors: (cljs :source-map)

laforge4916:01:23

but cljs -s is shown int the cljs example here: https://github.com/adzerk-oss/boot-cljs/wiki/Example

juhoteperi16:01:07

When you define options in Clj you need to provide them as keyword arguments: (cljs :source-map true)

laforge4916:01:15

same old error now

juhoteperi16:01:24

I can reproduce the error

laforge4916:01:16

I'll note that I have no html file.

laforge4916:01:31

can anyone offer a simple/demo cljs unit test example?

laforge4916:01:54

i.e. no web server, just phantomjs

juhoteperi16:01:04

Oh right, I already almost forgot, but it seems that I found the problem

juhoteperi16:01:24

Problem is not with (test-cljs)

juhoteperi16:01:35

It fails when running (cljs)

juhoteperi16:01:09

If you only want to test cljs, you don't need to use (cljs) because (test-cljs) already embeds (cljs) task

juhoteperi16:01:12

with proper options

laforge4916:01:41

and if I want it all?

juhoteperi16:01:31

When you directly use cljs task it will by default require all cljs namespaces, which is often bad idea

juhoteperi16:01:01

With libraries you don't really "want it all", only time you compile cljs in library project is for testing

laforge4916:01:01

now I'm getting the doo error

laforge4916:01:11

but that's better. Hmm?

laforge4916:01:26

C:\Users\Bill\Documents\aatree\aautil>boot test-it Writing clj_test\suite.cljs... Writing output.cljs.edn... Compiling ClojureScript... WARNING: Replacing ClojureScript compiler option :main with automatically set value. ò output.js Running cljs tests... ERROR: doo was not loaded from the compiled script. Make sure you start your tests using doo-tests or doo-all-tests and that you include that file in your build C:\Users\Bill\Documents\aatree\aautil>

juhoteperi16:01:34

With applications you would use (cljs) to compile the application and then (test-cljs) to compile and run tests

laforge4916:01:55

just want to test a library, both cljs and clj

laforge4916:01:05

both defined using cljc

juhoteperi16:01:09

Not sure if that's Windows problem, I see Ran 0 tests containing 0 assertions. 0 failures, 0 errors

juhoteperi16:01:39

Then you use test-cljs and run-tests tasks

dajana17:01:34

Hi guys, now I have my :compiler-options in resources/public/js/main.cljs.edn and main.cljs.edn looks like

{:require [something.core]
 :init-fns [something.core/main]                                                                                                                                                     
 :compiler-options {:output-to "resources/public/js/compiled/something.js"
                    :output-dir "resources/public/js/compiled/out"
                    :asset-path "js/compiled/out"
                    :main "something.core"
                    :closure-defines {"goog.DEBUG" false}
                    :source-map :true
                    :source-map-timestamp true}}                                                                                                                                     
and my task
(deftask dev
  "Start the dev env..."
  []
  (set-env! :source-paths #{"src/clj" "src/cljs” “resources/public"})
  (comp (serve :dir "resources/public")
        (watch)
        (speak)
        (reload :on-jsload 'something.core/main)
        (cljs-repl)
        (cljs :ids #{"js/main"} :optimizations :none)
        ))
But ClojureScript is still compiled into target with warnings
WARNING: Replacing ClojureScript compiler option :output-dir with automatically set value.
WARNING: Replacing ClojureScript compiler option :output-to with automatically set value.
WARNING: Replacing ClojureScript compiler option :main with automatically set value.
Any ideas what I am doing wrong?

juhoteperi17:01:15

@dajana: You can't use those options with boot-cljs, they are always automatically determined based on location of .cljs.edn file inside fileset

jaredly17:01:51

does boot-cljs not respect the target task? it doesn’t look like it’s putting things in the right place

dajana17:01:39

Boot compiles ClojureScript into target and I want to compile it into resources

dajana17:01:48

How should I do this?

juhoteperi17:01:07

You should not compile it into resources, it doesn't make any sense with Boot

juhoteperi17:01:08

Unlike with Lein, in Boot the tasks manage temporary files and classpath themselves so you don't need to manually set up paths so that the resulting files would be available in classpath

juhoteperi17:01:11

It is done automatically

juhoteperi17:01:30

JS files created by cljs task are available in classpath and you can serve the files from there

micha17:01:00

i would start with no options to the cljs task, it will build your thing

juhoteperi17:01:05

This is probably better explained in wiki and some tutorials

micha17:01:23

you shouldn't need to configure it very much, if at all

micha17:01:32

it has options for optimization level etc

micha17:01:46

those are the things you will want to tinker with

juhoteperi17:01:49

dajana: Yeah remove most of compiler-options, remove resources/public from source-paths and remove :dir option from serve task

jaredly17:01:06

if I do “BOOT_EMIT_TARGET=no” then the compiled js doens’t get emitted at all, and if I don’t do it, then the compiled js ends up in target, even though I have a target task that indicates that everything should go into the build directory

juhoteperi17:01:14

serve task will serve files from classpath if you don't provide it with dir option

micha17:01:31

@jaredly: did you put the target task after cljs etc?

jaredly17:01:41

I thought it went first ://

micha17:01:53

the target task only emits things it gets in the fileset that is passed to it by the previous task

micha17:01:01

it can't see anything else

jaredly17:01:04

ahhh now I see

jaredly17:01:18

I thought other tasks emitted stuff, and the target just told them where

micha17:01:27

no, that's a key thing about boot

micha17:01:41

tasks don't know about any named places in the filesystem

jaredly17:01:48

I mean I understand the whole filesets thing

micha17:01:53

except the target task, of course

dajana17:01:28

Yes, I finally understand, thank guys, you helped me a lot simple_smile

juhoteperi17:01:54

@dajana: You might want to use :resource-root "public" option with serve, so that contents of public prefix in classpath are server in web server root

richiardiandrea17:01:23

so @micha @juhoteperi would it make sense to (comp (serve :dir "somedir") (target :dir "somedir") .... ?

juhoteperi17:01:55

and if you have resources folder and you want to serve some static files from it, you should use have resources in :resource-paths, this way the files will be correctly under public folder in classpath

juhoteperi17:01:46

@micha: Boot was supposed to disable colors on Windows? I'm still seeing plenty garbage

micha17:01:07

@juhoteperi: where are you seeing garbage?

micha17:01:18

it was supposed to disable colors on windows

juhoteperi17:01:30

At least when downloading deps

micha17:01:50

hm, that's a regression

juhoteperi17:01:51

Yeah no color codes on log messages but they are present in aether(?) messages

micha17:01:08

a bug 😞

micha17:01:20

that's happening at a lower level maybe

micha17:01:43

oh right i know what happened

micha17:01:55

can you make an issue?

micha17:01:44

@juhoteperi: can you try 2.6.0-SNAPSHOT on your windows machine please?

micha17:01:04

it's deployed

juhoteperi17:01:08

ha, not sure how to set env variable on windows

micha17:01:23

maybe a boot.properties file

micha17:01:29

in the cwd

juhoteperi17:01:47

argh, how do I edit an file, no vi

micha17:01:05

notepad.exe i love it

micha17:01:28

reminds me of editing robot battle scripts on the 486 or whatever

juhoteperi17:01:30

I need to install bazillion apps to test boot-cljs-test on windows

juhoteperi17:01:42

java, boot, git, node, phantomjs...

micha17:01:05

chocolatey nuget, do you use it?

richiardiandrea17:01:19

about this, it would be great to have a docker with all these things in it

micha17:01:22

it's like homebrew for windows i think

juhoteperi17:01:42

I know. I use Windows so rarely that I haven't tried it.

alandipert17:01:02

@juhoteperi: what's your address? i can mail you a slackware dvd

micha17:01:22

dvd? what's that?

alandipert17:01:27

sorry, set of floppies

micha17:01:37

will that fit in my multimedia compact disk slot?

juhoteperi17:01:47

Will you send me a dvd/cd/floppy drive also?

richiardiandrea17:01:29

I just refurbished the old drive I had to remove from my laptop to make space for an hd 😄 2$ and a sata 7/13 pin to usb cable ! 😄 😄

juhoteperi17:01:44

If I just find out how to remove files so I can see what happens when it downloads deps again...

juhoteperi17:01:14

@micha: 2.6.0-SNAPSHOT, no change

micha17:01:01

but snapshot sees your files when you use the watch task, etc? otherwise not terribly broken compared to 2.5.5?

micha17:01:21

i think i can fix the different device error on windows also

micha17:01:32

by not setting files in the fileset to readonly

micha17:01:04

most things don't respect that anyway

juhoteperi17:01:15

@micha: I don't get that far yet that I could see if watch works 😄 boot-less seems to be broken in Windows

richiardiandrea18:01:02

guys I was enhancing the boot doc and I want some help about add-cached* functions, what does cached exactly means here?

micha18:01:27

@richiardiandrea: that's currently used by the uber task

micha18:01:46

so the uber task unzips jars into the fileset

micha18:01:26

for efficiency it would be good to cache the unzipped files in a way that they can be added to the fileset again later without needing to look in the jar or extract anything

micha18:01:48

and the contents of jars can be cached because jars are, ingeneral, immutable artifacts

micha18:01:45

so if you look in the uber task source you'll see it doing add-cached-resource

micha18:01:51

which takes the following args: fileset, cache-key, seedfn, and the normal :include, :exclude, and :mergers kwargs

micha18:01:38

this will look in boot's immutable cache area for the cache key provided

micha18:01:49

uber sets the cache key to be the md5 hash of the jar file

micha18:01:04

if the cache is populated then it zips the cached things into the fileset

micha18:01:21

a very efficient operation because all the work is already done

micha18:01:51

if there cache is empty for that key then it calls the seedfn to populate the cache

micha18:01:15

the seedfn will be called with one argument: the directory in which to write its files

richiardiandrea18:01:21

clever, I think I will need it too in my task

richiardiandrea18:01:21

so add-cached-source: > "Same as add-source but tries to store files in the cache area for more efficient retrieval. Refer to add-source for the accepted options"

micha18:01:53

well i think caching is tricky

micha18:01:01

and needs to be explained fully

micha18:01:15

i don't want it to seem like it's free to do it

micha18:01:21

because it's a tradeoff

micha18:01:58

like if you don't choose a good cache key there will be all kinds of problems that are difficult to debug

micha18:01:27

also the cache space isn't currently garbage collected

richiardiandrea18:01:14

ok, I can leave FIXME as well for now, just change the add-*

richiardiandrea18:01:53

@micha: for with-eval-in I wrote: > Note2: The macro returned value will be nil unless it is printable/readable. For instance, returning File objects will not work as they are not printable/readable by Clojure.

richiardiandrea18:01:04

Is this true also for with-call-in ?

micha18:01:19

hm let me check

micha18:01:12

yes also true for with-call-in

alandipert18:01:19

@richiardiandrea: you rule for working on docs btw, metal

richiardiandrea18:01:22

ahahha thanks, it is the minimum one can do for such helping people 😄

richiardiandrea19:01:45

A question if you guys know, what scope is used by default when you include a package in lein :dependencies ?

micha19:01:11

compile is the default

richiardiandrea19:01:48

In clojurescript for instance I see [com.google.javascript/closure-compiler "v20151216"] which make me wonder...

richiardiandrea20:01:40

so if I understood correctly

(core/add-cached-resource
                       xs (digest/md5 jar) (partial pod/unpack-jar jar)
                       :include include :exclude exclude :mergers merge)
first unpacks then applies include and exclude on the java.io.File right? But on what does it match? getAbsolutePath?

richiardiandrea20:01:19

my problem is, I am doing:

(comp
   ;; see boot's uber task
   (built-in/uber "-j" as-jars "-i" clj-inclusions "-e" clj-exclusions)
   (built-in/show "-f"))
but my show just shows the content of src, maybe not all the fileset content is shown?

richiardiandrea20:01:25

so I remove -i and -e it actually works, meaning that I my regex are never successful

richiardiandrea21:01:28

-i does not seem to work here...I am going into digging mode

richiardiandrea21:01:20

works from the command line...digging digging

micha21:01:00

@richiardiandrea: add-cached-* does't unpack anything

micha21:01:10

it's a general purpose function

micha21:01:26

oh sorry, i see what you mean

micha21:01:41

xs there is the fileset

micha21:01:58

(digest/md5 jar) creates a md5 hash of the jar file as a string

micha21:01:02

that's the cache key

micha21:01:18

the next argument evaluates to a function of one argument

micha21:01:50

(fn [destination-dir] (pod/unpack-jar jar destination-dir))

richiardiandrea21:01:58

yes, I am following the code, it is very readable, only (built-in/uber "-i" #{#"goog\/.*\.js$"}) does not work for me at the moment

micha21:01:15

why are you passing string args?

richiardiandrea21:01:15

but boot uber -i 'goog\/.*\.js$' works

micha21:01:31

if you use string args then all arguments need to be strings

richiardiandrea21:01:55

that's the problem then, let me try again

micha21:01:00

(built-in/uber "-i" "goog\\/.*\\.js")

richiardiandrea21:01:30

what if I want to pass in a set?

micha21:01:43

why use the string arguments in there though?

richiardiandrea21:01:14

well because I am a boot nOOb

micha21:01:19

(built-in/uber :include #{#"goog/.*\.js"})

micha21:01:43

you can do (doc uber) in the repl to see the clj options

micha21:01:56

they basically correspond to the long cli options

micha21:01:17

so like uber --include foo is the same as (uber :include #{#"foo"})

richiardiandrea21:01:27

(BTW I don't know why but doc does not work in my boot repl)

micha21:01:41

are you in the boot.user namespace?

richiardiandrea21:01:50

(but I will debug another time)

micha21:01:54

if not then you will need to do (use 'clojure.repl)

micha21:01:15

or, alternatively (clojure.repl/doc built-in/uber)

micha21:01:48

uber --include foo --include bar is same as (uber :include #{#"foo" #"bar"})

richiardiandrea21:01:10

as usual, thanks

micha21:01:17

sure, np!