blob: 6623420422cafd9b5032f8f7926987f58069ed93 (
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
|
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
(.require
[library
[lux (.except)
[abstract
[monad (.only do)]]
[control
[try (.only Try)]
[concurrency
["[0]" async (.only Async) (.use "[1]#[0]" monad)]]]
[data
[collection
["[0]" dictionary]]]
[math
[number
["i" int]]]
[meta
[macro
["^" pattern]]]
[world
["[0]" environment (.only Environment)]
["[0]" file]
["[0]" shell (.only Exit Shell)]
["[0]" console (.only Console)]]]]
["[0]" //
["[1][0]" build]
["/[1]" //
["[1]" profile]
["[1][0]" action]
["[1][0]" command (.only Command)]
["[1][0]" runtime]
[dependency
[resolution (.only Resolution)]]]])
(def .public start "[TEST STARTED]")
(def .public success "[TEST ENDED]")
(def .public failure "[TEST FAILED]")
(def .public (do! console environment fs shell resolution profile)
(-> (Console Async) (Environment Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any]))
(do async.monad
[.let [home (of environment home)
working_directory (of environment directory)]
environment_vars (environment.environment async.monad environment)]
(do [! ///action.monad]
[[build_exit compiler program] (//build.do! console environment fs shell resolution
(has ///.#program (the ///.#test profile) profile))]
(if (i.= shell.normal build_exit)
(do !
[_ (is (Async (Try Any))
(console.write_line ..start console))
.let [host_dependencies (//build.host_dependencies fs home resolution)
[command_environment test_command test_parameters] (when compiler
{//build.#JVM dependency}
(|> program
(///runtime.for (the ///.#java profile))
(//build.with_jvm_class_path host_dependencies))
(^.with_template [<tag> <runtime>]
[{<tag> artifact}
(///runtime.for (the <runtime> profile)
program)])
([//build.#JS ///.#js]
[//build.#Python ///.#python]
[//build.#Lua ///.#lua]
[//build.#Ruby ///.#ruby]))]
process (of shell execute [(dictionary.composite environment_vars command_environment)
working_directory
test_command
test_parameters])
_ (//build.log_output! console process)
_ (//build.log_error! console process)
exit (of process await [])
_ (is (Async (Try Any))
(console.write_line (if (i.= shell.normal exit)
..success
..failure)
console))]
(in [exit []]))
(in [build_exit []])))))
|