Fork me on GitHub
#boot
<
2016-07-26
>
kenny01:07:25

Is there something special you need to do in order to get boot cljs to work with the latest cljs? I am trying to mess around with spec in cljs, however, it seems like boot thinks I am using an old version of cljs or something as I get this error:

ERROR: Wrong number of args (1) passed to: spec/coll-of

Calling spec like this:
(ns myns.core
(:require [cljs.spec :as s]))

(s/def ::test (s/coll-of int?))

Correct me if I am wrong but I believe the Clojurescript port of spec is up to date with Clojure so this call to spec should work (and it does in Clojure).

ska09:07:21

Just wanted to shout out a huge thank you, boot for not having any stale files. Prevented be from accidentally copying an old version to a test server twice in the past few days. Otherwise, would have made me hunt for errors and kick myself very hard on finding it. 🙂

martinklepsch10:07:17

@kenny: What version of CLJS? 93 is definitely not up to date with Clojure

lmergen10:07:57

so, having recently switched to Boot, I have the strong feeling that boot is a bit slower than lein, is that correct ?

martinklepsch10:07:11

@lmergen: what use-case? Have you made sure all other parameters like JVM options are configured the same?

lmergen10:07:09

it's a web service, it seems i have quite a few more dependencies now

lmergen10:07:34

so it might not be a fair comparison

martinklepsch10:07:19

@lmergen: generally performance is comparable. Boot's filesets are an abstraction Lein doesn't have so there might be a minimal overhead there (although there have been some optimizations by now)

lmergen10:07:27

ok, that's good to know

lmergen10:07:44

then i can probably get quite a few more performance gains

lmergen12:07:48

can anyone point me to some project that properly generates an uberjar ready for deployment ?

lmergen12:07:08

i'm having annoying problem with manifest signatures not matching main

lmergen12:07:14

and think it's just a configuration issue

lmergen12:07:36

however, all the example projects i can find are either a library or a clojurescript project which uses boot serve

lmergen12:07:13

right, so apparently there was a compilation error in my main function, and since it wasn't AOT'ed.... there was an exception as soon as i loaded the JAR, which causes the jvm to report an 'incompatible signature'

lmergen13:07:28

right, apparently there are many examples from danielsz, who uses system-boot https://github.com/danielsz/system-advanced-example

martinklepsch13:07:54

@lmergen: what are you stuck with right now?

lmergen13:07:27

okay, so, what i have discovered so far is that: - boot-ubermain doesn't really work - bootlaces' jar doesn't work - in the end, defining a (comp (aot :all true) (uber :as-jars true) (jar) (target)) generates a jar that seems to, well, give me errors as well

martinklepsch13:07:55

Ok so let's get it to work without any extra stuff like bootlaces/ubermain

lmergen13:07:22

right, that was my first intention

martinklepsch13:07:40

1. Don't use :as-jars — it's only meant for when you have special classloaders like servlet containers. From boot uber --help:

The --as-jars option pulls in dependency jars without exploding them such
that the jarfiles themselves are copied into the fileset. When using the
--as-jars option you need a special classloader like a servlet container
(e.g. Tomcat, Jetty) that will add the jars to the application classloader.


martinklepsch13:07:40

2. Consider not aot'ing all namespaces, usually AOTing the namespace that has -main is enough.

martinklepsch13:07:02

(This makes startup slower of course but you can get back to more AOT once you got the basics working 🙂 )

martinklepsch13:07:57

You can test without the second step first and see if that works — certainly possible

lmergen13:07:14

that will save some time getting this working

lmergen13:07:21

i figured that AOT was maybe required

martinklepsch13:07:46

Well AOT is required. Just not of all namespaces.

lmergen13:07:21

btw, you can assume that my code is basically this: https://github.com/juxt/edge

lmergen13:07:20

so, to make sure i'm following your suggestions, right now i just cloned that repo, and am executing: boot aot uber jar target

martinklepsch13:07:29

@lmergen: ok, and how's that working out? 🙂

lmergen13:07:44

i just realized that that project doesn't have a main... 🙂

lmergen13:07:01

which is where my question came from, what's the recommended approach to deploy yada apps

martinklepsch13:07:35

lmergen13:07:14

ok, so, this is the error i get:

$java -jar target/project.jar java.lang.SecurityException: Invalid signature file digest for Manifest main attributes  lmergen13:07:42 and my main simply looks like this: (defn -main [& args] (println "victory!"))  martinklepsch13:07:23 @lmergen: ah, you'll need to supply a main-ns to jar lmergen13:07:50 ohhh, geez lmergen13:07:03 i supplied a :main martinklepsch13:07:07 (jar :main 'ns.that.has.main) sekao13:07:17 hello all. i can’t quite figure out how to do the equivalent of lein install for a clojurescript library. so far i’ve tried boot pom jar install but that installs an empty jar. how do i include my sources? lmergen13:07:36 i have this: (jar :main 'com.autheos.api.main)  martinklepsch13:07:02 @sekao: use :resource-paths instead of :source-paths (short answer) lmergen13:07:09 be aware, this is module called main.clj, like: (ns com.autheos.api.main  martinklepsch13:07:22 @sekao: long answer is that files in source-paths don't have the "output" role (but files in resource-paths have) martinklepsch13:07:08 @lmergen: does that ns form have (:gen-class)? sekao13:07:25 @martinklepsch: thanks 🙂 that worked lmergen13:07:45 yep, it looks like this: (ns com.autheos.api.main (:gen-class) (:require [com.stuartsierra.component :as component] [com.autheos.api.system :refer [new-system]])) (defn -main [& args] (println "victory!")) lmergen13:07:59 that is the entire source of that module right now lmergen13:07:32 so, needless to say, i'm confused martinklepsch14:07:10 @lmergen: any chance your code is public? lmergen14:07:12 what i think is really inetersting, though, is that i see this in the target/META-INF/MANIFEST.MF: Manifest-Version: 1.0 Built-By: ptaoussanis Created-By: Leiningen 2.5.3 Build-Jdk: 1.8.0_60 Main-Class: clojure.main  martinklepsch14:07:58 @lmergen: can you please once again paste the command line invocation you're running + error? lmergen14:07:03 build task: (deftask build [] (comp (aot) (uber) (jar :main 'com.autheos.api.main) (target))) error: $ java -jar target/project.jar
java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)

alandipert14:07:06

@lmergen: my theory is that MANIFEST.MF file is coming from one of your dependencies, maybe sift it out before jar?

lmergen14:07:54

let me test that

alandipert14:07:43

(sift :include #"META-INF/.*" :invert true) would be the ticket

lmergen14:07:03

what i think is weird, is this: https://github.com/boot-clj/boot/blob/master/doc/boot.task.built-in.md#uber > The --exclude option default is: > > #{ #"(?i)^META-INF/INDEX.LIST$" > #"(?i)^META-INF/[^/]*\.(MF|SF|RSA|DSA)$" }

lmergen14:07:03

perhaps it needs to be set at both uber and jar ?

lmergen14:07:03

oh! i have an idea what this might be

lmergen14:07:10

i'm running under windows

lmergen14:07:39

could it be that the pattern match for META-INF/... doesn't work, and should rather be META-INF\\... ?

alandipert14:07:23

are you on win10? i think it doesn't matter

lmergen14:07:41

i'm testing right now

alandipert14:07:42

btw which com.taoensso dep do you have?

lmergen14:07:50

(uber :exclude #{#"(?i)^META-INF\\INDEX.LIST\$"
#"(?i)^META-INF\$^/]*\.(MF|SF|RSA|DSA)"})  lmergen14:07:55 timbre and tufte alandipert14:07:06 versions? i can try and reproduce with them lmergen14:07:28 [com.taoensso/timbre "4.7.0"] [com.taoensso/tufte "1.0.0-RC2"]  alandipert14:07:23 @lmergen: can you try with a jar task like (jar :file "project.jar" :main 'com.autheos.api.main)? alandipert14:07:31 btw if you didn't know, a quick way to dev things like thsi is to boot repl and then (load-file "build.boot") every time you make a change alandipert14:07:38 then you can do e.g. (boot (build)) at the repl lmergen14:07:43 same issue, this was the task pipeline: (comp (aot) (uber) (jar :file "project.jar" :main 'com.autheos.api.main) (target)))  lmergen14:07:57 ok, this makes no sense lmergen14:07:09 target/project.clj is the source file of timbre 4.7.0 😕 lmergen14:07:41 time to inspect whether target/project.jar is containing my own code at all martinklepsch14:07:37 @lmergen: do you have your src dir in :resource-paths? alandipert14:07:20 maybe doesn't matter since you aot and the resulting .class files should be output role? alandipert14:07:32 i was testing with this and the result worked: (set-env! :resource-paths #{"src"} :dependencies '[[org.clojure/clojure "1.7.0"] [com.taoensso/timbre "4.7.0"] [com.taoensso/tufte "1.0.0-RC2"]] ) (deftask build [] (comp (aot :namespace '#{main}) (uber) (jar :file "project.jar" :main 'main) (target) ))  alandipert14:07:49 where src/main.clj is hello world alandipert14:07:29 if you can reduce this to a project that yuo can share and make ticket, that would be ideal lmergen14:07:28 i am closer to knowing what's wrong lmergen14:07:40 my own files are missing from target/project.jar lmergen14:07:02 as in, it seems like it's not compiling anything alandipert14:07:35 in your aot maybe try (aot :all true)? alandipert14:07:43 i don't think in your code it's aot-ing anything alandipert14:07:56 and since your .clj is not on resource-paths, the clj files won't make it to the jar lmergen14:07:20 that... makes no sense lmergen14:07:36 now that i think about it, it does alandipert14:07:42 yeah maybe aot should print a warning if it doesn't do antyhing lmergen14:07:59 i'll raise an issue on github anyway to start a discussion about this alandipert14:07:17 excellent, thanks! lmergen14:07:40 right, so, aot'ing everything, they are indeed in the jar lmergen14:07:23 but it still cannot find the main reference, it says lmergen14:07:04 ah wait, let me combine this with the updated uber manifest filter alandipert14:07:40 would want to verify that there's a target/com/autheos/api/main.class file also alandipert14:07:09 and it has a -main function alandipert14:07:10 another test you can do is cd target/ && java -cp . com.autheos.api.main lmergen14:07:10 yes, it has, i see main_main.class alandipert14:07:40 hm, that's an inner class - you should see a main.class ska14:07:17 Would it help if I pasted my working uberjar snippet from by build.boot or are you already way beyond that? alandipert14:07:32 @lmergen: do you have (:gen-class) in your ns decl for main? you need it lmergen14:07:53 this project uberjar's fine with lein, for what its worth lmergen14:07:59 so it must be some boot configuration issue ska14:07:16 @lmergen: yes to @alandipert s question or mine? lmergen14:07:43 honestly, i think at this point the problem is my META-INF/MANIFEST.MF lmergen14:07:25 which pretty much is the reason for the jar not launching lmergen14:07:17 i do believe this to be an issue with my environment (MINGW64 under Win10) alandipert14:07:57 it could be, but we rarely hear about problems on win10 these days lmergen14:07:02 java -cp . com.autheos.api.main works, btw alandipert14:07:04 is the problem still the java.lang.SecurityException ? lmergen14:07:41 yes, which is because the manifest doesn't match the .jar (which makes sense, the .jar is my own project, but its manifest is Timbre's) lmergen15:07:05 so i think that's because uber's exclude filters assume a unix path name alandipert15:07:23 i see, yes i buy the theory alandipert15:07:28 oh did changing to windows style path fix it? micha15:07:05 "uberjar creation", awesome phrase lmergen15:07:38 @alandipert: i'm working on getting the include path right lmergen15:07:44 ehr, exclude pattern i mean ska15:07:32 @micha that's probably just how Germans speak English 😕 lmergen15:07:25 it works now! micha15:07:26 ah, that explains why it sounds cool 🙂 lmergen15:07:36 @alandipert: thanks a lot for your time lmergen15:07:39 (and the rest too) alandipert15:07:44 no prob! 🍾 alandipert15:07:13 this would be a good thing to add to https://github.com/boot-clj/boot/wiki/Running-on-Windows if yuo have a moment martinklepsch15:07:07 Is this something that could be fixed by using [\/|\$ or something in these regexes?

micha15:07:43

there's a ticket for something similar, i believe

alandipert15:07:07

iirc the regexes were extracted originally from lein code, maybe they were "cleaned up" a little too much

micha15:07:49

i'm hesitant to make platform dependent regexes in boot itself

micha15:07:03

because then you need platform dependent regexes in your build.boot too

micha15:07:12

which exposes the problem to the end user

micha15:07:30

there must be a way to deal with paths in a uniform way internally

lmergen15:07:41

i would expect the jvm to normalize this ?

micha15:07:12

unfortunately it doesn't, really, but i think we could make it do so

micha15:07:01

like new File("foo\\bar\\baz").getPath() returns backslashes

lmergen15:07:05

it's interesting, there probably are quite a few of these cases

lmergen15:07:14

i ran into this problem with yada as well, two weeks ago

lmergen15:07:28

it doesn't handle %20 in path names

lmergen15:07:52

so yeah, i should move away from my windows machine

micha15:07:14

yeah mapping file:// uris to http:// uris is another difficult problem

micha15:07:05

we could make different regexes internally in boot for different platforms

alandipert15:07:13

lmergen: what about using the bash subsystem? is that possible in practice yet?

micha15:07:18

but then if the user uses regexes they'd need to do that too

lmergen15:07:09

@alandipert: well, i think i will only be creating more problems rather than less

micha15:07:26

maybe we make a PathRegex type that can perform a transformation?

micha15:07:41

java nio may already have such a thing

alandipert15:07:44

i figured as much but i didn't want to damper your excitement if you had any 😉

alandipert15:07:51

people seem super excited about it

alandipert15:07:07

and it seems weird enough to maybe be good, i dunno

micha15:07:26

i wonder if this normalizes the slashes

micha15:07:04

nm it doesn't seem to

micha15:07:39

> All other characters match themselves in an implementation dependent manner. This includes characters representing any name-separators.

richiardiandrea15:07:39

A question, thinking about that cider patch that needs some code to be executed at boot init time...what is the best place to evaluate? it should be inside the core pod if i remember correctly right after the main is launched right?

richiardiandrea15:07:22

The code will be just a require and swap! of middlewares: https://github.com/clojure-emacs/cider-nrepl/pull/358/files

pesterhazy18:07:09

Is there a way to ask boot not to touch target files it knows are unchanged? I see that it touches files (as in this comment https://github.com/mjmeintjes/boot-react-native/issues/57#issuecomment-235339018), which makes a tool that consumes those files (react-native packager) reload them, rather than using the cached versions.

sekao20:07:42

i think this is the second time i unknowingly forked boot on github. i wonder how that keeps happening...

alandipert21:07:44

i think it's cool when you do

borkdude21:07:35

how can I change the color that boot repl outputs as a result?

borkdude21:07:49

with a black background the dark purple is hard to read

micha21:07:33

@borkdude: i think that's the REPLy configuration

micha21:07:29

@pesterhazy: are you sure the mtime of the files is not changed?

micha21:07:42

it does that when something upstream has updated the mtime