boot-clj / boot Goto Github PK
View Code? Open in Web Editor NEWBuild tooling for Clojure.
Home Page: https://boot-clj.github.io/
License: Eclipse Public License 1.0
Build tooling for Clojure.
Home Page: https://boot-clj.github.io/
License: Eclipse Public License 1.0
Installation on Windows 7 64 bit didn't work.
Steps:
boot -h
Output:
Retrieving boot-2.0.0-pre21.jar from http://clojars.org/repo/
Retrieving clojure-1.6.0.jar from http://repo1.maven.org/maven2/
Retrieving shimdandy-impl-1.0.1.jar from http://clojars.org/repo/
Retrieving pod-2.0.0-pre21.jar from http://clojars.org/repo/
Retrieving core-2.0.0-pre21.jar from http://clojars.org/repo/
Retrieving worker-2.0.0-pre21.jar from http://clojars.org/repo/
Retrieving reply-0.3.4.jar from http://clojars.org/repo/
Retrieving aether-2.0.0-pre21.jar from http://clojars.org/repo/
Retrieving cd-client-0.3.6.jar from http://clojars.org/repo/
Retrieving clj-http-lite-0.2.0.jar from http://clojars.org/repo/
Retrieving drawbridge-0.0.6.jar from http://clojars.org/repo/
Retrieving clj-http-0.3.6.jar from http://clojars.org/repo/
Retrieving ring-core-1.0.2.jar from http://clojars.org/repo/
Retrieving versioneer-0.1.1.jar from http://clojars.org/repo/
Retrieving sjacket-0.1.1.jar from http://clojars.org/repo/
Retrieving parsley-0.9.2.jar from http://clojars.org/repo/
Retrieving clj-jgit-0.8.0.jar from http://clojars.org/repo/
Retrieving clj-yaml-0.4.0.jar from http://clojars.org/repo/
Retrieving clj-pgp-0.5.4.jar from http://clojars.org/repo/
Retrieving byte-streams-0.1.13.jar from http://clojars.org/repo/
Retrieving primitive-math-0.1.3.jar from http://clojars.org/repo/
Retrieving clj-tuple-0.1.5.jar from http://clojars.org/repo/
Retrieving potemkin-0.3.9.jar from http://clojars.org/repo/
Retrieving riddley-0.1.7.jar from http://clojars.org/repo/
Retrieving desiderata-1.0.2.jar from http://clojars.org/repo/
Retrieving pomegranate-0.3.0.jar from http://repo1.maven.org/maven2/
Retrieving plexus-utils-2.0.6.jar from http://repo1.maven.org/maven2/
Retrieving httpmime-4.1.2.jar from http://repo1.maven.org/maven2/
Retrieving jline-2.12.jar from http://repo1.maven.org/maven2/
Retrieving tools.cli-0.3.1.jar from http://repo1.maven.org/maven2/
Retrieving org.eclipse.jgit.java7-3.5.0.201409260305-r.jar from http://repo1.maven.org/maven2/
Retrieving org.eclipse.jgit-3.5.0.201409260305-r.jar from http://repo1.maven.org/maven2/
Retrieving jsch-0.1.50.jar from http://repo1.maven.org/maven2/
Retrieving JavaEWAH-0.7.9.jar from http://repo1.maven.org/maven2/
Retrieving core.memoize-0.5.3.jar from http://repo1.maven.org/maven2/
Retrieving core.cache-0.6.3.jar from http://repo1.maven.org/maven2/
Retrieving data.priority-map-0.0.2.jar from http://repo1.maven.org/maven2/
Retrieving snakeyaml-1.5.jar from http://repo1.maven.org/maven2/
Retrieving jlayer-1.0.1.jar from http://repo1.maven.org/maven2/
Retrieving bcpg-jdk15on-1.51.jar from http://repo1.maven.org/maven2/
Retrieving bcprov-jdk15on-1.51.jar from http://repo1.maven.org/maven2/
Retrieving jna-4.1.0.jar from http://repo1.maven.org/maven2/
Retrieving data.xml-0.0.7.jar from http://repo1.maven.org/maven2/
Retrieving data.zip-0.1.1.jar from http://repo1.maven.org/maven2/
Retrieving tools.namespace-0.2.7.jar from http://repo1.maven.org/maven2/
Exception in thread "main" java.io.IOException: The process cannot access the file because another process has locked a portion of the file
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(Unknown Source)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(Unknown Source)
at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(Unknown Source)
at java.io.ObjectOutputStream.(Unknown Source)
at boot.App.writeCache(App.java:120)
at boot.App.readCache(App.java:131)
at boot.App.main(App.java:300)
java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoft Windows 7 Professional
OS Version: 6.1.7601 Service Pack 1 Build 7601
We should have a task that takes a list of namespaces to AOT compile. Until we do, or #40 is resolved, we don't have a way to create an executable Clojure without leaving boot.
Thanks @whodidthis for reporting the issue. This repo whodidthis/boot-show-u demonstrates the problem.
Lein project [example.checkout "0.1.0-SNAPSHOT"]
installed locally. Boot project has dependency on the Lein project.
build.boot
#!/usr/bin/env boot
(set-env!
:src-paths #{"src"}
:dependencies '[[adzerk/boot-cljs "0.0-2371-25"]
[example.checkout "0.1.0-SNAPSHOT"]])
(require '[adzerk.boot-cljs :refer :all])
(task-options!
pom [:project 'boot-show-u
:version "0.1.0-SNAPSHOT"])
To reproduce the error:
$ boot -V
#https://github.com/boot-clj/boot
#Thu Nov 20 10:21:50 EST 2014
BOOT_CLOJURE_VERSION=1.6.0
BOOT_VERSION=2.0.0-pre24
$ boot show -u
clojure.lang.ExceptionInfo: org.sonatype.aether.resolution.DependencyResolutionException: Failed to collect dependencies for
[#<Dependency adzerk:boot-cljs:jar:RELEASE (compile)> #<Dependency example.checkout:example.checkout:jar:RELEASE (compile)>]
data: {:file
"/var/folders/5m/8zs_v2nx3sz_r3bt_nj9344h0000gn/T/boot.user3825422000268151430.clj",
:line 17}
java.util.concurrent.ExecutionException: org.sonatype.aether.resolution.DependencyResolutionException: Failed to collect dependencies for
[#<Dependency adzerk:boot-cljs:jar:RELEASE (compile)> #<Dependency example.checkout:example.checkout:jar:RELEASE (compile)>]
org.sonatype.aether.resolution.DependencyResolutionException: Failed to collect dependencies for [#<Dependency adzerk:boot-cljs:jar:RELEASE (compile)> #<Depen
dency example.checkout:example.checkout:jar:RELEASE (compile)>]
result: #<DependencyResult [adzerk:boot-cljs:jar:0.0-2371-25 < /Users/micha/.m2/repository (enhanced)]>
org.sonatype.aether.collection.DependencyCollectionException: Failed to collect dependencies for [#<Dependency adzerk:boot-cljs:jar:RELEASE (compile)> #<Depen
dency example.checkout:example.checkout:jar:RELEASE (compile)>]
result: #<CollectResult [adzerk:boot-cljs:jar:0.0-2371-25 (compile)]>
org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for example.checkout:example.checkout:jar:RELEASE
result: #<ArtifactDescriptorResult example.checkout:example.checkout:jar:RELEASE -> []>
org.sonatype.aether.resolution.VersionResolutionException: Failed to resolve version for example.checkout:example.checkout:jar:RELEASE
result: #<VersionResult null @ null>
org.apache.maven.repository.internal.DefaultVersionResolver.resolveVersion DefaultVersionResolver.java: 287
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom DefaultArtifactDescriptorReader.java: 250
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor DefaultArtifactDescriptorReader.java: 186
org.sonatype.aether.impl.internal.DefaultDependencyCollector.process DefaultDependencyCollector.java: 412
org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies DefaultDependencyCollector.java: 240
org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies DefaultRepositorySystem.java: 333
...
cemerick.pomegranate.aether/resolve-dependencies* aether.clj: 720
...
clojure.core/apply core.clj: 624
cemerick.pomegranate.aether/resolve-dependencies aether.clj: 729
...
boot.aether/resolve-dependencies* aether.clj: 73
...
clojure.core/apply core.clj: 624
clojure.core/memoize/fn core.clj: 5846
...
boot.aether/resolve-dependencies aether.clj: 92
...
clojure.core/apply core.clj: 624
boot.pod/eval-fn-call pod.clj: 174
boot.pod/call-in pod.clj: 181
...
boot.pod/call-in pod.clj: 184
boot.pod/call-worker pod.clj: 189
boot.pod/resolve-dependencies pod.clj: 220
boot.pod/outdated pod.clj: 240
...
boot.task.built-in/fn/fn/fn/fn/fn built_in.clj: 113
boot.task.built-in/fn/fn/fn/fn built_in.clj: 109
boot.core/run-tasks core.clj: 327
boot.user/eval134/fn boot.user3825422000268151430.clj: 19
clojure.core/binding-conveyor-fn/fn core.clj: 1910
...
This issue appears to be related to boot -u
and snapshot dependencies that are installed locally. The issue can be worked around by adding the -s
(--snapshots
) option:
$ boot show -us
My dependencies in build.boot look like:
[org.clojure/clojurescript "0.0-2411" :scope "provided"]
[om "0.8.0-beta3" :scope "provided"]
According to the help on the boot show
command:
-u, --updates Print newer releases of outdated dependencies.
However, when I run boot show -u
, I get the following:
[org.clojure/clojurescript "0.0-2411" :scope "provided"]
[om "0.8.0-beta3" :scope "provided"]
In other words, I don't get the newer versions promised by the help text. (This used to work.)
I assume the boot.sh script would change over time.
How are you making sure people update from time to time?
Is that somehow built into boot.sh or should boot be added to
something like homebrew for that kind of stuff?
PS.: I was very sceptic in the first place but I begin to see where and why the approach boot has chosen might be useful. Will play around with it a bit throughout the day :-)
The sift
task should accept a -c
or --chroot
option that performs a transformation on all output files in the fileset, moving them to a different "root" in the fileset. For example, suppose a fileset has the output file foo/bar.x
:
$ boot sift -c asdf/qwer
would produce the file asdf/qwer/foo/bar.x
in the target dir.
This ticket was reported on the Discourse site.
I've been trying to have a look at boot, working through the example detailed http://adzerk.com/blog/2014/11/clojurescript-builds-rebooted/ but I'm having problems getting the watch task to work as expected on OSX - it does not detect any changes to the source files (when running on Ubuntu it works fine).
I'm wondering if this is a known issue, or a problem with my environment and if there are any guidance as to how I can try to debug.
My setup is -
OSX 10.9.5
boot -u
https://github.com/boot-clj/boot
Mon Nov 10 20:32:42 GMT 2014
BOOT_CLOJURE_VERSION=1.6.0
BOOT_VERSION=2.0.0-pre22and tried both-
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Can't seem to get it running under Cygwin. I shall try and illustrate by copy pasting commands from mintty:
$ ls -l boot.sh
-rwxr-xr-x+ 1 Domas None 7012598 Dec 7 21:23 boot.sh
$ boot.sh
Error: Unable to access jarfile /home/Domas/bin/boot.sh
$ java -jar boot.sh -V
#https://github.com/boot-clj/boot
#Mon Dec 08 10:27:04 EET 2014
BOOT_CLOJURE_VERSION=1.6.0
BOOT_VERSION=2.0.0-pre28
Now here comes the crash (?). I will run the repl, but it will not respond to any input, I will ultimately Ctrl-c:
Domas@DomoHP-Win81 ~/bin
$ java -jar boot.sh repl
nREPL server listening: 0.0.0.0:49542
REPL-y 0.3.4, nREPL 0.2.4
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.7.0_71-b14
Exit: Control+D or (exit) or (quit)
Commands: (user/help)
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
(user/clojuredocs name-here)
(user/clojuredocs "ns-here" "name-here")
boot.user=> (+ 2 2)
$ (+ 2 2)
-bash: +: command not found
Some additional information below. Notably I am using a Windows Java installation, which has not caused problems running sbt or leiningen by the way.
$ java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
$ javac -version
javac 1.7.0_71
$ which java
/cygdrive/c/Program Files/Java/jdk1.7.0_71/bin/java
$ which javac
/cygdrive/c/Program Files/Java/jdk1.7.0_71/bin/javac
$ echo $TERM
xterm-256color
build.boot:
(set-env! :dependencies '[[lein-beanstalk "0.2.7" :exclusions [lein-ring ]]])
(task-options!
pom '{:project extest
:version "1.0.0"})
What I ran:
boot pom
The result:
alandipert@alanputer:~/Desktop/extest boot pom
Writing pom.xml and pom.properties...
clojure.lang.ExceptionInfo: java.lang.UnsupportedOperationException: nth not supported on this type: Symbol
data: {:file
"/var/folders/1l/yypdg1hj2_1chvrfw7j5wc0r0000gn/T/boot.user86422816965862564.clj",
:line 19}
java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException: nth not supported on this type: Symbol
java.lang.UnsupportedOperationException: nth not supported on this type: Symbol
...
boot.pom/pom-xml/iter/fn/fn/iter/fn/fn pom.clj: 70
boot.pom/pom-xml/iter/fn/fn/iter/fn pom.clj: 70
...
This was first reported by @pleasetrythisathome in IRC
You should be able to tell the repl
task to use a given handler. Use case: cider-nrepl
.
Something like boot show --conflicts
would be a useful companion to boot show --dependencies
and boot show --updates
.
Need to support dependency classifiers for artifacts in the same project.
Reported by @sparkofreason on Discourse.
The code now assumes that content can't have changed unless mtime did, which dramatically sped up file difference calculation.
In the future we may consider a :static-paths
env key that circumvents the file watch service completely.
With :src-paths, you get additions combined into the current set of src-paths:
(defmethod merge-env! :src-paths [key old new env] (into (or old #{}) new))
Changes to :rsc-paths overwrite the previous
I can see barbarywatchservice is used as a WatchService implementation on OSX. On my machine it still takes a couple seconds before a change is noticed.
There is another way to reduce the time to notice a file change that works pretty well for me (JVM 1.8.0-b132):
(ns ...
(:import com.sun.nio.file.SensitivityWatchEventModifier))
(.register p ws
(into-array (type StandardWatchEventKinds/ENTRY_MODIFY) (vector StandardWatchEventKinds/ENTRY_MODIFY))
(into-array (type SensitivityWatchEventModifier/HIGH) (vector SensitivityWatchEventModifier/HIGH)))
From my experience using this trick changes are noticed almost instantaneously. It would also reduce the codebase complexity. The downside is that it introduces a dependency on com.sun.nio
that might need some special care for VM not shipping with this package.
boot assumes that .git will be in the same directory as .boot, but this isn't always the case. a boot task such as tomcat, for example, might have have .git in the root with two nested projects containing different boot build scripts.
(defn last-commit
[]
(jgit/with-repo "."
(->> (jgit/git-log repo) first .getName)))
clojure.lang.ExceptionInfo: The Git repository at '.' could not be located.
data: {:file
"/var/folders/62/r3g8yy650tvf6zhl_yv6ql9r0000gn/T/boot.user4645738998745492098.clj",
:line 15}
java.io.FileNotFoundException: The Git repository at '.' could not be located.
clj-jgit.porcelain/load-repo porcelain.clj: 60
boot.jgit/last-commit jgit.clj: 29
...
clojure.core/apply core.clj: 624
boot.pod/eval-fn-call pod.clj: 155
boot.pod/call-in pod.clj: 162
...
boot.pod/call-in pod.clj: 165
boot.pod/call-worker pod.clj: 170
boot.git/last-commit git.clj: 9
boot.task.built-in/fn/fn built_in.clj: 221
...
clojure.core/apply core.clj: 624
boot.user/eval67/fn/fn boot.user4645738998745492098.clj: 11
...
boot.user/eval73/fn boot.user4645738998745492098.clj: 13
...
clojure.core/apply core.clj: 624
boot.core/construct-tasks core.clj: 300
...
clojure.core/apply core.clj: 624
boot.user/eval87 boot.user4645738998745492098.clj: 17
...
boot.main/-main/fn main.clj: 126
boot.main/-main main.clj: 126
...
boot.App.runBoot App.java: 216
boot.App.main App.java: 302
Directories added via :rsc-paths
or obtained via boot.core/mkrscdir!
should be on the class path.
Hi,
When trying tempdirs branch, I have problems with file watching. It seems that syncing files from source dirs to tempdirs is working but watch-task is broken. For some reason the watch-key is invalid.
Watch-service doesn't have any real changes on tempdirs branch so it could be that problem exists in master but is only triggered by something on tempdirs branch.
A watch key is created when a watchable object is registered with a watch service. The key remains valid until:
- It is cancelled, explicitly, by invoking its cancel method, or
- Cancelled implicitly, because the object is no longer accessible, or
- By closing the watch service.
I've been trying to debug this and I'm quite confident I have checked that none of those things are happening. I have added some debug prints to boot code and I have checked that
~/Source/boot-cljx tempdirs 2m 38s
❯ boot dev
Starting new-watch-service src
Sync (src) -> #<File .boot/tmp/k3b/rcesf6>
([:cp #<File src/deraen/boot_cljx/impl.clj> #<File .boot/tmp/k3b/rcesf6/deraen/boot_cljx/impl.clj>] [:cp #<File src/deraen/boot_cljx.clj> #<File .boot/tmp/k3b/rcesf6/deraen/boot_cljx.clj>])
Sync (src) -> #<File .boot/tmp/k3b/rcesf6>
()
Sync (src) -> #<File .boot/tmp/k3b/rcesf6>
()
Starting new-watch-service .boot/tmp/k3b/6qp7pj, .boot/tmp/k3b/rcesf6, .boot/tmp/k3b/-p9hf6h
Starting file watcher (CTRL-C to quit)...
Sync (src) -> #<File .boot/tmp/k3b/rcesf6>
()
#<LinuxWatchKey sun.nio.fs.LinuxWatchService$LinuxWatchKey@4eb69366> watchable #<UnixPath .boot/tmp/k3b/rcesf6/deraen/boot_cljx> is-valid false exists true
watch service: invalid watch key
nREPL server listening: 0.0.0.0:49714
Writing pom.xml and pom.properties...
Writing boot-cljx-0.2.0-SNAPSHOT.jar...
Installing boot-cljx-0.2.0-SNAPSHOT.jar...
([:cp #<File .boot/tmp/k3b/11lgcg/boot-cljx-0.2.0-SNAPSHOT.jar> #<File target/boot-cljx-0.2.0-SNAPSHOT.jar>])
Elapsed time: 4.538 sec
What should be the next steps in resolving this?
Can anyone else reproduce this? https://github.com/Deraen/boot-cljx/tree/tempdirs and running boot dev
should print "watch service: invalid watch key"
If needed I think I could create virtualbox image to test this (or Vagrant script which can be used to create the image).
Need to refactor boot such that namespaces providing a stable public API are clearly separated from implementation and namespaces used internally by boot. Ideally there would be no more than say 4 public API namespaces, organized mainly around the 3 types of pods provided by boot (core, worker, and task pods).
When task-options!
is passed an update function instead of an option map, the correct behavior should be to replace the current options with the result of applying the update fn to them. The current (erroneous) behavior is to merge the current options with the result.
If you set :tgt-path after setting :rsc-paths, it just dumps resources into target/ (default).
(set-env!
:tgt-path "blah"
:rsc-paths #{"resources/public"})
works, dumping resources into blah/
(set-env!
:rsc-paths #{"resources/public"})
:tgt-path "blah")
doesn't work as expected, dumping resources into target/
boot watch cljs garden
When you use watch
for multiple tasks as above and trigger a recompilation of your cljs
files by changing them all files created by the garden
task will be removed from the target-dir
.
Please add brew support for OS X
thanks in advance
This is probably related to #16 in a more general sense.
In the following script I tried to establish additional src/resource paths and dependencies for the dev environment (calling set-env!
in a dev
task).:
(set-env!
:src-paths #{"src/clj", "src/cljs"}
:rsc-paths #{"resources"}
:dependencies '[[compojure "1.2.1"]])
(deftask dev
"Start development environment"
[]
(set-env! :rsc-paths #{"dev/resources"})
(set-env! :src-paths #{"dev/clj"})
(set-env! :dependencies '[[org.clojure/tools.namespace "0.2.7"]])
(println "Deps" (get-env :dependencies))
(println "Src" (get-env :src-paths))
(println "Res" (get-env :rsc-paths)))
which produces
=> boot dev
Deps [[org.clojure/tools.namespace 0.2.7]]
Src #{dev/clj src/cljs src/clj}
Res #{dev/resources}
Am I using the set-env!
function correctly for the result I want to get (dev environment/profile)?
In any case the semantics of set-env!
are confusing.
Currently set-env!
works by delegating to merge-env!
, which merges sources, overwrites resources (seems like a bug as there is a defmethod
for :src
, but not for :rsc
) and overwrites dependencies (although it seems to be calling add-dependency!
with an old
dependency set).
I'd think that set-env!
should always overwrite, not merge, while update-env!
should accept a function analogous to clojure.core/update
. There could be a simplified version of update-env!
- append-env!
(or conj-env!
) which would always try to merge the values if it made sense and fail otherwise. Could you please explain the reasoning behind the current semantics of set-env!
and merge-env!
?
I think Boot is a great project and a step forward for the Clojure ecosystem. I'd love to contribute, so understanding the design decisions a bit better would help a great deal!
Currently it takes munged namespace strings, like "ns_tracker.core"
but it should accept Clojure namespace symbols (or strings) like 'ns-tracker.core
.
https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/task/built_in.clj#L152
Watch task checks if the changed file is in git index. ls-files returns a set of files relative to git work directory. Watch task checks if the set contains changed file but the changed file is relative to project directory.
ls-files could be fixed to return set of files relative to project directory...
But perhaps it makes more sense to just remove gitignore-matcher: only src- and rsc-paths are watched for changes so not too many uninteresting files should trigger change.
We should support maybe 4 levels:
level | option | logging | stack traces | stack trace formatting |
---|---|---|---|---|
0 | -q |
none | none | none |
1 | none | info + warn + fail | elided | formatted & colorized |
2 | -v |
info + warn + fail | full | formatted & colorized |
3 | -vv |
dbug + info + warn + fail | full | none |
@rkneufeld reports: https://github.com/rkneufeld/boot-gen-class-bug
boot -V
:#Fri Dec 05 12:07:46 CST 2014
BOOT_CLOJURE_VERSION=1.6.0
BOOT_VERSION=2.0.0-pre27
If I have a build.boot file that references my src directory, I can require and use namespaces from that code.
For example, with these files
.
├── build.boot
└── src
└── my_namespace
└── app.clj
src/my_namespace/app.clj
(ns my-namespace.app)
(defn start []
(println "Hello World"))
build.boot
(set-env! :src-paths #{"src"})
(require '[my-namespace.app :as app])
(deftask run
"Run my app"
[]
(app/start))
I can execute boot run
and it will print Hello World
$ boot run
Hello World
It wasn't obvious to me from the docs that this would work.
From the docs I can see three ways to run Clojure code in boot:
I initially assumed source paths were just referenced by build tasks, which consume Clojure or ClojureScript source code. But it looks like the source is actually compiled and available within .boot scripts.
I was looking for something like "lein run" to load code from a source path and execute it, but it took me a while to figure out how to do it.
I think some more explanation and examples about :src-paths would be helpful in understanding boot.
For example if :source-paths
isn't a set, things like that.
$ boot watch
Starting file watcher (CTRL-C to quit)...
{:time 1415181737849, :id G__58}
Elapsed time: 2.253 sec
^C^C^C
OS X 10.10
Java 1.7.0_71 and 1.8.0_25
(core/task-options! garden [:styles-var 'creationist.styles/screen
:output-to "public/css/screen.css"])
(add-sync! "public" ["target/public"])
I have something like this in my build.boot
, now I do the following
boot watch garden
rm public/css/screen.css
(i.e. remove target file from add-sync!'s destination)rm target/public/css/screen.css
(that's add-sync!'s source)styles.clj
The result is that I have a newly compiled target/public/css/screen.css
file but don't have a file in public/css/screen.css
. This happened with pre21
.
When restarting the boot watch garden
task it properly copies the file into the public
dir again.
I assume you could verify this with other tasks that put files into a mktgtdir!
as well.
This should be implemented as an option to the new sift
task...
Because of the way the temp dirs stuff works we can no longer defer creating the .boot directory until a task needs a temp dir. Boot itself needs tempdirs now. This means that even things like boot -h
end up creating the .boot directory in the CWD. This is unacceptable if CWD isn't writeable by the user.
Solution:
~/.boot/tmp/...
instead of in ./.boot
../.boot
→ ~/.boot/tmp/...
if CWD is writeable and there are files the user might care about in there.We bake in (and therefore "distribute in source form") a number of libraries with EPL (most), Apache (AvisoNovate/pretty), and MIT (cldwalker/table) licenses.
We should make sure we comply with them under their respective distribution and attribution clauses.
Various Java libraries presume to own the JVM and call System/exit willy-nilly. Libraries like this can be hard to wrap with tasks. So, we should have a macro task authors can use to run code without worrying about it killing the JVM.
I had a directory in my resource paths, and started the watcher. Then I added a directory an existing directory, put a file on it, and observed the watcher didn't do anything.
AOT is broken because the *compile-path*
we specify - a temp-dir - isn't on the classpath. *compile-path*
needs to be on the classpath per the clojure.core/compile docstring.'
Reported by @narayannarvekar on Discourse
I tried to make a Java shim to invoke a Clojure function, pending AOT support (which we should also have btw):
import clojure.java.api.Clojure;
import clojure.lang.IFn;
public class Main {
public static void main(String [] args) {
IFn seq = Clojure.var("clojure.core", "seq");
Clojure.var("main", "-main").applyTo(seq.invoke(args));
}
}
It didn't work, because clojure.java.api.Clojure
and clojure.lang.IFn
aren't on the classpath as far as the Java compiler is concerned. I'm not 100% sure it's possible, but maybe we can get the javac task to inherent the parent environment classpath:
http://stackoverflow.com/questions/1563909/how-to-set-classpath-when-i-use-javax-tools-javacompiler-compile-the-source
I have written down the code from this tutorial
https://github.com/swannodette/om/wiki/Intermediate-Tutorial
With lein the clojurescript code compiles.
With boot 5 warnings pop up. Here they are
[email protected] boot-cljs-example$ boot watch speak cljs-repl cljs -usO none reload
<< started reload server on ws://localhost:8090 >>
Starting file watcher (CTRL-C to quit)...
nREPL server listening: 0.0.0.0:37240
Compiling main.js...
WARNING: Use of undeclared Var cljs.core.async/do-alts at line 62 file:/home/me/.m2/repository/org/clojure/core.async/0.1.267.0-0d7780-alpha/core.async-0.1.267.0-0d7780-alpha.jar!/cljs/core/async/impl/ioc_helpers.cljs
WARNING: Bad method signature in protocol implementation, impl/Handler does not declare method called lock-id at line 205 file:/home/me/.m2/repository/org/clojure/core.async/0.1.267.0-0d7780-alpha/core.async-0.1.267.0-0d7780-alpha.jar!/cljs/core/async.cljs
WARNING: Use of undeclared Var cljs.core.async.impl.protocols/lock-id at line 208 file:/home/me/.m2/repository/org/clojure/core.async/0.1.267.0-0d7780-alpha/core.async-0.1.267.0-0d7780-alpha.jar!/cljs/core/async.cljs
WARNING: Bad method signature in protocol implementation, impl/Handler does not declare method called lock-id at line 205 .boot/tmp/m6p/ye6vpt/out/cljs/core/async.cljs
WARNING: Use of undeclared Var cljs.core.async.impl.protocols/lock-id at line 208 .boot/tmp/m6p/ye6vpt/out/cljs/core/async.cljs
Adding <script> tags to html...
Elapsed time: 20,862 sec
Here's my build.boot file
(set-env!
:src-paths #{"src/clj" "src/cljs"}
:rsc-paths #{"html"}
:dependencies '[[adzerk/boot-cljs "0.0-2371-22" :scope "test"]
[adzerk/boot-cljs-repl "0.1.5" :scope "test"]
[adzerk/boot-reload "0.1.3" :scope "test"]
;[ring/ring "1.2.1"]
[org.clojure/clojurescript "0.0-2173"]
[org.clojure/core.async "0.1.267.0-0d7780-alpha"]
[om "0.5.3"]
[om-sync "0.1.1"]
;[compojure "1.1.6"]
[fogus/ring-edn "0.2.0"]
;[com.datomic/datomic-free "0.9.4699"]
])
(require
'[adzerk.boot-cljs :refer :all]
... blah blah
and here's my lein project.clj file
(defproject om-async "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:jvm-opts ^:replace ["-Xmx1g" "-server"]
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/clojurescript "0.0-2173"]
[ring/ring "1.2.1"]
[org.clojure/core.async "0.1.267.0-0d7780-alpha"]
[om "0.5.3"]
[om-sync "0.1.1"]
[compojure "1.1.6"]
[fogus/ring-edn "0.2.0"]
[com.datomic/datomic-free "0.9.4699"]]
... blah blah blah
As you can see core.async and clojurescript are exactly the same in both lein and boot.
What am I missing ?
Ran this in boot-cljsjs:
~/c/boot-cljsjs (master=) boot -d cljsjs/react repl
nREPL server listening: 0.0.0.0:53582
REPL-y 0.3.4, nREPL 0.2.4
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_25-b17
Exit: Control+D or (exit) or (quit)
Commands: (user/help)
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
(user/clojuredocs name-here)
(user/clojuredocs "ns-here" "name-here")
boot.user=> (def env (get-env))
#'boot.user/env
boot.user=> (map first (->> "cljsjs/" (cljsjs.app/dep-jars-on-cp env) (mapcat #(cljsjs.app/files-in-jar % "cljsjs/" [".inc.js"]))))
("cljsjs/react/react-0.11.2.inc.js")
boot.user=> (:dependencies env)
[[org.clojure/clojure "1.6.0" :scope "provided"] [boot/core "2.0.0-pre28" :scope "provided"] [adzerk/bootlaces "0.1.5" :scope "test"]]
When using boot with Datomic, it seems as if *data-readers*
is not being properly populated.
In boot, *data-readers*
is empty, even with Datomic included as a dependency:
code/tmp ▸ boot -d com.datomic/datomic-free repl
nREPL server listening: 0.0.0.0:59655
REPL-y 0.3.5, nREPL 0.2.6
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_20-b26
Exit: Control+D or (exit) or (quit)
Commands: (user/help)
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
(user/clojuredocs name-here)
(user/clojuredocs "ns-here" "name-here")
boot.user=> *data-readers*
{}
Whereas in Leiningen, *data-readers*
contains Datomic's db/id
et al readers.
code/tmp ▸ lein try com.datomic/datomic-free
WARNING!!! version ranges found for:
[com.datomic/datomic-free "RELEASE"] -> [com.amazonaws/aws-java-sdk "1.8.11" :exclusions [javax.mail/mail org.apache.httpcomponents/httpclient commons-logging]] -> [com.amazonaws/aws-java-sdk-core "1.8.11"] -> [joda-time "[2.2,)"]
Consider using [com.datomic/datomic-free "0.9.5078" :exclusions [joda-time]].
nREPL server started on port 59665 on host 127.0.0.1 - nrepl://127.0.0.1:59665
REPL-y 0.3.5, nREPL 0.2.6
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_20-b26
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> *data-readers*
{db/id #'datomic.db/id-literal, db/fn #'datomic.function/construct, base64 #'datomic.codec/base-64-literal}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.