Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit d971271

Browse files
committed
build: optimize build
1 parent d99f435 commit d971271

File tree

11 files changed

+86
-13
lines changed

11 files changed

+86
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ If you don't have it installed, the python script will do that anyway so there i
2525

2626
If you have an installed version of MaaFramework, you can skip this step and manually copy the MaaFramework dlls to `tauri/` directory.
2727

28-
If not, you can run the `makedeps.py` script to download and extract the latest version of MaaFramework to the `tauri/` directory. Then, as said above, you might need to set your environment variables to point to the MaaFramework installation directory.
28+
If not, you can run the `scripts/makedeps.py` script to download and extract the latest version of MaaFramework to the `tauri/` directory. Then, as said above, you might need to set your environment variables to point to the MaaFramework installation directory.
2929

3030
If you have run the `makedeps.py`, you can put `$projectDir/deps/maafw` in your PATH environment variable.
3131

config/windows/main.conf.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"bundle": {
3+
"windows": {
4+
"webviewInstallMode": {
5+
"type": "embedBootstrapper",
6+
"silent": true
7+
}
8+
}
9+
}
10+
}

config/windows/slim.conf.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"bundle": {
3+
"windows": {
4+
"webviewInstallMode": {
5+
"type": "downloadBootstrapper",
6+
"silent": true
7+
}
8+
}
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"bundle": {
3+
"windows": {
4+
"webviewInstallMode": {
5+
"type": "offlineInstaller",
6+
"silent": true
7+
}
8+
}
9+
}
10+
}

scripts/build.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import toml
2+
import os
3+
4+
5+
def get_version_name():
6+
with open('tauri/Cargo.toml') as f:
7+
data = toml.load(f)
8+
return (data['package']['version'], data['package']['name'])
9+
10+
11+
def build_single(name, version, arch, merge_conf):
12+
config_name = merge_conf.split(".")[0].split("\\")[-1]
13+
os.system(f"pnpm tauri build --config {merge_conf}")
14+
15+
target_name = f"tauri/target/release/bundle/nsis/{name}_{version}_{arch}_{config_name}-setup.exe"
16+
if os.path.exists(target_name):
17+
os.remove(target_name)
18+
os.rename(f"tauri/target/release/bundle/nsis/{name}_{version}_{arch}-setup.exe",
19+
f"tauri/target/release/bundle/nsis/{name}_{version}_{arch}_{config_name}-setup.exe")
20+
21+
22+
def build():
23+
version, name = get_version_name()
24+
arch = "x64" # For now we only support x64 for simplicity
25+
configs = os.scandir("config/windows")
26+
for config in configs:
27+
build_single(name, version, arch, config.path)
28+
29+
30+
if __name__ == "__main__":
31+
build()
File renamed without changes.

tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tauri/Cargo.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "maa-resonance"
3-
version = "0.0.0"
3+
version = "0.0.1"
44
description = "Automation tool for Resonance."
5-
authors = ["SmgPie <"]
5+
authors = ["MaaResonance Team"]
66
edition = "2021"
77

88
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -35,6 +35,13 @@ crate-type = ["staticlib", "cdylib", "rlib"]
3535
custom-protocol = ["tauri/custom-protocol"]
3636
mock = []
3737

38+
[profile.release]
39+
lto = true
40+
codegen-units = 1
41+
panic = "abort"
42+
strip = true
43+
opt-level = "z"
44+
3845
[lints.clippy]
3946
"pedantic" = { level = "warn", priority = -1 }
4047

@@ -103,8 +110,3 @@ mock = []
103110
"tests_outside_test_module" = "deny"
104111
"undocumented_unsafe_blocks" = "deny"
105112
"unseparated_literal_suffix" = "deny"
106-
107-
[profile.release]
108-
lto = true
109-
codegen-units = 1
110-
panic = "abort"

tauri/tauri.conf.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"icons/icon.ico"
2727
],
2828
"targets": [
29-
"msi"
29+
"nsis"
3030
]
3131
},
3232
"identifier": "org.maa.resonance",
@@ -35,6 +35,5 @@
3535
"open": true
3636
}
3737
},
38-
"productName": "maa-resonance",
39-
"version": "0.0.1"
38+
"productName": "maa-resonance"
4039
}

tauri/tauri.windows.conf.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
"MaaUtils.dll",
1111
"onnxruntime_maa.dll",
1212
"opencv_world4_maa.dll"
13-
]
13+
],
14+
"windows": {
15+
"allowDowngrades": false,
16+
"nsis": {
17+
"languages": ["SimpChinese", "English"],
18+
"displayLanguageSelector": true
19+
},
20+
"webviewInstallMode": {
21+
"type": "skip"
22+
}
23+
}
1424
}
1525
}

0 commit comments

Comments
 (0)