-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile.toml
164 lines (139 loc) · 5.64 KB
/
Makefile.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
[config]
skip_core_tasks = true
default_to_workspace = false
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = ["contracts/room-contract", "contracts/web-container-contract", "ui"]
CONTRACT_TARGET = "wasm32-unknown-unknown"
CONTRACT_NAME = "room_contract"
BUILD_PROFILE = "release"
# Comma-separated list of features to enable
UI_FEATURES = ""
[tasks.clean]
description = "Clean build artifacts"
command = "cargo"
args = ["clean"]
[tasks.build-room-contract]
description = "Build the room contract WASM"
command = "cargo"
args = ["build", "--profile", "${BUILD_PROFILE}", "--target", "${CONTRACT_TARGET}", "-p", "room-contract", "--target-dir", "target"]
[tasks.build-web-container]
description = "Build the web container contract WASM"
command = "cargo"
args = ["build", "--profile", "${BUILD_PROFILE}", "--target", "${CONTRACT_TARGET}", "-p", "web-container-contract", "--target-dir", "target"]
[tasks.build-web-container-tool]
description = "Build the web container tool for native platform"
dependencies = ["build-web-container"]
command = "cargo"
args = ["build", "--profile", "${BUILD_PROFILE}", "--package", "web-container-tool", "--target-dir", "target/native", "--target", "x86_64-unknown-linux-gnu"]
[tasks.build-ui]
description = "Build the Dioxus UI"
dependencies = ["build-room-contract"]
env = { RIVER_BASE_PATH = "/v1/contract/web/29cBpyCAdKmmqPjriYGqxqNbt6TPVxKbkfRWDD9L7NUG" }
command = "dx"
args = ["build", "--${BUILD_PROFILE}", "--features", "${UI_FEATURES}"]
cwd = "./ui"
[tasks.compress-webapp]
description = "Compress the built webapp into tar.xz"
dependencies = ["build-ui"]
script = '''
mkdir -p target/webapp
cd target/dx/river-ui/${BUILD_PROFILE}/web/public && \
tar -cJf ../../../../../webapp/webapp.tar.xz --transform 's,^,web/,' *
'''
[tasks.sign-webapp]
description = "Sign the compressed webapp"
dependencies = ["compress-webapp", "build-web-container-tool", "build-web-container"]
script = '''
seconds=$(date +%s)
version=$(( seconds / 60 ))
target/native/x86_64-unknown-linux-gnu/${BUILD_PROFILE}/web-container-tool sign \
--input target/webapp/webapp.tar.xz \
--output target/webapp/webapp.metadata \
--parameters target/webapp/webapp.parameters \
--version $version
'''
[tasks.build-ui-example]
description = "Build the Dioxus UI with example data"
env = { UI_FEATURES = "example-data" }
dependencies = ["build-contract"]
command = "dx"
args = ["build", "--${BUILD_PROFILE}", "--features", "${UI_FEATURES}"]
cwd = "./ui"
[tasks.build-ui-no-sync]
description = "Build the Dioxus UI without Freenet sync"
env = { UI_FEATURES = "no-sync" }
dependencies = ["build-contract"]
command = "dx"
args = ["build", "--${BUILD_PROFILE}", "--features", "${UI_FEATURES}"]
cwd = "./ui"
[tasks.build-ui-example-no-sync]
description = "Build the Dioxus UI with example data and no Freenet sync"
env = { UI_FEATURES = "example-data,no-sync" }
dependencies = ["build-contract"]
command = "dx"
args = ["build", "--${BUILD_PROFILE}", "--features", "${UI_FEATURES}"]
cwd = "./ui"
[tasks.test-web-container]
description = "Run tests for web-container-contract"
command = "cargo"
args = ["test", "--package", "web-container-contract", "--target-dir", "target/native", "--target", "x86_64-unknown-linux-gnu", "--lib", "--bins"]
[tasks.test-web-container-integration]
description = "Run integration tests for web-container-contract"
command = "cargo"
args = ["test", "--package", "web-container-contract", "--target-dir", "target/native", "--target", "x86_64-unknown-linux-gnu", "--test", "integration_tests"]
[tasks.test-room-contract]
description = "Run tests for room-contract"
command = "cargo"
args = ["test", "--package", "room-contract", "--target-dir", "target/native", "--target", "x86_64-unknown-linux-gnu"]
[tasks.test-scaffold]
description = "Run tests for scaffold crate"
command = "cargo"
args = ["test", "--package", "freenet-scaffold", "--target-dir", "target/native", "--target", "x86_64-unknown-linux-gnu"]
[tasks.test-common]
description = "Run tests for common crate"
command = "cargo"
args = ["test", "--package", "river-common", "--target-dir", "target/native", "--target", "x86_64-unknown-linux-gnu"]
[tasks.test]
description = "Run all tests"
dependencies = ["test-web-container", "test-web-container-integration", "test-room-contract", "test-scaffold", "test-common"]
[tasks.publish-river]
description = "Publish River to Freenet"
dependencies = ["sign-webapp"]
env = { "RUST_LOG" = "error" }
script = '''
fdev publish \
--code target/wasm32-unknown-unknown/release/web_container_contract.wasm \
--parameters target/webapp/webapp.parameters \
contract \
--webapp-archive target/webapp/webapp.tar.xz \
--webapp-metadata target/webapp/webapp.metadata
'''
[tasks.clippy]
description = "Run clippy on all packages"
command = "cargo"
args = ["clippy", "--manifest-path", "./Cargo.toml", "--workspace", "--exclude", "freenet-stdlib", "--all-targets", "--", "-D", "warnings"]
[tasks.build]
description = "Build everything in release mode (optimized)"
dependencies = ["build-ui", "build-web-container"]
[tasks.dev-example]
description = "Development build with example data"
env = { UI_FEATURES = "example-data", BUILD_PROFILE = "debug" }
dependencies = ["build-contract"]
command = "dx"
args = ["serve", "--features", "${UI_FEATURES}"]
cwd = "./ui"
[tasks.build-example]
description = "Build everything in release mode with example data"
dependencies = ["build-ui-example"]
[tasks.build-debug]
description = "Build everything in debug mode (faster builds)"
env = { BUILD_PROFILE = "debug" }
dependencies = ["build-ui"]
[tasks.dev]
description = "Development build"
env = { UI_FEATURES = "" }
dependencies = ["build-contract"]
command = "dx"
args = ["serve"]
cwd = "./ui"