[config] default_to_workspace = false skip_core_tasks = true [env] TARGET_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/res" POA_TOKEN_WASM = "${TARGET_DIR}/defuse_poa_token.wasm" POA_TOKEN_WITH_NO_REGISTRATION_DIR = "${TARGET_DIR}/poa-token-no-registration" POA_TOKEN_WASM_NO_REGISTRATION_WASM = "${POA_TOKEN_WITH_NO_REGISTRATION_DIR}/defuse_poa_token.wasm" MT_RECEIVER_STUB_DIR = "${TARGET_DIR}/multi-token-receiver-stub" MT_RECEIVER_STUB_WASM = "${MT_RECEIVER_STUB_DIR}/multi_token_receiver_stub.wasm" [tasks.default] alias = "build" # ============================================================================ # Build tasks # ============================================================================ [tasks.build] dependencies = [ "add-cache-dir-tag", "build-defuse", "build-poa-factory", "build-poa-token-no-registration", "contract-stats", "build-multi-token-receiver-stub", ] [tasks.build-defuse] dependencies = ["add-cache-dir-tag"] command = "cargo" args = [ "near", "build", "non-reproducible-wasm", "--locked", "--manifest-path", "./defuse/Cargo.toml", "--features", "abi,contract", "--out-dir", "${TARGET_DIR}", "--no-embed-abi", ] [tasks.build-poa-factory] dependencies = ["add-cache-dir-tag", "build-poa-token"] command = "cargo" args = [ "near", "build", "non-reproducible-wasm", "--locked", "--manifest-path", "./poa-factory/Cargo.toml", "--features", "contract", "--out-dir", "${TARGET_DIR}", "--no-embed-abi", ] [tasks.build-poa-token] dependencies = ["add-cache-dir-tag"] command = "cargo" args = [ "near", "build", "non-reproducible-wasm", "--locked", "--manifest-path", "./poa-token/Cargo.toml", "--features", "contract", "--out-dir", "${TARGET_DIR}", "--no-embed-abi", ] [tasks.build-poa-token-no-registration] dependencies = ["add-cache-dir-tag"] command = "cargo" args = [ "near", "build", "non-reproducible-wasm", "--locked", "--manifest-path", "./poa-token/Cargo.toml", "--features", "contract,no-registration", "--out-dir", "${POA_TOKEN_WITH_NO_REGISTRATION_DIR}", "--no-embed-abi", ] # ============================================================================ # Build reproducible tasks # ============================================================================ [tasks.build-reproducible] dependencies = [ "add-cache-dir-tag", "build-defuse-reproducible", "build-poa-factory-reproducible", "build-poa-token-no-registration-reproducible", "defuse-reproducible-checksum", "contract-stats", ] [tasks.build-defuse-reproducible] dependencies = ["add-cache-dir-tag"] command = "cargo" args = [ "near", "build", "reproducible-wasm", "--manifest-path", "./defuse/Cargo.toml", "--out-dir", "${TARGET_DIR}", ] [tasks.build-poa-factory-reproducible] dependencies = ["add-cache-dir-tag", "build-poa-token-reproducible"] command = "cargo" args = [ "near", "build", "reproducible-wasm", "--manifest-path", "./poa-factory/Cargo.toml", "--out-dir", "${TARGET_DIR}", ] [tasks.build-poa-token-reproducible] dependencies = ["add-cache-dir-tag"] command = "cargo" args = [ "near", "build", "reproducible-wasm", "--manifest-path", "./poa-token/Cargo.toml", "--out-dir", "${TARGET_DIR}", ] [tasks.build-poa-token-no-registration-reproducible] dependencies = ["add-cache-dir-tag"] command = "cargo" args = [ "near", "build", "reproducible-wasm", "--manifest-path", "./poa-token/Cargo.toml", "--out-dir", "${POA_TOKEN_WITH_NO_REGISTRATION_DIR}", "--variant", "no_registration", ] [tasks.defuse-reproducible-checksum] dependencies = ["build-defuse-reproducible"] script = [ "SHA256=$(sha256sum ${TARGET_DIR}/defuse.wasm | awk '{print $1}')", 'echo "${SHA256}" > ${TARGET_DIR}/defuse.sha256', ] # ============================================================================ # Test tasks # ============================================================================ [tasks.test] alias = "tests" [tasks.nextest] dependencies = ["build"] command = "cargo" args = ["nextest", "run", "--all", "${@}"] [tasks.tests] dependencies = ["build"] run_task = "run-tests" [tasks.run-tests] command = "cargo" args = ["test", "--workspace", "--all-targets", "${@}"] # ============================================================================ # Cleanup tasks # ============================================================================ [tasks.clean] dependencies = ["rm-contracts"] command = "cargo" args = ["clean"] [tasks.rm-contracts] script = "rm -rf ${TARGET_DIR}" [tasks.contract-stats] category = "Tools" script = "cd ${TARGET_DIR} && du -ah *.wasm" # ============================================================================ # Helpers # ============================================================================ [tasks.clippy] dependencies = ["add-cache-dir-tag"] command = "cargo" args = ["clippy", "--workspace", "--all-targets", "--no-deps"] # We add CACHEDIR.TAG as it helps in making system level applications, e.g., backup systems, understand that this directory is just for disposable things. [tasks.add-cache-dir-tag] condition = { platforms = ["linux", "mac"] } script = [ "mkdir -p target res", "echo 'Signature: 8a477f597d28d172789f06886806bc55' | tee target/CACHEDIR.TAG res/CACHEDIR.TAG > /dev/null", ] [tasks.build-multi-token-receiver-stub] dependencies = ["add-cache-dir-tag"] command = "cargo" args = [ "near", "build", "non-reproducible-wasm", "--locked", "--manifest-path", "./tests/contracts/multi-token-receiver-stub/Cargo.toml", "--features", "abi", "--out-dir", "${MT_RECEIVER_STUB_DIR}", "--no-embed-abi", ]