-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
138 lines (118 loc) · 3.49 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
[env]
DATABASE_URL="sqlite:./resources/migrations/users.sqlite?mode=rwc"
LEPTOS_WASM_OPT_VERSION="version_119"
LEPTOS_SASS_VERSION="1.71.0"
RUSTDOCFLAGS="--enable-index-page -Zunstable-options --generate-link-to-definition --cfg docsrs"
[tasks.db-create]
workspace = false
install_crate = "sqlx-cli"
command = "cargo"
args = ["sqlx","database","create"]
[tasks.db-migrate]
workspace = false
install_crate = "sqlx-cli"
command = "cargo"
args = ["sqlx","migrate","run","--source","resources/migrations"]
[tasks.db-setup]
workspace = false
install_crate = "sqlx-cli"
command = "cargo"
args = ["sqlx","prepare","--workspace","--","--features=ssr","--package=immt"]
[tasks.db]
workspace = false
dependencies = ["db-create","db-migrate","db-setup"]
[tasks.leptos-release]
workspace = false
install_crate = "cargo-leptos"
command = "cargo"
args = ["leptos","build","--release"]
[tasks.doc]
workspace = false
install_crate = false
command = "cargo"
args = ["+nightly","doc","--workspace","--no-deps","--all-features","--release","--document-private-items"]
[tasks.docs]
alias = "doc"
[tasks.copy-to-bin]
workspace = false
script_runner = "@rust"
script = '''
use std::path::Path;
fn copy_dir_all(src: &Path, dst: &Path) -> std::io::Result<()> {
std::fs::create_dir_all(dst)?;
for entry in std::fs::read_dir(src)? {
let entry = entry?;
let ty = entry.file_type()?;
if ty.is_dir() {
copy_dir_all(&entry.path(), &dst.join(entry.file_name()))?;
} else {
std::fs::copy(&entry.path(), &dst.join(entry.file_name()))?;
}
}
Ok(())
}
fn main() {
let _ = std::fs::remove_dir_all(Path::new("./bin"));
std::fs::create_dir_all(Path::new("./bin")).unwrap();
copy_dir_all(&Path::new("./target/web"),&Path::new("./bin/web")).unwrap();
std::fs::copy(Path::new("./resources/settings.toml"),Path::new("./bin/settings.toml")).unwrap();
#[cfg(target_os="windows")]
{
let main_file = Path::new("./target/x86_64-pc-windows-msvc/release/immt.exe");
if main_file.exists() {
std::fs::copy(main_file,Path::new("./bin/immt.exe")).unwrap();
} else {
std::fs::copy(Path::new("./target/release/immt.exe"),Path::new("./bin/immt.exe")).unwrap();
}
return
}
std::fs::copy(Path::new("./target/release/immt"),Path::new("./bin/immt")).unwrap();
}
'''
[tasks.build-viewer]
workspace = false
cwd = "./source/shtml/viewer"
command = "cargo"
args = ["make"]
[tasks.vscode-npm-install]
workspace = false
cwd = "./source/ts/vscode"
command = "npm"
args = ["install"]
[tasks.vscode-build]
workspace = false
cwd = "./source/ts/vscode"
command = "npm"
args = ["run","build"]
dependencies = ["vscode-npm-install"]
[tasks.vscode]
workspace = false
cwd = "./source/ts/vscode"
command = "vsce"
args = ["package","--out","./immt.vsix"]
dependencies = ["vscode-build"]
[tasks.copy-viewer]
workspace = false
dependencies = ["build-viewer"]
script_runner = "@shell"
script = '''
cp ./source/shtml/viewer/pkg/shtml.js ./resources/assets/shtml.js
cp ./source/shtml/viewer/pkg/shtml_bg.wasm ./resources/assets/shtml_bg.wasm
'''
[tasks.all-release]
workspace = false
dependencies = ["build-viewer","copy-viewer","db","leptos-release","copy-to-bin"]
[tasks.leptos-dev]
workspace = false
install_crate = "cargo-leptos"
command = "cargo"
args = ["leptos","build"]
dependencies = ["build-viewer","copy-viewer","db"]
[tasks.watch]
workspace = false
install_crate = "cargo-leptos"
command = "cargo"
args = ["leptos","watch","--","--port","3000"]
[tasks.default]
workspace = false
alias = "all-release"