microsoft/mu_feature_ffa
Publicmirrored fromhttps://github.com/microsoft/mu_feature_ffaAvailable
Makefile.toml
96lines · modecode
| 1 | [config] |
| 2 | default_to_workspace = false |
| 3 | |
| 4 | [env] |
| 5 | CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true |
| 6 | RUSTC_BOOTSTRAP = 1 |
| 7 | ARCH = "X64" |
| 8 | 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" ] } } |
| 9 | |
| 10 | CARGO_FEATURES_FLAG = {value = "--features ${FEATURES}", condition = {env_set = ["FEATURES"], env_true = ["FEATURES"]}} |
| 11 | BUILD_FLAGS = "--profile ${RUSTC_PROFILE} --target ${TARGET_TRIPLE} -Zbuild-std=core,compiler_builtins,alloc -Zbuild-std-features=compiler-builtins-mem -Zunstable-options --timings=html" |
| 12 | TEST_FLAGS = { value = "", condition = { env_not_set = ["TEST_FLAGS"] } } |
| 13 | COV_FLAGS = { value = "--out html --exclude-files **/tests/*", condition = { env_not_set = ["COV_FLAGS"] } } |
| 14 | |
| 15 | [env.development] |
| 16 | RUSTC_PROFILE = "dev" |
| 17 | RUSTC_TARGET = "debug" |
| 18 | |
| 19 | [env.release] |
| 20 | RUSTC_PROFILE = "release" |
| 21 | RUSTC_TARGET = "release" |
| 22 | |
| 23 | [tasks.individual-package-targets] |
| 24 | script_runner = "@duckscript" |
| 25 | script = ''' |
| 26 | args = get_env CARGO_MAKE_TASK_ARGS |
| 27 | |
| 28 | if is_empty ${args} |
| 29 | exit |
| 30 | end |
| 31 | |
| 32 | 1 = array "" |
| 33 | 2 = split ${args} , |
| 34 | 3 = array_concat ${1} ${2} |
| 35 | joined_args = array_join ${3} " -p " |
| 36 | release ${1} |
| 37 | release ${2} |
| 38 | release ${3} |
| 39 | |
| 40 | joined_args = trim ${joined_args} |
| 41 | set_env INDIVIDUAL_PACKAGE_TARGETS ${joined_args} |
| 42 | release ${joined_args} |
| 43 | ''' |
| 44 | |
| 45 | [tasks.build] |
| 46 | description = """Builds a single rust package. |
| 47 | |
| 48 | Customizations: |
| 49 | -p [development|release]: Builds in debug or release. Default: development |
| 50 | -e ARCH=[IA32|X64|AARCH64|LOCAL]: Builds with specifed arch. Default: X64 |
| 51 | -e FEATURES=[feature,...]: Builds with the specified features. Default: none |
| 52 | |
| 53 | Example: |
| 54 | `cargo make build RustModule` |
| 55 | `cargo make -p release build RustModule` |
| 56 | `cargo make -e ARCH=IA32 build RustLib` |
| 57 | `cargo make -e FEATURES=feature1,feature2 build RustLib` |
| 58 | """ |
| 59 | clear = true |
| 60 | command = "cargo" |
| 61 | args = ["build", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(BUILD_FLAGS, )", "@@split(CARGO_FEATURES_FLAG, ,remove-empty)"] |
| 62 | dependencies = ["individual-package-targets"] |
| 63 | |
| 64 | [tasks.check] |
| 65 | description = "Checks rust code for errors. Example `cargo make check`" |
| 66 | clear = true |
| 67 | command = "cargo" |
| 68 | args = ["check", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(BUILD_FLAGS, )"] |
| 69 | dependencies = ["individual-package-targets"] |
| 70 | |
| 71 | [tasks.check_json] |
| 72 | description = "Checks rust code for errors with results in JSON. Example `cargo make check_json`" |
| 73 | clear = true |
| 74 | command = "cargo" |
| 75 | args = ["check", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(BUILD_FLAGS, )", "--message-format=json"] |
| 76 | dependencies = ["individual-package-targets"] |
| 77 | |
| 78 | [tasks.test] |
| 79 | description = "Builds all rust tests in the workspace. Example `cargo make test`" |
| 80 | clear = true |
| 81 | command = "cargo" |
| 82 | args = ["test", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(TEST_FLAGS, )"] |
| 83 | dependencies = ["individual-package-targets"] |
| 84 | |
| 85 | [tasks.coverage] |
| 86 | description = "Build and run all tests and calculate coverage." |
| 87 | clear = true |
| 88 | command = "cargo" |
| 89 | args = ["tarpaulin", "@@split(INDIVIDUAL_PACKAGE_TARGETS, )", "@@split(COV_FLAGS, )", "--output-dir", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target"] |
| 90 | dependencies = ["individual-package-targets"] |
| 91 | |
| 92 | [tasks.clippy] |
| 93 | description = "Run cargo clippy." |
| 94 | clear = true |
| 95 | command = "cargo" |
| 96 | args = ["clippy", "--all-targets", "--", "-D", "warnings"] |
| 97 | |