This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-04
Channels
- # bangalore-clj (3)
- # beginners (23)
- # boot (89)
- # cider (11)
- # cljs-dev (22)
- # cljsjs (5)
- # cljsrn (21)
- # clojure (141)
- # clojure-android (1)
- # clojure-berlin (1)
- # clojure-greece (1)
- # clojure-italy (13)
- # clojure-mke (2)
- # clojure-nl (8)
- # clojure-norway (5)
- # clojure-russia (22)
- # clojure-sg (4)
- # clojure-spec (38)
- # clojure-uk (109)
- # clojurescript (150)
- # consulting (4)
- # core-async (7)
- # cursive (13)
- # datascript (8)
- # datomic (72)
- # dirac (185)
- # emacs (5)
- # figwheel (2)
- # flambo (1)
- # hoplon (13)
- # immutant (6)
- # lambdaisland (7)
- # lumo (46)
- # off-topic (13)
- # om (4)
- # onyx (1)
- # pedestal (1)
- # re-frame (68)
- # reagent (15)
- # rum (16)
- # slack-help (4)
- # spacemacs (22)
- # specter (3)
- # vim (10)
- # yada (28)
@micha I found the problem with symlinks I believe!
oh guess not… hmmm seems to be a problem with the visitor
here is the full trace stack
@micha @alandipert fixed symbolic link issue! https://github.com/boot-clj/boot/pull/610
I'm running into an issue reloading files in Cursive using Boot: https://github.com/cursive-ide/cursive/issues/1706#issuecomment-299082525
What I suspect is happening is that Cursive is saving the files to disk, and then running a clojure.tools.namespace/reload
which runs against the files in the bootcache
sometimes if I'm very fast, the files haven't been synced to the bootcache, and I get errors from partial files (from a previous cache) being reloaded
Two questions: 1. Is this a plausible explanation 2. Is there something I/Cursive could do to tell when Boot is synced and up to date?
Perhaps a blocking call in the REPL to boot to force a file sync?
Possibly boot.core/sync-user-dirs!
?
@danielcompton that seems right
I probably want a variant with util/with-semaphore
instead of util/with-semaphore-noblock
, but this is probably close enough for REPL work
(sleep 500)
😛 😄
@danielcompton I believe your hypothesis is correct.
Hi. I found task is for modify a fileset mainly. Is it possible to create a task which will extract some information and pass the value into next task? How can I do that. I thought either about setting up additional meta of the fileset or keep the value in (atom x). I guess there in no other context stuff apart fileset.
using an atom is not as good because then you accumulate state by mutation rather than via immutable fileset data
@berrysoup re: the anonymous task yes, you can use the boot.core/task
form
@micha but that was stupid question. I just need to have access to TempFileSet ....
i guess there is just no need for it, since you can do (fn [next-task] (fn [fileset] ... (next-task ...)))
ah yes, the with-pass-thru
just eliminates some boilerplate when you're doing a common pattern:
(fn [next-task]
(fn [fileset]
(.. do something here for side effects only ..)
(next-task fileset)))
full code for that is: (deftask build-sources "Build sources jar file"
[]
(comp
(sift :add-resource ["src/"])
(jar :file (format "%s-%s-sources.jar"
(str (name (get-env :project)))
(fn [nv] (core/with-pass-thru fs (apply find-version [nv fs]))) [version-ns]))
(target)))
there is with-pre-wrap
also, which is when you want the body expressions to return a new fileset to pass on to the next tasks
this wiki page may be useful https://github.com/boot-clj/boot/wiki/Tasks#pre-and-post-tasks
(jar :file (format "%s-%s-sources.jar"
(str (name (get-env :project)))
(core/with-pass-thru fs (:version-sem (meta fs)))))
the arguments to that function are evaluated once only, when the jar task function is called
The issue is I run task which keep some value in the file system metadata and now I need to get it back because I keeps a version string which should be put into jar name. 😉
And the version is taken not from pom as it is in the original jar
code but in dedicated namespace.
(comp
(jar :file "project.jar")
(with-pre-wrap fs
(let [{:keys [version-sem project]} (meta fs)]
(mv fs "project.jar" (format "%s-%s-sources.jar" project version-sem)))))
the issue you are having stems from the fact that tasks are created before they are composed together
because those arguments are evaluated only once when the jar task middleware is created, and before it's composed with any other tasks and before any fileset exists
the way i did it above does the renaming in the task middleware, so it has access to a fileset
@micha what is the proper way to use alter-var-root
to replace a task with another one?
boot.user=> (doc replace-task!)
-------------------------
boot.core/replace-task!
([& replacements])
Macro
Given a number of binding form and function pairs, this macro alters the
root bindings of task vars, replacing their values with the given functions.
Example:
(replace-task!
[r repl] (fn [& xs] (apply r :port 12345 xs))
[j jar] (fn [& xs] (apply j :manifest {"howdy" "world"} xs)))
boot.user=> (source replace-task!)
(defmacro replace-task!
"Given a number of binding form and function pairs, this macro alters the
root bindings of task vars, replacing their values with the given functions.
Example:
(replace-task!
[r repl] (fn [& xs] (apply r :port 12345 xs))
[j jar] (fn [& xs] (apply j :manifest {\"howdy\" \"world\"} xs)))"
[& replacements]
`(do ~@(for [[[bind task] expr] (partition 2 replacements)]
`(alter-var-root (var ~task) (fn [~bind] ~expr)))))
oh cool! thats so simple 😛
I have a boot task whose functionality and options I'd like to make available in -main. -main is already defined using defclifn and has a few additional cli elements. How can I best do this?
That will certainly work but was hoping for some destruct/conj magic to prevent the inevitable conflicting copies. Thanks for giving it a think.