aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/deps.lux
blob: 91bbf0ec1d025af0c2e33fa0fb954332bcab0767 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(.module:
  [lux #*
   [abstract
    [monad (#+ do)]]
   [control
    [concurrency
     ["." promise]]]
   [data
    [collection
     ["." set (#+ Set)]
     ["." list ("#\." functor)]]]
   [world
    ["." file]]]
  ["." /// #_
   [command (#+ Command)]
   [artifact (#+ Artifact)]
   ["#" profile]
   ["#." action (#+ Action)]
   ["#." cache]
   ["#." repository]
   ["#." dependency #_
    ["#" resolution]]])

(def: #export (do! profile)
  (Command (Set Artifact))
  (do ///action.monad
    [cache (///cache.read-all (file.async file.default)
                              (set.to-list (get@ #///.dependencies profile))
                              ///dependency.empty)
     resolution (///dependency.all (list\map (|>> ///repository.remote ///repository.async)
                                             (set.to-list (get@ #///.repositories profile)))
                                   (set.to-list (get@ #///.dependencies profile))
                                   cache)
     cached (///cache.write-all (file.async file.default)
                                resolution)
     #let [_ (log! "Successfully resolved dependencies!")]]
    (wrap cached)))