-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Set up Cargo Make for project build orchestration
- Loading branch information
Showing
3 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[config] | ||
skip_core_tasks = true | ||
default_to_workspace = false | ||
|
||
[env] | ||
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true | ||
CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = ["contracts/room-contract", "ui"] | ||
CONTRACT_TARGET = "wasm32-unknown-unknown" | ||
CONTRACT_NAME = "room_contract" | ||
CONTRACTS_DIR = "ui/public/contracts" | ||
|
||
[tasks.clean] | ||
description = "Clean build artifacts" | ||
command = "cargo" | ||
args = ["clean"] | ||
|
||
[tasks.build-contract] | ||
description = "Build the room contract WASM" | ||
command = "cargo" | ||
args = ["build", "--release", "--target", "${CONTRACT_TARGET}", "-p", "room-contract"] | ||
|
||
[tasks.create-contracts-dir] | ||
description = "Ensure contracts directory exists" | ||
script = [ | ||
"mkdir -p ${CONTRACTS_DIR}", | ||
] | ||
|
||
[tasks.copy-contract] | ||
description = "Copy contract WASM to UI public directory" | ||
dependencies = ["build-contract", "create-contracts-dir"] | ||
script = [ | ||
"cp target/${CONTRACT_TARGET}/release/${CONTRACT_NAME}.wasm ${CONTRACTS_DIR}/" | ||
] | ||
|
||
[tasks.build-ui] | ||
description = "Build the Dioxus UI" | ||
dependencies = ["copy-contract"] | ||
command = "dx" | ||
args = ["build"] | ||
cwd = "./ui" | ||
|
||
[tasks.build] | ||
description = "Build everything" | ||
dependencies = ["build-ui"] | ||
|
||
[tasks.dev] | ||
description = "Development build" | ||
dependencies = ["copy-contract"] | ||
command = "dx" | ||
args = ["serve"] | ||
cwd = "./ui" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
pub const KEY_VERSION_PREFIX: &str = "river:v1:user:vk:"; | ||
|
||
// TODO: Should be built as a dependency with cargo build --release --target wasm32-unknown-unknown -p room-contract | ||
pub const ROOM_CONTRACT_WASM: &[u8] = include_bytes!("../../target/wasm32-unknown-unknown/release/room_contract.wasm"); | ||
pub const ROOM_CONTRACT_WASM: &[u8] = include_bytes!("../public/contracts/room_contract.wasm"); | ||
|
||
// pub const ROOM_CONTRACT_CODE_HASH: CodeHash = CodeHash::from_code(ROOM_CONTRACT_WASM); |