forked from microsoft/mu_basecore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
90 lines (75 loc) · 3.24 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
[config]
default_to_workspace = false
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
RUSTC_BOOTSTRAP = 1
ARCH = "X64"
TARGET_TRIPLE = { source = "${ARCH}", mapping = { "X64" = "x86_64-unknown-uefi", "IA32" = "i686-unknown-uefi", "AARCH64" = "aarch64-unknown-uefi", "LOCAL" = "${CARGO_MAKE_RUST_TARGET_TRIPLE}" }, condition = { env_not_set = [ "TARGET_TRIPLE" ] } }
CARGO_FEATURES_FLAG = {value = "--features ${FEATURES}", condition = {env_set = ["FEATURES"], env_true = ["FEATURES"]}}
BUILD_FLAGS = "--profile ${RUSTC_PROFILE} --target ${TARGET_TRIPLE} -Zbuild-std=core,compiler_builtins,alloc -Zbuild-std-features=compiler-builtins-mem -Zunstable-options --timings=html"
TEST_FLAGS = { value = "", condition = { env_not_set = ["TEST_FLAGS"] } }
COV_FLAGS = { value = "--out html --exclude-files **/tests/*", condition = { env_not_set = ["COV_FLAGS"] } }
[env.development]
RUSTC_PROFILE = "dev"
RUSTC_TARGET = "debug"
[env.release]
RUSTC_PROFILE = "release"
RUSTC_TARGET = "release"
[tasks.individual-package-targets]
script_runner = "@duckscript"
script = '''
args = get_env CARGO_MAKE_TASK_ARGS
if is_empty ${args}
exit
end
1 = array ""
2 = split ${args} ,
3 = array_concat ${1} ${2}
joined_args = array_join ${3} " -p "
release ${1}
release ${2}
release ${3}
joined_args = trim ${joined_args}
set_env INDIVIDUAL_PACKAGE_TARGETS ${joined_args}
release ${joined_args}
'''
[tasks.build]
description = """Builds a single rust package.
Customizations:
-p [development|release]: Builds in debug or release. Default: development
-e ARCH=[IA32|X64|AARCH64|LOCAL]: Builds with specifed arch. Default: X64
-e FEATURES=[feature,...]: Builds with the specified features. Default: none
Example:
`cargo make build RustModule`
`cargo make -p release build RustModule`
`cargo make -e ARCH=IA32 build RustLib`
`cargo make -e FEATURES=feature1,feature2 build RustLib`
"""
clear = true
command = "cargo"
args = ["build", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(BUILD_FLAGS, )", "@@split(CARGO_FEATURES_FLAG, ,remove-empty)"]
dependencies = ["individual-package-targets"]
[tasks.check]
description = "Checks rust code for errors. Example `cargo make check`"
clear = true
command = "cargo"
args = ["check", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(BUILD_FLAGS, )"]
dependencies = ["individual-package-targets"]
[tasks.check_json]
description = "Checks rust code for errors with results in JSON. Example `cargo make check_json`"
clear = true
command = "cargo"
args = ["check", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(BUILD_FLAGS, )", "--message-format=json"]
dependencies = ["individual-package-targets"]
[tasks.test]
description = "Builds all rust tests in the workspace. Example `cargo make test`"
clear = true
command = "cargo"
args = ["test", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(TEST_FLAGS, )"]
dependencies = ["individual-package-targets"]
[tasks.coverage]
description = "Build and run all tests and calculate coverage."
clear = true
command = "cargo"
args = ["tarpaulin", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(COV_FLAGS, )", "--output-dir", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target"]
dependencies = ["individual-package-targets"]