Fork me on GitHub
#boot
<
2017-01-18
>
alandipert04:01:42

guessing you never got it to build šŸ™

cfleming04:01:57

@alandipert No, I didnā€™t.

cfleming04:01:36

My SML knowledge was approximately nil at that point, so it might not be too hard - it involved updating the CM so that it will build with a more recent SML/NJ

cfleming04:01:08

However even if that happens it still doesnā€™t compile all of SML - no functors IIRC.

cfleming04:01:49

I investigated various other options - converting http://SML.NET to emit JVM bytecode rather than IR (probably a largish project) or writing a bytecode backend for Hamlet (probably a big project, and you end up with no interop).

cfleming04:01:30

Depends what you want it for - if you want JVM I assume you want interop, and there arenā€™t many good answers there.

cfleming04:01:35

Is Yeti no good?

cfleming04:01:50

BTW this should probably go in #other-languages

alandipert04:01:54

i still like it, i just continue to hobby around

cfleming04:01:07

@alandipert BTW http://www.ocamljava.org/ in case you havenā€™t seen it.

alandipert04:01:41

interesting, tho i've yet to get into ocaml

richiardiandrea05:01:37

Wow Alan, there is a boot-yeti task? Nice šŸ˜„

richiardiandrea07:01:58

Yeti looks very nice actually, and there is also a js transpiler

limist11:01:49

noob boot question please: When using boot to make an uberjar, is there an equivalent to the leiningen option of :omit-source true ?

martinklepsch11:01:26

@limist you can use sift or just make sure your sources are not in resource-paths

limist12:01:29

@martinklepsch Thanks, know any examples of this use-case (excluding all *.clj sources from the jar) please? And currently, my :resource-paths only has the project's resources dir.

martinklepsch12:01:04

@limist are you using bootlaces?

limist12:01:20

@martinklepsch Yes, got it require'd, but not currently using its build-jar

martinklepsch12:01:39

@limist a call to bootlaces as well I guess?

martinklepsch12:01:13

@limist since you want an uberjar I guess this is an ā€œapplication projectā€?

limist12:01:02

@martinklepsch One call to (bootlaces! +version+)

martinklepsch12:01:19

@limist do you need build-jar?

martinklepsch12:01:53

(usually itā€™s only useful for jars used by other maven-using projects)

martinklepsch12:01:49

So what happens is that build-jar is meant for library code and automatically includes src as resources since thatā€™s where Clojure code is located in the (opinionated) bootlaces setup

martinklepsch12:01:29

if you only build uberjars from this project you may not need it at all can can just remove bootlaces/build-jar/etc

limist12:01:29

@martinklepsch Ah, by those criteria, I don't need build-jar. Just want to keep a deployed jarfile as lean as possible.

martinklepsch12:01:18

So I suggest: try commenting out the call to bootlaces! and check if thatā€™s still covering all your needs. If yes remove it completely.

limist15:01:04

@martinklepsch OK, life without bootlaces! is fine, šŸ™‚ but is there a way to prevent the *.clj source files from being included in the final jar? Not seeing much on the topic in the code, wiki, etc. Thanks again for the help.

geoffs15:01:36

@limist: use the sift task after you compile the cljs and before you build the uberjar.

geoffs15:01:09

Erp, after you AOT compile the clj files

micha16:01:04

@limist there is a :dont-modify-paths? option to bootlaces!

micha16:01:16

that will not add "src" to :resource-paths

richiardiandrea18:01:03

is there a way for a deftask to collect all the args without explicitely declaring them?

richiardiandrea18:01:28

The use case, I have task that is basically calling -main

richiardiandrea18:01:38

and I would like to just pass all args to it

micha18:01:49

there is *opts* and *args* you can try

micha18:01:15

might not be that simple, but maybe...

richiardiandrea18:01:26

(deftask run
  "Run the -main function in some namespace with arguments"
  []
  (comp (init-extractor)
        (with-pass-thru _
          (let [main-ns 'rest-resources-viz.extractor]
            (require main-ns)
            (if-let [f (ns-resolve main-ns '-main)]
              (f *args*)
              (throw (ex-info "No -main method found" {:main-ns main-ns})))))))

richiardiandrea18:01:30

it is simple šŸ˜„

micha18:01:37

i think you want like (apply f (mapcat identity *opts*)) there or something?

micha18:01:09

oh you want to pass positional arguments

micha18:01:28

so you can do boot [ run foo bar baz ]

richiardiandrea18:01:34

yeah, I am trying a couple of things, one thing I cannot do is to override -h for instance

micha18:01:48

and run will get ["foo" "bar" "baz"] in *args*

micha18:01:14

the [ .. ] tells boot how to parse positional parameters

richiardiandrea18:01:31

the problem is that deftask does the parsing before calling the task

micha18:01:57

yeah you want just defn, not deftask

richiardiandrea18:01:58

is there a way to skip parsing or I am hammering stuff in šŸ˜„

micha18:01:22

we could add that though

micha18:01:40

i don't think it's doing anything useful by not accepting that

richiardiandrea18:01:58

you mean skip the parsing?

micha18:01:33

is that not what you want?

richiardiandrea18:01:18

umh it looks like...I am trying on my side too

micha18:01:54

all args must be strings

richiardiandrea18:01:55

here if I try -g for instance, it complains: java.lang.IllegalArgumentException: Unknown option: "-g"

micha18:01:20

ah that's ok

micha18:01:09

you can add the -- in your task

micha18:01:36

it's safe to do:

richiardiandrea18:01:38

ok thanks let's see if I can make it happen, it is more for CI šŸ˜„

richiardiandrea18:01:54

so I need cmd line unfortunately

micha18:01:21

your run task can just add the "--"

richiardiandrea18:01:36

yes no I mean, I cannot do it from the repl

micha18:01:38

(apply f "--" *args*)

micha18:01:53

i just did it from the repl šŸ™‚

richiardiandrea18:01:12

boot extract -- -g / java.lang.IllegalArgumentException: No such task (-g)

richiardiandrea18:01:29

what I mean is that I have to make it work from the cmd line..

richiardiandrea18:01:50

no ok, does not work from the cmd line, it keeps parsing boot -- extract -g Unknown option: "-g"

richiardiandrea18:01:09

maybe a bash script calling the uberjar will be easier

micha18:01:23

like this:

micha18:01:34

boot extract -- -g

richiardiandrea18:01:48

No such task (-g)

micha18:01:56

sorry like this

micha18:01:06

boot [ extract -- -g ]

richiardiandrea18:01:25

wow magic šŸ˜„ it works

micha18:01:34

you need brackets if you will have positional parameters

micha18:01:37

for a task

micha18:01:50

otherwise it will interpret the positional parameters as the next task

micha18:01:01

and the -- is just normal cli usage

micha18:01:16

like cat file |grep -- -v

richiardiandrea18:01:21

boot [ extract -- -h ]
{:o {}, :a ("-h")}
(-h)
{:help true}

Dump resource data to disk.

Usage: program-name [options] action

Options:
  -f, --family-xml FILE-PATH  Dumps an xml with all the families defined
  -g, --graph-edn FILE-PATH   Dumps an edn containing the graph data
  -p, --pretty                Pretty prints the output
  -h, --help                  Prints out the help

richiardiandrea18:01:38

TIL, as usual from you Micha, thanks!

micha18:01:12

whoa, it does the help too

micha18:01:18

it's passing that through also?

richiardiandrea18:01:36

yep, and btw (f *args*) is enough

richiardiandrea18:01:40

(deftask extract
  "Run the -main function in some namespace with arguments"
  []
  (comp (init-extractor)
        (with-pass-thru _
          (let [main-ns 'rest-resources-viz.extractor]
            (require main-ns)
            (if-let [f (ns-resolve main-ns '-main)]
              (f *args*)
              (throw (ex-info "No -main method found" {:main-ns main-ns})))))))

micha18:01:53

interesting

richiardiandrea18:01:46

boot [ extract -- -g data/graph-data2.edn -p ]
(-g data/graph-data2.edn -p)
{:graph-edn data/graph-data2.edn, :pretty true}

vinnyataide23:01:37

sorry for not mentioning my project, I've open-sourced it just to resolve these issues, the address is https://github.com/ViniciusAtaide/presidios-pb/

vinnyataide23:01:04

I try running boot repl