aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/deps.lux
blob: e113616efe5e03bee6c570abc6216c5a91e29622 (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
(.using
 [library
  [lux (.except)
   [abstract
    [monad (.only do)]]
   [control
    ["[0]" exception]
    [concurrency
     ["[0]" async (.only Async)]]]
   [data
    [collection
     ["[0]" set (.only Set)]
     ["[0]" list (.open: "[1]#[0]" mix)]
     ["[0]" dictionary]]
    [text
     ["%" format]]]
   [world
    [net (.only URL)]
    [program (.only Program)]
    ["[0]" file]
    ["[0]" console (.only Console)]]]]
 ["[0]" //
  ["[1][0]" clean]
  ["/[1]" //
   [command (.only Command)]
   [repository (.only Repository)]
   ["[1]" profile]
   ["[1][0]" action (.only Action)]
   ["[1][0]" artifact (.only Artifact)]
   ["[1][0]" dependency (.only Dependency)
    ["[1]/[0]" resolution (.only Resolution)]
    ["[1]/[0]" deployment]]]])

(def: format
  (%.Format Dependency)
  (|>> (the ///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 (|> (the ///.#dependencies profile)
                            set.list
                            {.#Item (the ///.#lux 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 (at ///dependency.order <))
                                                    (exception.listing ..format))
                              "Local failures" (|> local_failures
                                                   (list.sorted (at ///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 (at ///dependency.order <))
                                                     (exception.listing ..format))
                              "Remote failures" (|> remote_failures
                                                    (list.sorted (at ///dependency.order <))
                                                    (exception.listing ..format)))
                             console)]
      (in resolution))))