|
| 1 | +[env] |
| 2 | +CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true |
| 3 | +CARGO_MAKE_TIME_SUMMARY = true |
| 4 | +BREAKER = "----------------------------------------" |
| 5 | + |
| 6 | +# ROOT = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}" |
| 7 | +ROOT = "." |
| 8 | + |
| 9 | +# Platform specific file extensions, can use specifics for |
| 10 | +# build/dist taks that call linux.(args|command) vs windows.(args|command) |
| 11 | +# WINDOWS_EXTENSION = ".exe" |
| 12 | +# LINUX_EXTENSION = "" |
| 13 | +# MACOS_EXTENSION = "" |
| 14 | + |
| 15 | +# BIN_EXTENSION = "${LINUX_EXTENSION}" |
| 16 | + |
| 17 | +# Using a 'decode-mapping' to set the correct extension |
| 18 | +BIN_EXTENSION = { source = "${CARGO_MAKE_RUST_TARGET_OS}", default_value = "", mapping = { "linux" = "", "macos" = "", "windows" = ".exe", "openbsd" = "" } } |
| 19 | + |
| 20 | +## This isn't needed anyway |
| 21 | +# PROFILE = "${CARGO_MAKE_CARGO_PROFILE}" |
| 22 | +PROFILE = "release" |
| 23 | +VERSION = "${CARGO_MAKE_PROJECT_VERSION}" |
| 24 | +# Name of the output binary |
| 25 | +BIN_NAME = "${PROJECT_NAME}" |
| 26 | +# The formatted name of the output binary we want |
| 27 | +OUTPUT_BIN_NAME = "${BIN_NAME}_${VERSION}" |
| 28 | +# The folder where the binary will be copied to -- /_output_bin_name_dist |
| 29 | +DIST_FOLDER = "${ROOT}/_${OUTPUT_BIN_NAME}_dist" |
| 30 | +# the FULL path from root WITH EXE - root / target /current_profile / the_bin_name.EXE |
| 31 | +FOLDER_BIN_EXE = "${ROOT}/target/${PROFILE}/${BIN_NAME}${BIN_EXTENSION}" |
| 32 | + |
| 33 | +# If you're running on an older Windows, or a builder (workflows etc.) |
| 34 | +# You may want to change this to "powershell.exe" or "powershell" |
| 35 | +# I have not tested with the older versions personally- all commands are |
| 36 | +# powershell/pwsh compatible afik |
| 37 | +# |
| 38 | +# NOTE: cmd.exe is NOT supported as the commands use CMDlets for zipping, moving, etc. |
| 39 | +# |
| 40 | +WINDOWS_SHELL = "pwsh.exe" |
| 41 | + |
| 42 | +VARS = { script = [''' |
| 43 | +echo ""ROOT: ${ROOT} |
| 44 | +echo "PROFILE: ${PROFILE}" |
| 45 | +echo "VERSION: ${VERSION}" |
| 46 | +echo "BIN_NAME: ${BIN_NAME}" |
| 47 | +echo "OUTPUT_BIN_NAME: ${OUTPUT_BIN_NAME}" |
| 48 | +echo "DIST_FOLDER: ${DIST_FOLDER}" |
| 49 | +echo "FOLDER_BIN_EXE: ${FOLDER_BIN_EXE}" |
| 50 | +echo "BREAKER: ${BREAKER}" |
| 51 | +'''], multi_line = true } |
| 52 | + |
| 53 | +# Sanity command to dump out all the variables |
| 54 | +# Also serves as a way to see variable interp in multiline scripts (it's odd) |
| 55 | +[tasks.print_all] |
| 56 | +script_runner = "@duckscript" |
| 57 | +script = ''' |
| 58 | +echo "BREAKER: ${BREAKER}" |
| 59 | +echo ""ROOT: ${ROOT} |
| 60 | +echo "PROFILE: ${PROFILE}" |
| 61 | +echo "VERSION: ${VERSION}" |
| 62 | +echo "BIN_NAME: ${BIN_NAME}" |
| 63 | +echo "OUTPUT_BIN_NAME: ${OUTPUT_BIN_NAME}" |
| 64 | +echo "DIST_FOLDER: ${DIST_FOLDER}" |
| 65 | +echo "FOLDER_BIN_EXE: ${FOLDER_BIN_EXE}" |
| 66 | +echo "BREAKER: ${BREAKER}" |
| 67 | +''' |
| 68 | + |
| 69 | +# START Core bare. min |
| 70 | +[tasks.format] |
| 71 | +command = "cargo" |
| 72 | +args = ["fmt", "--", "--emit=files"] |
| 73 | +dependencies = ["_taplo_format"] |
| 74 | + |
| 75 | +[tasks.clean] |
| 76 | +command = "cargo" |
| 77 | +args = ["clean"] |
| 78 | + |
| 79 | +[tasks.build] |
| 80 | +command = "cargo" |
| 81 | +args = ["${BUILD_ARG}", "${@}"] |
| 82 | +dependencies = ["format"] |
| 83 | + |
| 84 | +[tasks.build_release] |
| 85 | +command = "cargo" |
| 86 | +args = ["${BUILD_ARG}", "--release", "${@}"] |
| 87 | +dependencies = ["format"] |
| 88 | + |
| 89 | +[tasks.docs] |
| 90 | +command = "cargo" |
| 91 | +args = ["doc", "--no-deps", "${@}"] |
| 92 | + |
| 93 | +[tasks.check] |
| 94 | +command = "cargo" |
| 95 | +args = ["check", "--all-targets", "--color", "always", "${@}"] |
| 96 | + |
| 97 | +[tasks.clippy] |
| 98 | +command = "cargo" |
| 99 | +args = [ |
| 100 | + "clippy", |
| 101 | + "--all-targets", |
| 102 | + "--color", |
| 103 | + "always", |
| 104 | + "--", |
| 105 | + "-W", |
| 106 | + "clippy::pedantic", |
| 107 | +] |
| 108 | +# END Core bare. min |
| 109 | + |
| 110 | +# START Tests |
| 111 | +[tasks.test] |
| 112 | +command = "cargo" |
| 113 | +args = ["test", "${@}"] |
| 114 | + |
| 115 | +[tasks.test_all] |
| 116 | +command = "cargo" |
| 117 | +args = ["test", "--all", "${@}"] |
| 118 | + |
| 119 | +[tasks.test_no_capture] |
| 120 | +command = "cargo" |
| 121 | +args = ["test", "${@}", "--", "--nocapture"] |
| 122 | + |
| 123 | +[tasks.test_all_no_capture] |
| 124 | +command = "cargo" |
| 125 | +args = ["test", "--all", "${@}", "--", "--nocapture"] |
| 126 | +# END Tests |
| 127 | + |
| 128 | +# START Function outputs |
| 129 | +[tasks.run] |
| 130 | +command = "cargo" |
| 131 | +# We also capture anything after the main command |
| 132 | +args = ["run", "${@}"] |
| 133 | + |
| 134 | +[tasks.run_release] |
| 135 | +command = "cargo" |
| 136 | +args = ["run", "--release", "${@}"] |
| 137 | + |
| 138 | +[tasks.run_as_project] |
| 139 | +command = "cargo" |
| 140 | +args = ["run", " --bin", "${PROJECT_NAME}", "${@}"] |
| 141 | + |
| 142 | +# END Function outputs |
| 143 | + |
| 144 | +# START Workspaces |
| 145 | +[tasks.build_workspace] |
| 146 | +command = "cargo" |
| 147 | +args = ["${BUILD_ARG}", "--workspace", "${@}"] |
| 148 | +dependencies = ["format"] |
| 149 | + |
| 150 | +[tasks.build_release_workspace] |
| 151 | +command = "cargo" |
| 152 | +args = ["${BUILD_ARG}", "--release", "--workspace", "${@}"] |
| 153 | +dependencies = ["format"] |
| 154 | + |
| 155 | +[tasks.test_workspace] |
| 156 | +command = "cargo" |
| 157 | +args = ["test", "--workspace", "${@}"] |
| 158 | +# END Workspaces |
| 159 | + |
| 160 | +[tasks.sleep] |
| 161 | +linux.command = "sleep" |
| 162 | +linux.args = ["${SLEEP_TIME}"] |
| 163 | +windows.command = "${WINDOWS_SHELL}" |
| 164 | +windows.args = ["-Command", "Start-Sleep", "-Seconds", "${SLEEP_TIME}"] |
| 165 | + |
| 166 | +## START Misc tasks |
| 167 | + |
| 168 | +# START Taplo (TOML Formmater) tasks |
| 169 | +[tasks.taplo_lint] |
| 170 | +command = "taplo" |
| 171 | +args = ["lint"] |
| 172 | + |
| 173 | +[tasks._taplo_format] |
| 174 | +command = "taplo" |
| 175 | +args = ["format"] |
| 176 | + |
| 177 | +[tasks._taplo_format_force] |
| 178 | +command = "taplo" |
| 179 | +args = ["format", "--force"] |
| 180 | +# END Taplo (TOML Formmater) tasks |
| 181 | + |
| 182 | +## END Misc tasks |
0 commit comments