aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/deps.lux
blob: c1b0990f531d2bae1dcffe1dd51d662d8daa2a68 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
(.module:
  [library
   [lux #*
    [abstract
     [monad (#+ do)]]
    [control
     ["." exception]
     [concurrency
      ["." async (#+ Async)]]]
    [data
     [collection
      ["." set (#+ Set)]
      ["." list ("#\." mix)]
      ["." dictionary]]
     [text
      ["%" format]]]
    [world
     [net (#+ URL)]
     [program (#+ Program)]
     ["." file]
     ["." console (#+ Console)]]]]
  ["." // #_
   ["#." clean]
   ["/#" // #_
    [command (#+ Command)]
    [repository (#+ Repository)]
    ["#" profile]
    ["#." action (#+ Action)]
    ["#." artifact (#+ Artifact)]
    ["#." dependency (#+ Dependency)
     ["#/." resolution (#+ Resolution)]
     ["#/." deployment]]]])

(def: format
  (%.Format Dependency)
  (|>> (value@ #///dependency.artifact)
       ///artifact.format
       %.text))

(def: .public (do! console local remotes new_repository profile)
  (-> (Console Async) (Repository Async) (List (Repository Async)) (-> URL (Repository Async)) (Command Resolution))
  (do async.monad
    [.let [dependencies (|> (value@ #///.dependencies profile)
                            set.list
                            (#.Item (value@ #///.compiler profile)))]
     [local_successes local_failures cache] (///dependency/resolution.all console
                                                                          (list local)
                                                                          new_repository
                                                                          dependencies
                                                                          ///dependency/resolution.empty)
     [remote_successes remote_failures resolution] (///dependency/resolution.all console
                                                                                 remotes
                                                                                 new_repository
                                                                                 dependencies
                                                                                 cache)]
    (do ///action.monad
      [cached (|> (dictionary.keys cache)
                  (list\mix dictionary.lacks resolution)
                  (///dependency/deployment.all local))
       _ (console.write_line (exception.report
                              ["Local successes" (|> local_successes
                                                     (list.sorted (\ ///dependency.order <))
                                                     (exception.listing ..format))]
                              ["Local failures" (|> local_failures
                                                    (list.sorted (\ ///dependency.order <))
                                                    (exception.listing ..format))]
                              ["Remote successes" (|> remote_successes
                                                      (set.of_list ///dependency.hash)
                                                      (set.difference (set.of_list ///dependency.hash local_successes))
                                                      set.list
                                                      (list.sorted (\ ///dependency.order <))
                                                      (exception.listing ..format))]
                              ["Remote failures" (|> remote_failures
                                                     (list.sorted (\ ///dependency.order <))
                                                     (exception.listing ..format))])
                             console)]
      (in resolution))))