Permalink
Switch branches/tags
v0.0 tools.deps.alpha-0.5.460 tools.deps.alpha-0.5.452 tools.deps.alpha-0.5.442 tools.deps.alpha-0.5.435 tools.deps.alpha-0.5.425 tools.deps.alpha-0.5.417 tools.deps.alpha-0.5.410 tools.deps.alpha-0.5.398 tools.deps.alpha-0.5.393 tools.deps.alpha-0.5.388 tools.deps.alpha-0.5.383 tools.deps.alpha-0.5.373 tools.deps.alpha-0.5.351 tools.deps.alpha-0.5.342 tools.deps.alpha-0.5.338 tools.deps.alpha-0.5.334 tools.deps.alpha-0.5.329 tools.deps.alpha-0.5.323 tools.deps.alpha-0.5.317 tools.deps.alpha-0.4.295 tools.deps.alpha-0.4.291 tools.deps.alpha-0.4.277 tools.deps.alpha-0.4.276 tools.deps.alpha-0.3.260 tools.deps.alpha-0.3.254 tools.deps.alpha-0.3.249 tools.deps.alpha-0.3.245 tools.deps.alpha-0.3.240 tools.deps.alpha-0.3.236 tools.deps.alpha-0.3.231 tools.deps.alpha-0.3.225 tools.deps.alpha-0.3.220 tools.deps.alpha-0.2.196 tools.deps.alpha-0.2.190 tools.deps.alpha-0.2.183 tools.deps.alpha-0.2.179 tools.deps.alpha-0.2.173 tools.deps.alpha-0.2.167 tools.deps.alpha-0.2.162 tools.deps.alpha-0.2.155 tools.deps.alpha-0.2.140 tools.deps.alpha-0.2.135 tools.deps.alpha-0.2.130 tools.deps.alpha-0.2.122 tools.deps.alpha-0.2.116 tools.deps.alpha-0.1.108 tools.deps.alpha-0.1.103 tools.deps.alpha-0.1.100 tools.deps.alpha-0.1.98 tools.deps.alpha-0.1.94 tools.deps.alpha-0.1.90 tools.deps.alpha-0.1.85 tools.deps.alpha-0.1.78 tools.deps.alpha-0.1.73 tools.deps.alpha-0.1.68 tools.deps.alpha-0.1.62 tools.deps.alpha-0.1.56 tools.deps.alpha-0.1.40 tools.deps.alpha-0.1.35 tools.deps.alpha-0.1.29 tools.deps.alpha-0.1.14
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
93 lines (72 sloc) 3.38 KB
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
(ns clojure.tools.deps.alpha.specs
(:require [clojure.spec.alpha :as s]))
;; library, like org.clojure/clojure
(s/def ::lib symbol?)
;; coordinates
(s/def ::path string?)
(s/def :mvn/version string?)
(s/def ::exclusions (s/coll-of ::lib))
(s/def :mvn/coord (s/keys :req [:mvn/version] :opt-un [::path ::exclusions]))
(s/def :local/root string?)
(s/def :local/coord (s/keys :req-un [:local/root] :opt-un [::path]))
(s/def :git/url string?)
(s/def :git/coord (s/keys :req [:git/url]))
;; should this become a multipec?
(s/def ::coord (s/or :mvn :mvn/coord
:local :local/coord
:git :git/coord))
;; resolve-deps args
;; used to modify the expanded deps tree
;; ::extra-deps - map of lib to coordinate added to the initial deps collection
;; ::override-deps - map of lib to coordinate to use instead of the coord found during expansion
;; ::default-deps - map of lib to coordinate to use if no coord is specified in extension
(s/def ::resolve-args (s/keys :opt-un [::extra-deps ::override-deps ::default-deps]))
(s/def ::extra-deps (s/map-of ::lib ::coord))
(s/def ::override-deps (s/map-of ::lib ::coord))
(s/def ::default-deps (s/map-of ::lib ::coord))
;; make-classpath args
;; used when constructing the classpath
;; ::classpath-overrides - map of lib to path to use instead of the artifact found during resolution
;; ::extra-paths - collection of extra paths to add to the classpath in addition to ::paths
(s/def ::classpath-args (s/keys :opt-un [::classpath-overrides ::extra-paths]))
(s/def ::classpath-overrides (s/map-of ::lib ::path))
(s/def ::extra-paths (s/coll-of string? :kind vector? :into []))
;; deps map (format of the deps.edn file)
(s/def ::paths (s/coll-of string? :kind vector? :into []))
(s/def ::deps (s/map-of ::lib ::coord))
(s/def ::alias keyword?)
(s/def ::aliases (s/map-of ::alias (s/or :resolve-deps ::resolve-args :make-classpath ::classpath-args)))
(s/def ::deps-map (s/keys :opt-un [::paths ::deps ::aliases]))
;; lib map
;; a map of lib to resolved coordinate (a coord with a ::path) and dependent info
(s/def ::dependents (s/coll-of ::lib))
(s/def ::resolved-coord (s/merge ::coord (s/keys :req-un [::paths] :opt-un [::dependents])))
(s/def ::lib-map (s/map-of ::lib ::resolved-coord))
;; classpath
(s/def ::classpath string?)
(s/def ::run (s/keys :req-un [::deps-map ::lib-map ::classpath]))
;; Procurers
;; maven
(s/def :mvn/repos (s/map-of ::repo-id ::repo))
(s/def ::repo-id string?)
(s/def ::repo (s/keys :opt-un [::url]))
(s/def ::url string?)
(s/def :mvn/local-repo string?)
;; API
(s/fdef clojure.tools.deps.alpha/resolve-deps
:args (s/cat :deps ::deps-map :options ::resolve-args)
:ret ::lib-map)
(s/fdef clojure.tools.deps.alpha/make-classpath
:args (s/cat :libs ::lib-map :paths ::paths :classpath-args ::classpath-args)
:ret string?)
(comment
(require '[clojure.spec.test.alpha :as stest])
(stest/instrument (stest/enumerate-namespace 'clojure.tools.deps.alpha))
)