boot-tools-deps
February 7, 2019 · View on GitHub
See https://github.com/clojure/tools.deps.alpha/wiki/Tools for better tooling based on tools.deps/deps.edn.
boot-tools-deps was designed to allow you to use Boot to perform certain simple Boot tasks on top of an existing, working deps.edn project -- prior to the arrival of all that tooling -- such as building an uberjar. It was never intended to allow the full spectrum of Boot tooling to be used (but I think I mistakenly gave that impression in the original README).
Description
A Boot task that uses tools.deps(.alpha) to read in deps.edn files in the same way that the clj script uses them. Updates Boot's resources, sources, and classpath based on the paths, extra paths, and classpath computed by tools.deps. Can also update Boot's dependencies (for use by tasks like uber).
The primary use case for boot-tools-deps is that your project runs with clj -- so all of its dependencies are managed via deps.edn files, with aliases as appropriate -- and you want to bring Boot tooling to that project, in addition. If you have an existing Boot project, the assumption is that you move all of the code-level (This use case only worked for simple Boot projects!):dependencies into deps.edn and use aliases in preference to :scope in order to manage how dependencies are assembled -- leaving only Boot-level tooling in :dependencies or supply those dependencies via the command-line.
Usage
You can either use this library as a command line dependency:
boot -d seancorfield/boot-tools-deps:0.4.7 deps ...
or you can add the following to your profile.boot file's :dependencies:
[seancorfield/boot-tools-deps "0.4.7" :scope "test"]
and then expose the task with:
(require '[boot-tools-deps.core :refer [deps]])
or, if you have a build.boot file, add the dependency and the require/:refer there.
The available arguments that mirror clj and tools.deps.alpha are:
-c--config-files-- specify thedeps.ednfiles to be used-r--repeatable-- use only the localdeps.ednfile (or the-cspecified files) -- note: the-Doption is still read and used!-D--config-data-- provide an EDN string that is treated as an additional, finaldeps.ednfile-A--aliases-- specify aliases of any kind (equivalent to specifying-C,-M, and-Rall with the same alias)-C--classpath-aliases-- specify the aliases for classpath additions-M--main-aliases-- specify the aliases for main options-R--resolve-aliases-- specify the aliases for resolving dependencies
The available arguments that are specific to boot-tools-deps are:
-x--execute-- after processing thedeps.ednfiles, runclojure.main/mainproviding as arguments any main-opts found bytools.deps.alpha-- note: main-opts are only found via aliases!-B--overwrite-boot-deps-- in addition to setting up the classpath (and:resource-pathsandsource-paths), overwrite Boot's:dependencieswith those returned fromtools.deps-- note: this is only required for Boot tasks such asuberto function correctly!-Q--quick-merge-- in addition to setting up the classpath etc, perform a quick and simple merge into Boot's:dependenciesof those returned fromtools.deps-- note: this is sometimes required for certain Boot tooling to work later on in the pipeline; it cannot be used with-Band should not be used withubersince it will include all your tooling dependencies as well-v--verbose-- explain what the task is doing (-vvalso makestools.depsverbose)
Specifying aliases for tasks in build.boot
You can specify different classpaths for different tasks. For example, to use the default classpath for the build task:
(deftask build
"Build and install the project locally."
[]
(comp (deps) (pom :project 'foo/bar :version "0.1.0" ) (jar :main 'clojure.main) (install)))
And to add the :test alias when testing:
(require '[adzerk.boot-test :as boot-test])
(deftask test
"Runs tests"
[]
(comp (deps :aliases [:test])
(boot-test/test)))
Differences from how clj works
- The "system"
deps.ednfile is not read butboot-tools-depsmerges in a copy taken from theclojure/brew-installrepository so the effect should be the same. This means the defaultdeps.edninformation may lag behind the latest, distributed/installed version, or may be ahead of the version you actually have installed (if you have not updatedclojurerecently). The version of Clojure used is whatever version is running by the time this task is run -- you can only change that viaBOOT_CLOJURE_VERSIONor~/.boot/boot.properties, not viadeps.edn. cljcomputes the full classpath and caches it in a local file.boot-tools-depscomputes the classpath on every invocation.- Whatever value of
:pathscomes back fromtools.depsis used as the:resource-pathsvalue for Boot. - Whatever value of
:extra-pathscomes back fromtools.depsis used as the base:source-pathsvalue for Boot. You can use Boot'ssifttask to treat them as resources instead. - Any additional folders found on the computed classpath produced by
tools.depsare added to the:source-pathsand any JAR files on the computed classpath are added directly to Boot's in-memory classpath. Boot's:dependenciesare not updated by default. clojure.mainis only executed if you specify the-xoption (cljalways runs this).- In order to run tasks that depend on Boot's
:dependencies, such asuber, you need to specify either the-Boption to overwrite Boot's:dependencieswith the computed dependencies produced bytools.depsor the-Qoption to merge the computed dependencies into Boot's:dependencies. Note: transitive dependencies do not inherit the:scopeof the dependency that caused them to be included!
Changes
- 0.4.7 -- 12/06/2018 -- Merge
:mvn/reposback to:repositoriesin Boot (to address #24). - 0.4.6 -- 10/05/2018 -- Update to
tools.deps.alpha0.5.452 (to add authenticated repo support -- @cbowdon). - 0.4.5 -- 04/08/2018 -- Update to
tools.deps.alpha0.5.417 (which should suppress the slf4j warnings). - 0.4.4 -- 04/07/2018 -- broken release
- 0.4.3 -- 02/23/2018 -- Update to
tools.deps.alpha0.5.398 (this removes the version range check). - 0.4.2 -- 02/14/2018 -- Update to
tools.deps.alpha0.5.373; only pull in a more recent version of Clojure for the pod if actually necessary; add:classifierand:extensionto modifiers thatboot-tools-depspasses back fromtools.deps.alpha(#20; in addition to:exclusionsand:scope-- @superstructor). - 0.4.1 -- 02/02/2018 -- Fix
-Doption (broken in 0.4.0). - 0.4.0 -- 02/02/2018 -- Destroy pod inline instead of in a future; update to
tools.deps.alpha0.5.351; add support for-M(main-aliases) and-xto executeclojure.main. - 0.3.0 -- 02/02/2018 -- Add
-Q(quick merge) for Boot's:dependenciesto better support certain tool chains (#15); refactortools-depsto match arguments forload-depsfor easier reuse as a library (#11); update docstrings (to match current usage and explain it better); updated README to better clarify intended usage (#12). - 0.2.3 -- 01/31/2018 -- Ensure pod environment gets recent version of Clojure (@superstructor).
- 0.2.2 -- 01/29/2018 -- Refactor pod code to a separate namespace to make the code easier to work with (@superstructor).
- 0.2.1 -- 01/29/2018 -- Make Clojure a
:provideddependency for consistency (@superstructor). - 0.2.0 -- 01/28/2018 -- Update to use the most recent
tools.deps.alpharelease; directly update the Boot classpath (which means Git and Local dependencies are now supported!); runtools.depsinside a Boot pod; no longer update Boot's:dependenciesby default. - 0.1.4 -- 12/06/2017 -- Fix #3 by updating
deps.edntemplate frombrew-install(changes Clojars repo URL); fix #4 by correcting how-rand-coptions affect the list ofdeps.ednfiles used; switches fromHOMEenvironment variable touser.homesystem property; adds-Aoption for when you need the same alias on both-Rand-C; now relies ontools.deps.alpha.makecploading all the specific providers (instead of loading them manually). - 0.1.3 -- 11/15/2017 -- Fix #2 by using
deps.edntemplate frombrew-installrepo as defaults. - 0.1.2 -- 11/13/2017 -- Expose
depstask machinery as a function,load-deps, for more flexibility. - 0.1.1 -- 11/12/2017 -- First working version.
License
Copyright © 2017-2018 Sean Corfield, all rights reserved.
Distributed under the Eclipse Public License version 1.0.