This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-24
Channels
- # boot (183)
- # business (3)
- # clojure (65)
- # clojure-argentina (1)
- # clojure-china (1)
- # clojure-conj (2)
- # clojure-japan (2)
- # clojure-russia (5)
- # clojure-ukraine (5)
- # clojurescript (139)
- # community-development (1)
- # core-async (8)
- # core-matrix (1)
- # cursive (7)
- # datomic (2)
- # events (4)
- # hoplon (108)
- # ldnproclodo (1)
- # lein-figwheel (1)
- # liberator (1)
- # off-topic (76)
- # om (37)
- # onyx (12)
- # overtone (1)
- # testing (8)
Hi! I'm a tool to get dependency graphs from Clojure projects and I would like it to be boot compatible. Given a repository I need to get the :source-paths
as as found under set-env!
. For leiningen projects I'm parsing project.clj
with leiningen.core.project/read-raw
. Is there an equivalent function in boot I could call from clojure?
the best way to get dependencies is to look at the pom.xml provided with the project's jar
Hi @micha! I don't want the project's dependencies, I'm sorry if I wasn't clear. I only want the set for :source-paths
I can then feed that into tools.namespaces
to get the dependency graph (how they depend on each other) for the different namespaces
so, from boot I only need that little set under (set-env! :source-paths #{"src/clj" "test/clj"})
@bensu: You probably want to try using (get-env :directories)
(or source-paths) and fallback to java.tools.classpath if boot.core is not available
Hmh, I should have probably read the context
@bensu: read-raw is simply not possible with boot. consider some clojure.read-raw
program that statically analyzes a clojure file and prints a map of all things it will do
the tasks run on the fileset, which contains files from those dirs, but the dirs are not known by anything in boot
another issue is that one boot program might build a number of different things in the same "project"
@bensu: I think ideally your program could be wrapped in a boot task. Then you can allow users to add it to their tasks and be (mostly) sure that all the dynamic bits the user expects have happened.
Assuming your program is clojure and takes a set of directories that’s a fairly easy to write task.
it wouldn't help you to consume random repos from github though, because you would need to understand the boot script so you know where to inject your task
@martinklepsch: that wouldn't be desirable. Right now I have a "Paste a github ur;" which has to git clone and then use tools.namespace. Using a boot task and going through that process would imply getting all the dependencies and somehow "running" the project, which I don't want to do.
@micha: that might be a better idea, try to find a jar for the project and ignore boot entirely
@bensu: ah, I assumed it would be something users use directly
in that case using jar’s sounds pretty smart
@martinklepsch: haha, it's funny because it was you who suggested this
what did I suggest? writing a boot task for this?
No, we talked a little about dependency graphs and you said something browser-based would suit you better.
boot will never be amenable to static analysis, because build.boot is a program, not a specification
ahhh! I remember now. What I meant though was to generate the data through some tool and then just visualize it in the browser. Not doing all in the browser/server.
@micha: I’m just toying with building boot with boot — have you experiences running the maven stuff from java directly?
@martinklepsch: not lately
@bensu: I think you can get a pretty good flow with lein plugin + boot task and some semi automated way to get their results into a browser. (e,g, put stuff into users clipboard when done and automatically open website with textarea focused.)
It’s not the flow I’d expect of a commercial product but seems good enough for a fun side project type thing. + you would not need any servers, everything else could just happen in the browser.
I wouldn't want to miss boot projects but figuring out the appropriate jar from the link sounds like a bummer. I'll investigate, maybe it's not
you could also have a server that takes incoming descriptions and renders them then the copy pasting wouldn’t be necessary at all
with a boot task it’s one invocation away: boot -d bensu/viz dep-graph
no installing no anything
boot allows you to add dependencies at runtime via set-env!
(in code) or —dependencies/-d
at the command line. bensu/viz
would be the artifact name on clojars or something
man, i think it was a mistake to merge https://github.com/boot-clj/boot/pull/269
it was really nice to be able to do something like boot -d
and have it print the latest realease
i don't understand why i'd want to operate on a git repo and not a delendency coordinate?
I want to discuss architecture with my teammates and show then how/why things connect to each other inside the application.
and you want to be able to generate a nice looking graph that shows all the modules in the application and how they are related?
yes! the confusion arises from the two uses of "dependency". What I actually want could be better described as a module's graph
yeah and applications don't necessarily have artifacts that are published in some repository like modules do
the visualize task would run after all the build tasks, so it would see the final state of the build environment
this would include all the source files, even ones that were generated dynamically by other tasks during the build that don't even exist in the github repo
it seems like boot is flexible enough to handle that, and even though it dynamically on the first try without installing.
thanks everybody for the help, my take is "there is a much simpler way here" and "build.boot is a program, thus not amenable to static analysis"
i can imagine a show -n
task in boot to analyze the dependencies between namespaces, maybe
probably not but it is trivial: 10 lines of tools.namespace
to implement and then you need to choose how to display it.
yeah it's impossible to statically determine that, i guess, since the dispatch fn can do anything
but if you are a good citizen and your application can handle it, you require B from C to ensure that the multimethod is loaded by the time you want to use it
so it would appear that nothing depends on B, but if you remove B then C will fail with "method not found"
usually the place where multimethods are used doesn't know about where the dispatches were defined
that's right, in many cases it's not clear where do things come from. My experience is that as the system gets bigger you want to start tracking such things, visualizing helps, even if it's not complete
multimethods are especially tricky, because they're mostly used when things are coming in from outside the type system, or going out of the system
@micha: What do you think about supporting metadata for task options? Like :deprecated flag
^:deprecated K gpg-keyring PATH str "The path to secring.gpg file to use for signing."
would it be hard to replicate mvn install with boot? alternatively we could just move all files in one dir and then invoke maven there via dosh
(target task would be handy there)
we still need to shell out for maven assembly in any case I assume
mvn -q assembly:assembly -DdescriptorId=jar-with-dependencies
makes sense, thanks
@micha: the version.properties file in the base jar, I assume it carries the version information for runtime? Where is that modified?
getting close
no not that one.
the one in boot/base/src/main/resources ….
boot/base/src/main/resources/boot/base/version.properties
public static String
readVersion() throws Exception {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream in = cl.getResourceAsStream("boot/base/version.properties");
Properties p = new Properties();
p.load(in);
return p.getProperty("version"); }
there we go
@micha: ^ it’s a mess but pretty close, bit more cleanup and the exe/sh stuff and it’s done
Does it support watch? 😄
I'm quite fed up with running make while testing gpg stuff
@juhoteperi: yes you can certainly build sublibs with watch now
But probably not all libs with one boot
… or in the near future to be precise 😉
@juhoteperi: I think this could also work — why do you think it wouldn't
@martinklepsch: Because task for each lib is changing source-paths etc.
@juhoteperi: true but I’m thinking you can "reset the fileset” before each of them
ok, good night will finish this tomorrow & then we can do some testing