Fork me on GitHub
#boot
<
2016-07-21
>
timothypratley02:07:04

Anyone have a hint for me on why boot.cljs.main is missing? (or what it is)

devcards.html:16 goog.require could not find: boot.cljs.main772goog.logToConsole_ @ base.js:639goog.require @ base.js:679(anonymous function) @ devcards.html:16
devcards.html:16 Uncaught Error: goog.require could not find: boot.cljs.main772goog.require @ base.js:681(anonymous function) @ devcards.html:16
Trying to follow @jgdavey https://github.com/hashrocket/boot_devcards_example, but I'm missing some important step it seems. My build.boot is here: https://github.com/timothypratley/voterx/blob/master/build.boot

timothypratley02:07:34

Hmmm specifying a different asset path {:asset-path "js/devcards.out"} seemed to do the trick.

richiardiandrea02:07:11

Yes the file devcards.cljs.edn gives location and name to your .out folder

richiardiandrea02:07:27

Nice website btw !

timothypratley03:07:40

thanks 🙂

ska07:07:22

Good morning, boot 🙂 May I ask yet another question?

martinklepsch07:07:41

morning 👋 🙂

ska07:07:18

In my build.boot I have all the version information defined. I would like to be able to access it at runtime and wonder what the best practice is for that.

ska07:07:43

Is it better to have a version.clj somewhere in src and require it in my build.boot?

martinklepsch07:07:50

write a version.properties file to the classpath

ska07:07:19

Ugh. Another format? This is unexpected.

martinklepsch07:07:25

either via a boot task or you can also put it there by hand and read from it when setting up pom task

ska07:07:36

How would I access it from build.boot? Using env?

martinklepsch07:07:07

you can also use EDN, doesn't really matter I guess

ska07:07:17

Ah, I could write a boot task which /creates/ the properties file? That sounds better, I guess.

ska07:07:22

Any pointers to other projects doing something similar?

martinklepsch07:07:24

(deftask spit-version
  [v version VERSION str "Version string"]
  (with-pre-wrap fs
    (let [d (tmp-dir!)]
      (spit (io/file d "version.edn") (pr-str {:version version}))
      (-> (add-resource fs d) commit!))
@ska: this probably doesn't work but I guess you get the idea

martinklepsch07:07:01

be aware that this is a build step you have to do every time, the file does not stick around as it is not actually added to your resources/ directory

ska07:07:05

Will give it a try. I already have all my project information in my build.boot in a map.

ska07:07:56

Hm, OTOH, I already find the pom.properties for my own module in the uberjar. Maybe that is already sufficient?

martinklepsch07:07:11

You can use that as well but make sure you use the right pom.properties file, you might have many via dependencies

martinklepsch07:07:42

I remember using some library that made assumptions about pom.properties and that didn't work out very well 🙂

ska07:07:00

I plan to derive the path of the pom.properties from my own namespace. Currently fighting with classpath in my REPL which is not what I expect 😕

ska08:07:34

Hmm, kinda yucky: Am now accessing the resource "META-INF/maven/[[my-group-id]]/[[my-artifact-id]]/pom.properties" directly, having all of it as a hard-coded string.

ska09:07:13

How would I remove my own clj files from the uberjar? Anything built-in? Or would that be a sift task?

martinklepsch09:07:12

sift would work. How did you add them in the first place? If you used :resource-paths try :source-paths — files in :source-paths don't have the output role, i.e. they won't end up in an artifact

martinklepsch09:07:48

so when you build a regular jar, you usually want them in :resource-paths for uberjar you might want something different.

ska09:07:39

I am building an uberjar and if I don't have :resource-paths set to src the executable JAR can not find the main class.

ska09:07:11

No, all is well now. Changed :resource-paths to just :source-paths and it seems to work the way I want it to.

ska09:07:24

Thanks for your help and patience, @martinklepsch !!

martinklepsch09:07:48

yeah, aot should produce files with output role

ska09:07:03

BTW, the snippet on https://github.com/boot-clj/boot/wiki/Snippets does not work for me: I must put aot before uber as core.async does not compile. It fails with some cljs error message.

martinklepsch09:07:11

@ska: feel free to edit, generally seems sane to me to do AOT before uber

ska09:07:04

Yeah, I only want to AOT my stuff for which I know that it should work. After uber, (aot) would compile all my dependencies, if I understood correctly. How can I be sure that that would work without knowing all those deps.

martinklepsch09:07:38

@ska: if you supply a list of namespaces to the aot task it should only compile those, did you do that?

martinklepsch09:07:51

(it's done like that in the Snippet)

ska09:07:02

Oh, now I see. I have :all true in my call to (aot). So, in that snippet it doesn't make any difference at all.

alandipert14:07:29

@dominicm: interesting, that's an approach i haven't seen yet

dominicm14:07:21

Yeah, I thought so too. I'd like to see a postcss pipeline, I have an upcoming project where I might be able to take some time to build a boot task to handle postcss.

richiardiandrea22:07:20

I am so happy to be a boot-er boot-clj , I learned a lot here 😄

The optional map at the moment has the following keys:
    - name the name used in the logs to identify this process
    - timeout the time that is waited before exiting from parking
              (never ever ever block forever, thanks <@U055HMK9L>)"
  [in-ch proc & [{:keys [name timeout]}]]
  (let [kill-ch (chan)
        timeout (async/timeout (or timeout 10000))]
    (go-loop [] ...