blob: 0362bce1411f158daad4d3c4d977037bc1ab6e3f (
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
(.using
[library
[lux "*"
["_" test {"+" Test}]
[abstract
[monad {"+" do}]
["[0]" predicate]]
[control
["[0]" try]
[concurrency
["[0]" async]]
[parser
["[0]" environment]]]
[data
["[0]" text ("[1]#[0]" equivalence)
["%" format {"+" format}]
[encoding
["[0]" utf8]]]
[collection
["[0]" dictionary]
["[0]" set]]
[format
["[0]" xml]]]
[math
["[0]" random {"+" Random}]]
[world
["[0]" program]
["[0]" file]]]]
["[0]" // "_"
["@[0]" version]
["$/[1]" // "_"
["[1][0]" package]
["[1][0]" artifact]
["[1][0]" dependency "_"
["[1]/[0]" resolution]]]]
[\\program
["[0]" /
["/[1]" // "_"
["[1][0]" clean]
["/[1]" // "_"
["[1]" profile]
["[1][0]" action]
["[1][0]" pom]
["[1][0]" package]
["[1][0]" artifact
["[1]/[0]" type]]
["[1][0]" dependency
["[1]/[0]" resolution]
["[1]/[0]" deployment]
["[1]/[0]" status]]
["[1][0]" repository
["[1]/[0]" origin]
["[1]/[0]" local]]]]]])
(def: .public test
Test
(<| (_.covering /._)
(do random.monad
[home (random.ascii/alpha 5)
working_directory (random.ascii/alpha 5)
dependee_artifact $///artifact.random
depender_artifact (random.only (predicate.complement
(# ///artifact.equivalence = dependee_artifact))
$///artifact.random)
[_ dependee_package] $///package.random
[_ depender_package] $///package.random
.let [dependee [///dependency.#artifact dependee_artifact
///dependency.#type ///artifact/type.lux_library]
depender [///dependency.#artifact depender_artifact
///dependency.#type ///artifact/type.lux_library]
dependee_pom (|> (# ///.monoid identity)
(with@ ///.#identity {.#Some dependee_artifact})
///pom.write
try.trusted)
depender_pom (|> (# ///.monoid identity)
(with@ ///.#identity {.#Some depender_artifact})
(with@ ///.#dependencies (set.of_list ///dependency.hash (list dependee)))
///pom.write
try.trusted)
dependee_package (|> dependee_package
(with@ ///package.#origin {///repository/origin.#Remote ""})
(with@ ///package.#pom [dependee_pom
(|> dependee_pom (# xml.codec encoded) (# utf8.codec encoded))
{///dependency/status.#Unverified}]))
depender_package (|> depender_package
(with@ ///package.#origin {///repository/origin.#Remote ""})
(with@ ///package.#pom [depender_pom
(|> depender_pom (# xml.codec encoded) (# utf8.codec encoded))
{///dependency/status.#Unverified}]))
fs (file.mock (# file.default separator))
program (program.async (program.mock environment.empty home working_directory))]]
(in (do async.monad
[verdict (do ///action.monad
[.let [console (@version.echo "")
local (///repository/local.repository program fs)]
pre (|> ///dependency/resolution.empty
(dictionary.has dependee dependee_package)
(///dependency/deployment.all local))
post (|> (# ///.monoid identity)
(with@ ///.#dependencies (set.of_list ///dependency.hash (list dependee depender)))
(/.do! console local
(list (///repository.mock ($///dependency/resolution.single depender_artifact depender_package)
[]))
(function (_ url)
(///repository.mock $///dependency/resolution.nope []))))
.let [had_dependee_before!
(set.member? pre dependee_artifact)
lacked_depender_before!
(not (set.member? pre depender_artifact))
had_dependee_after!
(dictionary.key? post dependee)
had_depender_after!
(dictionary.key? post depender)]]
(in (and had_dependee_before!
lacked_depender_before!
had_dependee_after!
had_depender_after!)))]
(_.cover' [/.do!]
(try.else false verdict)))))))
|