2023-08-18 23:19:33 +03:00
|
|
|
[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" ] } }
|
|
|
|
|
2024-01-19 23:33:56 +03:00
|
|
|
CARGO_FEATURES_FLAG = {value = "--features ${FEATURES}", condition = {env_set = ["FEATURES"], env_true = ["FEATURES"]}}
|
2023-08-18 23:19:33 +03:00
|
|
|
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"] } }
|
2023-09-26 21:36:12 +03:00
|
|
|
COV_FLAGS = { value = "--out html --exclude-files **/tests/*", condition = { env_not_set = ["COV_FLAGS"] } }
|
2023-08-18 23:19:33 +03:00
|
|
|
|
|
|
|
[env.development]
|
|
|
|
RUSTC_PROFILE = "dev"
|
|
|
|
RUSTC_TARGET = "debug"
|
|
|
|
|
|
|
|
[env.release]
|
|
|
|
RUSTC_PROFILE = "release"
|
|
|
|
RUSTC_TARGET = "release"
|
|
|
|
|
2023-09-26 21:36:12 +03:00
|
|
|
[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}
|
|
|
|
'''
|
|
|
|
|
2023-08-18 23:19:33 +03:00
|
|
|
[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
|
2024-01-19 23:33:56 +03:00
|
|
|
-e FEATURES=[feature,...]: Builds with the specified features. Default: none
|
2023-08-18 23:19:33 +03:00
|
|
|
|
|
|
|
Example:
|
|
|
|
`cargo make build RustModule`
|
|
|
|
`cargo make -p release build RustModule`
|
|
|
|
`cargo make -e ARCH=IA32 build RustLib`
|
2024-01-19 23:33:56 +03:00
|
|
|
`cargo make -e FEATURES=feature1,feature2 build RustLib`
|
2023-08-18 23:19:33 +03:00
|
|
|
"""
|
|
|
|
clear = true
|
|
|
|
command = "cargo"
|
2024-01-19 23:33:56 +03:00
|
|
|
args = ["build", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(BUILD_FLAGS, )", "@@split(CARGO_FEATURES_FLAG, ,remove-empty)"]
|
2023-09-26 21:36:12 +03:00
|
|
|
dependencies = ["individual-package-targets"]
|
2023-08-18 23:19:33 +03:00
|
|
|
|
2023-09-18 19:14:29 +03:00
|
|
|
[tasks.check]
|
|
|
|
description = "Checks rust code for errors. Example `cargo make check`"
|
|
|
|
clear = true
|
|
|
|
command = "cargo"
|
2023-09-26 21:36:12 +03:00
|
|
|
args = ["check", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(BUILD_FLAGS, )"]
|
|
|
|
dependencies = ["individual-package-targets"]
|
2023-09-18 19:14:29 +03:00
|
|
|
|
|
|
|
[tasks.check_json]
|
|
|
|
description = "Checks rust code for errors with results in JSON. Example `cargo make check_json`"
|
|
|
|
clear = true
|
|
|
|
command = "cargo"
|
2023-09-26 21:36:12 +03:00
|
|
|
args = ["check", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(BUILD_FLAGS, )", "--message-format=json"]
|
|
|
|
dependencies = ["individual-package-targets"]
|
2023-09-18 19:14:29 +03:00
|
|
|
|
2023-08-18 23:19:33 +03:00
|
|
|
[tasks.test]
|
|
|
|
description = "Builds all rust tests in the workspace. Example `cargo make test`"
|
|
|
|
clear = true
|
|
|
|
command = "cargo"
|
2023-09-26 21:36:12 +03:00
|
|
|
args = ["test", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(TEST_FLAGS, )"]
|
|
|
|
dependencies = ["individual-package-targets"]
|
2023-08-18 23:19:33 +03:00
|
|
|
|
|
|
|
[tasks.coverage]
|
|
|
|
description = "Build and run all tests and calculate coverage."
|
|
|
|
clear = true
|
|
|
|
command = "cargo"
|
2023-09-26 21:36:12 +03:00
|
|
|
args = ["tarpaulin", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(COV_FLAGS, )", "--output-dir", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target"]
|
|
|
|
dependencies = ["individual-package-targets"]
|