-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile.toml
129 lines (114 loc) · 3.23 KB
/
Makefile.toml
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
[env]
PHOENIX_PREFIX = { value = "/tmp/phoenix", condition.env_not_set = [
"PHOENIX_PREFIX",
] }
PROJECT_ROOT = { script = ["pwd"] }
TARGET_DIR = "${PROJECT_ROOT}/target"
PHOENIX_TARGET_DIR = "${PROJECT_ROOT}/target/phoenix"
PHOENIX_COMPILE_LOG = "${PHOENIX_TARGET_DIR}/phoenix_compile_log.txt"
HOST_DEP = "${PHOENIX_TARGET_DIR}/host_dep"
[tasks.default]
alias = "dev-test-flow"
# the default make target
[tasks.dev-test-flow]
description = '''
Development testing flow.
You can customize your own development testing flow.
It current builds phoenixos; builds and deploys phoenix plugins, and runs phoenix daemon.
'''
dependencies = [
"build-phoenixos",
"build-plugins",
"deploy-plugins",
"run-phoenixos",
]
[tasks.phoenix_common]
description = '''
Build phoenix-common package and deploy it to target/host_dep.
'''
cwd = "${PROJECT_ROOT}"
script = '''
#!/usr/bin/env bash
set -euo pipefail
mkdir -p ${PHOENIX_TARGET_DIR}
cargo build -vv --release -p phoenix_common --color=always \
--target-dir ${PHOENIX_TARGET_DIR} |& tee ${PHOENIX_COMPILE_LOG}.2
mv -f ${PHOENIX_COMPILE_LOG}.2 ${PHOENIX_COMPILE_LOG}
rm -rf ${HOST_DEP}
cp -r ${PHOENIX_TARGET_DIR}/release/deps ${HOST_DEP}
'''
dependencies = ["remove-fingerprint1"]
[tasks.phoenix_cargo]
description = "Build phoenix_cargo tool."
cwd = "${PROJECT_ROOT}"
script = "cargo build --release --bin phoenix_cargo"
[tasks.build-phoenixos]
description = "Build phoenixos."
cwd = "${PROJECT_ROOT}"
script = '''
mkdir -p ${PHOENIX_TARGET_DIR}
${TARGET_DIR}/release/phoenix_cargo \
--compile-log ${PHOENIX_COMPILE_LOG} --host-dep ${HOST_DEP} -- \
build --release --target-dir ${PHOENIX_TARGET_DIR} -p phoenixos
'''
dependencies = [
"phoenix_common",
"phoenix_cargo",
# "remove-fingerprint2",
]
[tasks.phoenixos]
alias = "build-phoenixos"
[tasks.run-phoenixos]
description = "Start the phoenixos system service."
cwd = "${PROJECT_ROOT}"
command = "${PHOENIX_TARGET_DIR}/release/phoenixos"
args = ["${@}"]
[tasks.run]
alias = "run-phoenixos"
[tasks.build-plugins]
description = '''
Build specified plugins by package name.
If no argument is provided, build all plugins in this workspace.
'''
# cargo make build-plugins [package-name]*
cwd = "${PROJECT_ROOT}"
command = "${TARGET_DIR}/release/phoenix_cargo"
args = [
"--compile-log",
"${PHOENIX_COMPILE_LOG}",
"--host-dep",
"${HOST_DEP}",
"--",
"build",
"--release",
"--target-dir",
"${PHOENIX_TARGET_DIR}",
"-p ${@}",
]
# dependencies = ["remove-fingerprint3"]
[tasks.deploy-plugins]
description = "Deploy all plugins."
script = "${PROJECT_ROOT}/scripts/deploy_plugins.sh ${PHOENIX_PREFIX} ${PHOENIX_TARGET_DIR}"
[tasks.build-phoenix-cli]
description = '''
Build phoenix-cli tools.
'''
script = '''
cargo build --release -p phoenixctl
'''
[tasks.remove-fingerprint]
description = "Clear cargo fingerprint under target/release."
script = '''
rm -rf ${PHOENIX_TARGET_DIR}/release/.fingerprint
'''
# cargo-make won't run the same task twice, so we have to use aliases
[tasks]
remove-fingerprint1.alias = "remove-fingerprint"
remove-fingerprint2.alias = "remove-fingerprint"
remove-fingerprint3.alias = "remove-fingerprint"
[tasks.build]
description = "Forward everything to cargo build."
command = "cargo"
args = ["build", "${@}"]
[config]
default_to_workspace = false